-C Fix\sa\sproblem\sintroduced\sinto\slock2.test\sby\sthe\sprevious\scommit.
-D 2010-06-15T18:00:06
+C Rationalize\sa\scommon\spattern\sin\stcl\stest\scases\sinto\sproc\sdo_multiclient_test.
+D 2010-06-15T19:07:42
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
F Makefile.in a5cad1f8f3e021356bfcc6c77dc16f6f1952bbc3
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
F test/crash5.test 80a2f7073381837fc082435c97df52a830abcd80
F test/crash6.test 9c730cf06335003cb1f5cfceddacd044155336e0
F test/crash7.test e20a7b9ee1d16eaef7c94a4cb7ed2191b4d05970
-F test/crash8.test 3af0fc90c3e593b85e810b8d6c50fc7d0df30008
+F test/crash8.test 6666f5fff4734e43d6c6d66798fa607f54d96bf3
F test/crashtest1.c 09c1c7d728ccf4feb9e481671e29dda5669bbcc2
F test/createtab.test 199cf68f44e5d9e87a0b8afc7130fdeb4def3272
F test/cse.test 277350a26264495e86b1785f34d2d0c8600e021c
F test/lock5.test 6b1f78f09ad1522843dad571b76b321e6f439bf7
F test/lock6.test 8df56060f396151777390982422c800d026e1722
F test/lock7.test 64006c84c1c616657e237c7ad6532b765611cf64
-F test/lock_common.tcl c03802ef77c3864f1a7d812b0760b59563f2613b
+F test/lock_common.tcl 8caff97399edc410c4b602e7df6e6b31c5bb1113
F test/lookaside.test 1dd350dc6dff015c47c07fcc5a727a72fc5bae02
F test/main.test 2be2352ac77ac5b238c6337a5469aeeef57677e6
F test/make-where7.tcl 05c16b5d4f5d6512881dfec560cb793915932ef9
F test/notnull.test cc7c78340328e6112a13c3e311a9ab3127114347
F test/null.test a8b09b8ed87852742343b33441a9240022108993
F test/openv2.test af02ed0a9cbc0d2a61b8f35171d4d117e588e4ec
-F test/pager1.test dcc50ea9c4fc8d6d7101733644655c8395826e9b
+F test/pager1.test fd1ca712732c3f760f122003497eda8c7886e425
F test/pageropt.test 8146bf448cf09e87bb1867c2217b921fb5857806
F test/pagesize.test 76aa9f23ecb0741a4ed9d2e16c5fa82671f28efb
F test/pcache.test eebc4420b37cb07733ae9b6e99c9da7c40dd6d58
F test/vtab_alter.test 9e374885248f69e251bdaacf480b04a197f125e5
F test/vtab_err.test 0d4d8eb4def1d053ac7c5050df3024fd47a3fbd8
F test/vtab_shared.test 0eff9ce4f19facbe0a3e693f6c14b80711a4222d
-F test/wal.test 0a599c3c4812ed92bc7ad9efcc2c4007fe4cc99a
+F test/wal.test 55c3fae8a03437d52518e61ef115544fac108582
F test/wal2.test f9dce93acecff697fc1935869b1ae4cb7dc14587
-F test/wal3.test 19ab7f6b932f6a9189fcac681123a4decb0a4243
+F test/wal3.test bb3bc0be06411c2d147c1d1d636b6208fbe0349d
F test/wal_common.tcl 3e953ae60919281688ea73e4d0aa0e1bc94becd9
F test/walbak.test e7650a26eb4b8abeca9b145b1af1e63026dde432
F test/walcksum.test 4efa8fb88c32bed8288ea4385a9cc113a5c8f0bf
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
-P 6e43eed9310bae9ca5e91f8fd9eafc45a16b7019
-R 8779aa903d62615a17eba65fcdac083a
+P c1c9f6fa9d75df740e577dbc5e6a24b91ad2bdd0
+R ed40c2790bbf762939a14a6621b8de02
U dan
-Z 19627af153a648d842fa403de154602d
+Z ccb2459886575665e681afcce6541b33
-c1c9f6fa9d75df740e577dbc5e6a24b91ad2bdd0
\ No newline at end of file
+efe44564983f115017658dd8a130226366d42bab
\ No newline at end of file
BEGIN;
UPDATE t1 SET x = randomblob(900);
}
- file delete -force testX.db testX.db-journal
+ file delete -force testX.db testX.db-journal testX.db-wal
copy_file test.db testX.db
copy_file test.db-journal testX.db-journal
db close
# processes) to test locking.
#
+proc do_multiclient_test {varname script} {
+
+ foreach code [list {
+ set ::code2_chan [launch_testfixture]
+ set ::code3_chan [launch_testfixture]
+ proc code2 {tcl} { testfixture $::code2_chan $tcl }
+ proc code3 {tcl} { testfixture $::code3_chan $tcl }
+ set tn 1
+ } {
+ proc code2 {tcl} { uplevel #0 $tcl }
+ proc code3 {tcl} { uplevel #0 $tcl }
+ set tn 2
+ }] {
+ faultsim_delete_and_reopen
+
+ # Open connections [db2] and [db3]. Depending on which iteration this
+ # is, the connections may be created in this interpreter, or in
+ # interpreters running in other OS processes. As such, the [db2] and [db3]
+ # commands should only be accessed within [code2] and [code3] blocks,
+ # respectively.
+ #
+ eval $code
+ code2 { sqlite3 db2 test.db }
+ code3 { sqlite3 db3 test.db }
+
+ # Shorthand commands. Execute SQL using database connection [db2] or
+ # [db3]. Return the results.
+ #
+ proc sql1 {sql} { db eval $sql }
+ proc sql2 {sql} { code2 [list db2 eval $sql] }
+ proc sql3 {sql} { code3 [list db3 eval $sql] }
+
+ proc csql1 {sql} { list [catch { sql1 $sql } msg] $msg }
+ proc csql2 {sql} { list [catch { sql2 $sql } msg] $msg }
+ proc csql3 {sql} { list [catch { sql3 $sql } msg] $msg }
+
+ uplevel set $varname $tn
+ uplevel $script
+
+ code2 { db2 close }
+ code3 { db3 close }
+ catch { close $::code2_chan }
+ catch { close $::code3_chan }
+ }
+}
+
# Launch another testfixture process to be controlled by this one. A
# channel name is returned that may be passed as the first argument to proc
# 'testfixture' to execute a command. The child testfixture process is shut
source $testdir/lock_common.tcl
source $testdir/malloc_common.tcl
-foreach code [list {
- set ::code2_chan [launch_testfixture]
- set ::code3_chan [launch_testfixture]
- proc code2 {tcl} { testfixture $::code2_chan $tcl }
- proc code3 {tcl} { testfixture $::code3_chan $tcl }
- set tn 1
-} {
- proc code2 {tcl} { uplevel #0 $tcl }
- proc code3 {tcl} { uplevel #0 $tcl }
- set tn 2
-}] {
-
- faultsim_delete_and_reopen
-
- # Open connections [db2] and [db3]. Depending on which iteration this
- # is, the connections may be created in this interpreter, or in
- # interpreters running in other OS processes. As such, the [db2] and [db3]
- # commands should only be accessed within [code2] and [code3] blocks,
- # respectively.
- #
- eval $code
- code2 { sqlite3 db2 test.db }
- code3 { sqlite3 db3 test.db }
-
- # Shorthand commands. Execute SQL using database connection [db2] or
- # [db3]. Return the results.
- #
- proc sql1 {sql} { db eval $sql }
- proc sql2 {sql} { code2 [list db2 eval $sql] }
- proc sql3 {sql} { code3 [list db3 eval $sql] }
-
- proc csql1 {sql} { list [catch { sql1 $sql } msg] $msg }
- proc csql2 {sql} { list [catch { sql2 $sql } msg] $msg }
- proc csql3 {sql} { list [catch { sql3 $sql } msg] $msg }
+do_multiclient_test tn {
# Create and populate a database table using connection [db]. Check
# that connections [db2] and [db3] can see the schema and content.
}
} {}
do_test pager1-$tn.5 { sql2 { SELECT * FROM t1 } } {1 one 2 two}
- do_test pager1-$tn.6 { sql3 { SELECT * FROM t1 } } {1 one 2 two}
do_test pager1-$tn.7 { sql1 { SELECT * FROM t1 } } {1 one 2 two 3 three}
# [db] still has an open write transaction. Check that this prevents
do_test pager1-$tn.27 { sql1 { SELECT * FROM t1 } } {21 one 22 two 23 three}
do_test pager1-$tn.27 { sql2 { SELECT * FROM t1 } } {21 one 22 two 23 three}
do_test pager1-$tn.28 { sql3 { SELECT * FROM t1 } } {21 one 22 two 23 three}
-
- code2 { db2 close }
- code3 { db3 close }
- catch { close $::code2_chan }
- catch { close $::code3_chan }
}
finish_test
set testdir [file dirname $argv0]
source $testdir/tester.tcl
source $testdir/lock_common.tcl
+source $testdir/malloc_common.tcl
ifcapable !wal {finish_test ; return }
# using multiple connections in the address space of the current process,
# and once with all connections except one running in external processes.
#
-foreach code [list {
- set ::code2_chan [launch_testfixture]
- set ::code3_chan [launch_testfixture]
- proc code2 {tcl} { testfixture $::code2_chan $tcl }
- proc code3 {tcl} { testfixture $::code3_chan $tcl }
- set tn 1
-} {
- proc code2 {tcl} { uplevel #0 $tcl }
- proc code3 {tcl} { uplevel #0 $tcl }
- set tn 2
-}] {
-
- eval $code
- reopen_db
-
- # Open connections [db2] and [db3]. Depending on which iteration this
- # is, the connections may be created in this interpreter, or in
- # interpreters running in other OS processes. As such, the [db2] and [db3]
- # commands should only be accessed within [code2] and [code3] blocks,
- # respectively.
- #
- code2 { sqlite3 db2 test.db ; db2 eval { PRAGMA journal_mode = WAL } }
- code3 { sqlite3 db3 test.db ; db3 eval { PRAGMA journal_mode = WAL } }
-
- # Shorthand commands. Execute SQL using database connection [db2] or
- # [db3]. Return the results.
- #
- proc sql2 {sql} { code2 [list db2 eval $sql] }
- proc sql3 {sql} { code3 [list db3 eval $sql] }
+do_multiclient_test tn {
# Initialize the database schema and contents.
#
do_test wal-10.$tn.1 {
execsql {
+ PRAGMA journal_mode = wal;
CREATE TABLE t1(a, b);
INSERT INTO t1 VALUES(1, 2);
SELECT * FROM t1;
}
- } {1 2}
+ } {wal 1 2}
# Open a transaction and write to the database using [db]. Check that [db2]
# is still able to read the snapshot before the transaction was opened.
sql2 COMMIT
execsql { PRAGMA wal_checkpoint }
} {}
-
- catch { db close }
- catch { code2 { db2 close } }
- catch { code3 { db3 close } }
- catch { close $::code2_chan }
- catch { close $::code3_chan }
}
#-------------------------------------------------------------------------
expr [file size test.db-wal] > [log_file_size 33000 1024]
} 1
-foreach code [list {
- set tn 3
- proc buddy {tcl} { uplevel #0 $tcl }
-} {
- set tn 4
- set ::buddy [launch_testfixture]
- proc buddy {tcl} { testfixture $::buddy $tcl }
-}] {
-
- eval $code
- reopen_db
+do_multiclient_test tn {
+ incr tn 2
do_test wal-13.$tn.0 {
- buddy { sqlite3 db2 test.db }
- execsql {
+ sql1 {
PRAGMA journal_mode = WAL;
CREATE TABLE t1(x);
INSERT INTO t1 SELECT randomblob(800);
}
- execsql { SELECT count(*) FROM t1 }
+ sql1 { SELECT count(*) FROM t1 }
} {1}
for {set ii 1} {$ii<16} {incr ii} {
do_test wal-13.$tn.$ii.a {
- buddy { db2 eval { INSERT INTO t1 SELECT randomblob(800) FROM t1 } }
- buddy { db2 eval { SELECT count(*) FROM t1 } }
+ sql2 { INSERT INTO t1 SELECT randomblob(800) FROM t1 }
+ sql2 { SELECT count(*) FROM t1 }
} [expr (1<<$ii)]
do_test wal-13.$tn.$ii.b {
- db eval { SELECT count(*) FROM t1 }
+ sql1 { SELECT count(*) FROM t1 }
} [expr (1<<$ii)]
do_test wal-13.$tn.$ii.c {
- db eval { SELECT count(*) FROM t1 }
+ sql1 { SELECT count(*) FROM t1 }
} [expr (1<<$ii)]
do_test wal-13.$tn.$ii.d {
- db eval { PRAGMA integrity_check }
+ sql1 { PRAGMA integrity_check }
} {ok}
}
-
- catch { db2 close }
- catch { close $::buddy }
- db close
}
#-------------------------------------------------------------------------
db2 close
}
-db close
-foreach code [list {
- proc code2 {tcl} { uplevel #0 $tcl }
- proc code3 {tcl} { uplevel #0 $tcl }
- set tn singleproc
-} {
- set ::code2_chan [launch_testfixture]
- set ::code3_chan [launch_testfixture]
- proc code2 {tcl} { testfixture $::code2_chan $tcl }
- proc code3 {tcl} { testfixture $::code3_chan $tcl }
- set tn multiproc
-}] {
- file delete -force test.db test.db-wal test.db-journal
- sqlite3 db test.db
- eval $code
+do_multiclient_test i {
- # Open connections [db2] and [db3]. Depending on which iteration this
- # is, the connections may be created in this interpreter, or in
- # interpreters running in other OS processes. As such, the [db2] and [db3]
- # commands should only be accessed within [code2] and [code3] blocks,
- # respectively.
- #
- code2 { sqlite3 db2 test.db ; db2 eval { PRAGMA journal_mode = WAL } }
- code3 { sqlite3 db3 test.db ; db3 eval { PRAGMA journal_mode = WAL } }
-
- # Shorthand commands. Execute SQL using database connection [db], [db2]
- # or [db3]. Return the results.
- #
- proc sql {sql} { db eval $sql }
- proc sql2 {sql} { code2 [list db2 eval $sql] }
- proc sql3 {sql} { code3 [list db3 eval $sql] }
+ set testname(1) multiproc
+ set testname(2) singleproc
+ set tn $testname($i)
do_test wal3-2.$tn.1 {
- sql {
+ sql1 {
PRAGMA page_size = 1024;
PRAGMA auto_vacuum = OFF;
PRAGMA journal_mode = WAL;
}
- sql {
+ sql1 {
CREATE TABLE t1(a, b);
INSERT INTO t1 VALUES(1, 'one');
BEGIN;
# no-op, as the entire log has already been backfilled.
#
do_test wal3-2.$tn.4 {
- sql {
+ sql1 {
COMMIT;
PRAGMA wal_checkpoint;
}
}
file size test.db
} [expr $AUTOVACUUM ? 5*1024 : 4*1024]
-
- catch { db close }
- catch { code2 { db2 close } }
- catch { code3 { db3 close } }
- catch { close $::code2_chan }
- catch { close $::code3_chan }
}
catch {db close}