Add further multi-client tests to mmap1.test.

FossilOrigin-Name: a107f75d93b8acd3403d8473a75137378041a833
This commit is contained in:
dan 2013-04-04 19:32:53 +00:00
parent 75f2d540ac
commit ced9813b12
3 changed files with 85 additions and 20 deletions

View File

@ -1,5 +1,5 @@
C Disable\smemory-mapped\sI/O\sfor\sthe\swin32lock.test\smodule
D 2013-04-04T17:28:11.286
C Add\sfurther\smulti-client\stests\sto\smmap1.test.
D 2013-04-04T19:32:53.279
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in aafa71d66bab7e87fb2f348152340645f79f0244
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@ -631,7 +631,7 @@ F test/misc5.test 528468b26d03303b1f047146e5eefc941b9069f5
F test/misc6.test 953cc693924d88e6117aeba16f46f0bf5abede91
F test/misc7.test dd82ec9250b89178b96cd28b2aca70639d21e5b3
F test/misuse.test ba4fb5d1a6101d1c171ea38b3c613d0661c83054
F test/mmap1.test df5105f08e6000e57b4de7e748f8c2ae3fed75da
F test/mmap1.test 146a755bb382677b6f9993c61ddc7732b157d730
F test/mmap2.test 62dbb5d718e66d654d232116c5a2d96e26a071a5
F test/multiplex.test e08cc7177bd6d85990ee1d71100bb6c684c02256
F test/multiplex2.test 580ca5817c7edbe4cc68fa150609c9473393003a
@ -1044,7 +1044,7 @@ F tool/vdbe-compress.tcl f12c884766bd14277f4fcedcae07078011717381
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381
F tool/win/sqlite.vsix 97894c2790eda7b5bce3cc79cb2a8ec2fde9b3ac
P 51fab480d0487107709e6c9e00bc0512b82ef1aa
R c0f8ddd1641a176c1bcbffa647af40c5
U drh
Z f901f35bfd9928cf6d746ecf21982f94
P 2b3d9805a28e51f646113e22c2dff2272342306e
R 4c631120a8e96e37be49975ee7d63ac7
U dan
Z d6d074a538192756f7d91b52bba8b7ce

View File

@ -1 +1 @@
2b3d9805a28e51f646113e22c2dff2272342306e
a107f75d93b8acd3403d8473a75137378041a833

View File

@ -24,10 +24,22 @@ proc nRead {db} {
return $stats(read)
}
proc register_rblob_code {dbname seed} {
return [subst -nocommands {
set ::rcnt $seed
proc rblob {n} {
set ::rcnt [expr (([set ::rcnt] << 3) + [set ::rcnt] + 456) & 0xFFFFFFFF]
set str [format %.8x [expr [set ::rcnt] ^ 0xbdf20da3]]
string range [string repeat [set str] [expr [set n]/4]] 1 [set n]
}
$dbname func rblob rblob
}]
}
foreach {t mmap_limit nRead c2init} {
1.1 { PRAGMA mmap_limit = 67108864 } 4 {}
1.2 { PRAGMA mmap_limit = 53248 } 150 {}
1.3 { PRAGMA mmap_limit = 0 } 344 {}
1.1 { PRAGMA mmap_limit = 67108864 } 4 {PRAGMA mmap_limit = 0}
1.2 { PRAGMA mmap_limit = 53248 } 150 {PRAGMA mmap_limit = 0}
1.3 { PRAGMA mmap_limit = 0 } 344 {PRAGMA mmap_limit = 0}
1.4 { PRAGMA mmap_limit = 67108864 } 4 {PRAGMA mmap_limit = 67108864 }
1.5 { PRAGMA mmap_limit = 53248 } 150 {PRAGMA mmap_limit = 67108864 }
1.6 { PRAGMA mmap_limit = 0 } 344 {PRAGMA mmap_limit = 67108864 }
@ -37,15 +49,7 @@ foreach {t mmap_limit nRead c2init} {
sql1 $mmap_limit
sql2 $c2init
code2 {
set ::rcnt 0
proc rblob {n} {
set ::rcnt [expr (($::rcnt << 3) + $::rcnt + 456) & 0xFFFFFFFF]
set str [format %.8x [expr $::rcnt ^ 0xbdf20da3]]
string range [string repeat $str [expr $n/4]] 1 $n
}
db2 func rblob rblob
}
code2 [register_rblob_code db2 0]
sql2 {
PRAGMA page_size=1024;
@ -245,6 +249,67 @@ do_test 5.5 {
sqlite3_finalize $::STMT
} SQLITE_OK
#-------------------------------------------------------------------------
# Test various mmap_limit settings.
#
foreach {tn1 mmap1 mmap2} {
1 6144 167773
2 18432 140399
3 43008 401302
4 92160 253899
5 190464 2
6 387072 752431
7 780288 291143
8 1566720 594306
9 3139584 829137
10 6285312 793963
11 12576768 1015590
} {
do_multiclient_test tn {
sql1 {
CREATE TABLE t1(a PRIMARY KEY);
CREATE TABLE t2(x);
INSERT INTO t2 VALUES('');
}
code1 [register_rblob_code db 0]
code2 [register_rblob_code db2 444]
sql1 "PRAGMA mmap_limit = $mmap1"
sql2 "PRAGMA mmap_limit = $mmap2"
do_test $tn1.$tn {
for {set i 1} {$i <= 100} {incr i} {
if {$i % 2} {
set c1 sql1
set c2 sql2
} else {
set c1 sql2
set c2 sql1
}
$c1 {
INSERT INTO t1 VALUES( rblob(5000) );
UPDATE t2 SET x = (SELECT md5sum(a) FROM t1);
}
set res [$c2 {
SELECT count(*) FROM t1;
SELECT x == (SELECT md5sum(a) FROM t1) FROM t2;
PRAGMA integrity_check;
}]
if {$res != [list $i 1 ok]} {
do_test $tn1.$tn.$i {
set ::res
} [list $i 1 ok]
}
}
set res 1
} {1}
}
}
finish_test