-C Add\stests\sto\sfkey2.test\sto\scheck\sthat\sON\sCONFLICT\sclauses\sdo\snot\saffect\sSQLite's\sbehaviour\swhen\san\sFK\sconstraint\sis\sviolated.
-D 2010-05-29T08:40:38
+C Changes\sto\sthe\sway\sone\sof\sthe\sWAL/OOM\stests\sworks.
+D 2010-05-31T06:38:35
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
F Makefile.in a5cad1f8f3e021356bfcc6c77dc16f6f1952bbc3
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
F test/mallocI.test e3ea401904d010cb7c1e4b2ee8803f4a9f5b999d
F test/mallocJ.test b5d1839da331d96223e5f458856f8ffe1366f62e
F test/mallocK.test d79968641d1b70d88f6c01bdb9a7eb4a55582cc9
-F test/malloc_common.tcl f95c4d3459877e64c2d856b8a9c39210f9968ddf
+F test/malloc_common.tcl d92de40a5583f977a7c1bd3a25d8f66d75e55263
F test/manydb.test b3d3bc4c25657e7f68d157f031eb4db7b3df0d3c
F test/memdb.test 0825155b2290e900264daaaf0334b6dfe69ea498
F test/memleak.test d2d2a1ff7105d32dc3fdf691458cf6cba58c7217
F test/walcksum.test 4efa8fb88c32bed8288ea4385a9cc113a5c8f0bf
F test/walcrash.test f6d5fb2bb108876f04848720a488065d9deef69f
F test/walcrash2.test 14585ad1a2c85da2de721caa3b4deeea55213008
-F test/walfault.test f71d4c9a13d4e27086aef55f1e0e94734ffa2f6a
+F test/walfault.test 690350d02057409b695a3694f048780f2c5e21f4
F test/walhook.test 67e675127f4acb72f061a12667ce6e5460b06b78
F test/walmode.test 6ca9d710cc9f6545b913abcded6d6b0b15641048
F test/walslow.test d21625e2e99e11c032ce949e8a94661576548933
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
-P 60c22bde52121993d4bea11eef38ab285c737e2c
-R 132966a7c0563e76b2849379585e861e
+P e9e5b1001986348ef0f88c19de87b94559a5451e
+R f3f15c95e56f90189266a174fb626d53
U dan
-Z 9c5f2213670b38101b8556211a758e4d
+Z 4fade6b535eae7f88d92509f7fe17c62
-e9e5b1001986348ef0f88c19de87b94559a5451e
\ No newline at end of file
+15abbc34168f7a5bd418254c2b16aac97029e6ea
\ No newline at end of file
return 0
}
+# The following procs are used as [do_faultsim_test] when injecting OOM
+# faults into test cases.
+#
+proc oom_injectstart {nRepeat iFail} {
+ sqlite3_memdebug_fail $iFail -repeat $nRepeat
+}
+proc oom_injectstop {} {
+ sqlite3_memdebug_fail -1
+}
+
+# This command is only useful when used by the -test script of a
+# [do_faultsim_test] test case.
+#
+proc faultsim_test_result {args} {
+ upvar testrc testrc testresult testresult testnfail testnfail
+ set t [list $testrc $testresult]
+ set r [concat $args [list {1 {out of memory}}]]
+ if { ($testnfail==0 && $t != [lindex $r 0]) || [lsearch $r $t]<0 } {
+ error "nfail=$testnfail rc=$testrc result=$testresult"
+ }
+}
+
+# Usage do_faultsim_test NAME ?OPTIONS...?
+#
+# The first argument, <test number>, is used as a prefix of the test names
+# taken by tests executed by this command. Options are as follows. All
+# options take a single argument.
+#
+# -injectstart Script to enable fault-injection.
+#
+# -injectstop Script to disable fault-injection.
+#
+# -prep Script to execute before -body.
+#
+# -body Script to execute (with fault injection).
+#
+# -test Script to execute after -body.
+#
+proc do_faultsim_test {testname args} {
+
+ set DEFAULT(-injectstart) {oom_injectstart 0}
+ set DEFAULT(-injectstop) {oom_injectstop}
+ set DEFAULT(-prep) ""
+ set DEFAULT(-body) ""
+ set DEFAULT(-test) ""
+
+ array set O [array get DEFAULT]
+ array set O $args
+ foreach o [array names O] {
+ if {[info exists DEFAULT($o)]==0} { error "unknown option: $o" }
+ }
+
+ proc faultsim_test_proc {testrc testresult testnfail} $O(-test)
+
+ set stop 0
+ for {set iFail 1} {!$stop} {incr iFail} {
+
+ # Evaluate the -prep script.
+ #
+ eval $O(-prep)
+
+ # Start the fault-injection. Run the -body script. Stop the fault
+ # injection. Local var $nfail is set to the total number of faults
+ # injected into the system this trial.
+ #
+ eval $O(-injectstart) $iFail
+ set rc [catch $O(-body) res]
+ set nfail [eval $O(-injectstop)]
+
+ # Run the -test script. If it throws no error, consider this trial
+ # sucessful. If it does throw an error, cause a [do_test] test to
+ # fail (and print out the unexpected exception thrown by the -test
+ # script at the same time).
+ #
+ set rc [catch [list faultsim_test_proc $rc $res $nfail] res]
+ if {$rc == 0} {set res ok}
+ do_test $testname.$iFail [list list $rc $res] {0 ok}
+
+ # If no faults where injected this trial, don't bother running
+ # any more. This test is finished.
+ #
+ if {$nfail==0} { set stop 1 }
+ }
+}
+
# Usage: do_malloc_test <test number> <options...>
#
# The first argument, <test number>, is an integer used to name the
ifcapable !wal {finish_test ; return }
-do_malloc_test walfault-oom-1 -sqlbody {
- PRAGMA journal_mode = WAL;
- CREATE TABLE t1(a, b);
- INSERT INTO t1 VALUES(1, 2);
- PRAGMA wal_checkpoint;
+do_faultsim_test walfault-oom-1 -prep {
+ catch { db close }
+ file delete -force test.db test.db-wal test.db-journal
+ sqlite3 db test.db
+} -body {
+ db eval { PRAGMA main.journal_mode = WAL }
+} -test {
+
+ faultsim_test_result {0 wal}
+
+ # Test that the connection that encountered an error as part of
+ # "PRAGMA journal_mode = WAL" and a new connection use the same
+ # journal mode when accessing the database.
+ #
+ # If "PRAGMA journal_mode" is executed immediately, connection [db] (the
+ # one that hit the error in journal_mode="WAL") might return "wal" even
+ # if it failed to switch the database to WAL mode. This is not considered
+ # a problem. When it tries to read the database, connection [db] correctly
+ # recognizes that it is a rollback database and switches back to a
+ # rollback compatible journal mode.
+ #
+ set jm [db one {SELECT * FROM sqlite_master ; PRAGMA main.journal_mode}]
+ sqlite3 db2 test.db
+ set jm2 [db2 one {SELECT * FROM sqlite_master ; PRAGMA main.journal_mode}]
+ db2 close
+
+ if { $jm!=$jm2 } { error "Journal modes do not match: $jm $jm2" }
+ if { $testrc==0 && $jm!="wal" } { error "Journal mode is not WAL" }
}
do_malloc_test walfault-oom-2 -tclprep {