Enhance the command-line completion extension to return the names of
[sqlite.git] / test / writecrash.test
blob01bc4dbb56e1c53840785503b5d6f5876ce63af7
1 # 2009 January 8
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 #***********************************************************************
12 # Test the outcome of a writer crashing within a call to the VFS
13 # xWrite function.
17 set testdir [file dirname $argv0]
18 source $testdir/tester.tcl
19 set testprefix writecrash
21 do_not_use_codec
24 if {$tcl_platform(platform)=="windows"} {
25   finish_test
26   return
29 do_execsql_test 1.0 {
30   CREATE TABLE t1(a INTEGER PRIMARY KEY, b BLOB UNIQUE);
31   WITH s(i) AS (
32     VALUES(1) UNION ALL SELECT i+1 FROM s WHERE i<100
33   )
34   INSERT INTO t1 SELECT NULL, randomblob(900) FROM s;
35 } {}
37 set bGo 1
38 for {set tn 1} {$bGo} {incr tn} {
40 db close
41 sqlite3 db test.db
43   do_test 1.$tn.1 {
44     set res [crash_on_write $tn {
45       UPDATE t1 SET b = randomblob(899) WHERE (a%3)==0
46     }]
47     set bGo 0
48     if {[string match {1 {child killed:*}} $res]} {
49       set res {0 {}}
50       set bGo 1
51     }
52     set res
53   } {0 {}}
55 #db close
56 #sqlite3 db test.db
58   do_execsql_test 1.$tn.2 { PRAGMA integrity_check } {ok}
60 db close
61 sqlite3 db test.db
63   do_execsql_test 1.$tn.3 { PRAGMA integrity_check } {ok}
68 finish_test