3 # The author disclaims copyright to this source code. In place of
4 # a legal notice, here is a blessing:
6 # May you do good and not evil.
7 # May you find forgiveness for yourself and forgive others.
8 # May you share freely, never taking more than you give.
10 #***********************************************************************
14 set testdir [file dirname $argv0]
15 source $testdir/tester.tcl
16 source $testdir/lock_common.tcl
17 source $testdir/wal_common.tcl
18 ifcapable !wal {finish_test ; return }
19 set testprefix walcrash4
22 #-------------------------------------------------------------------------
23 # At one point, if "PRAGMA synchronous=full" is set and the platform
24 # does not support POWERSAFE_OVERWRITE, and the last frame written to
25 # the wal file in a transaction is aligned with a sector boundary, the
26 # xSync() call was omitted.
28 # The following test verifies that this has been fixed.
31 PRAGMA autovacuum = 0;
32 PRAGMA page_size = 1024;
33 PRAGMA journal_mode = wal;
34 PRAGMA main.synchronous = full;
37 faultsim_save_and_close
39 # The error message is different on unix and windows
41 if {$::tcl_platform(platform)=="windows"} {
42 set msg "child killed: unknown signal"
44 set msg "child process exited abnormally"
47 for {set nExtra 0} {$nExtra < 10} {incr nExtra} {
48 for {set i 0} {$i < 10} {incr i} {
49 do_test 1.nExtra=$nExtra.i=$i.1 {
50 faultsim_restore_and_reopen
52 set fd [open crash.tcl w]
53 puts $fd [subst -nocommands {
54 sqlite3_crash_enable 1
55 sqlite3_test_control_pending_byte $::sqlite_pending_byte
56 sqlite3 db test.db -vfs crash
58 PRAGMA main.synchronous=FULL;
60 CREATE TABLE t1(x UNIQUE);
62 for {set e 2} {[set e] < ($nExtra+2)} {incr e} {
63 db eval "CREATE TABLE t[set e] (x)"
66 INSERT INTO t1 VALUES( randomblob(170000) );
73 set r [catch { exec [info nameofexec] crash.tcl >@stdout } msg]
77 do_execsql_test 1.nExtra=$nExtra.i=$i.2 {
78 SELECT count(*) FROM t1;
79 PRAGMA integrity_check;