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 # $Id: crash7.test,v 1.1 2008/04/03 14:36:26 danielk1977 Exp $
14 set testdir [file dirname $argv0]
15 source $testdir/tester.tcl
18 ifcapable !crashtest {
24 return [db eval {SELECT count(*), md5sum(a), md5sum(b), md5sum(c) FROM abc}]
27 foreach f [list test.db test.db-journal] {
28 for {set ii 1} {$ii < 64} {incr ii} {
33 set from_size [expr 1024 << ($ii&3)]
34 set to_size [expr 1024 << (($ii>>2)&3)]
37 PRAGMA page_size = $from_size;
39 CREATE TABLE abc(a PRIMARY KEY, b, c);
40 INSERT INTO abc VALUES(randomblob(100), randomblob(200), randomblob(1000));
42 SELECT randomblob(1000), randomblob(200), randomblob(100)
45 SELECT randomblob(100), randomblob(200), randomblob(1000)
48 SELECT randomblob(100), randomblob(200), randomblob(1000)
51 SELECT randomblob(100), randomblob(200), randomblob(1000)
54 SELECT randomblob(100), randomblob(200), randomblob(1000)
55 FROM abc WHERE [expr $ii&16];
57 SELECT randomblob(25), randomblob(45), randomblob(9456)
58 FROM abc WHERE [expr $ii&32];
60 SELECT randomblob(100), randomblob(200), randomblob(1000)
61 FROM abc WHERE [expr $ii&8];
63 SELECT randomblob(25), randomblob(45), randomblob(9456)
64 FROM abc WHERE [expr $ii&4];
71 do_test crash7-1.$ii.crash {
73 PRAGMA page_size = $to_size;
76 } {1 {child process exited abnormally}}
79 integrity_check crash7-1.$ii.integrity
87 CREATE TABLE t1(a, b, UNIQUE(a, b));
88 INSERT INTO t1 VALUES(randomblob(100), randomblob(100));
89 INSERT INTO t1 SELECT randomblob(100), randomblob(100) FROM t1;
90 INSERT INTO t1 SELECT randomblob(100), randomblob(100) FROM t1;
91 INSERT INTO t1 SELECT randomblob(100), randomblob(100) FROM t1;
92 INSERT INTO t1 SELECT randomblob(100), randomblob(100) FROM t1;
93 INSERT INTO t1 SELECT randomblob(100), randomblob(100) FROM t1;
94 INSERT INTO t1 SELECT randomblob(100), randomblob(100) FROM t1;
95 INSERT INTO t1 SELECT randomblob(100), randomblob(100) FROM t1;
96 INSERT INTO t1 SELECT randomblob(100), randomblob(100) FROM t1;
97 INSERT INTO t1 SELECT randomblob(100), randomblob(100) FROM t1;
98 INSERT INTO t1 SELECT randomblob(100), randomblob(100) FROM t1;
99 INSERT INTO t1 SELECT randomblob(100), randomblob(100) FROM t1;
100 INSERT INTO t1 SELECT randomblob(100), randomblob(100) FROM t1;
101 INSERT INTO t1 SELECT randomblob(100), randomblob(100) FROM t1;
102 INSERT INTO t1 SELECT randomblob(100), randomblob(100) FROM t1;
103 DELETE FROM t1 WHERE rowid%2;
107 for {set i 0} {$i < 20} {incr i} {
108 db_restore_and_reopen
109 do_test 2.[expr $i+1].1 {
110 crashsql -file test.db -seed $i {VACUUM}
111 } {1 {child process exited abnormally}}
112 do_execsql_test 2.[expr $i+1].2 { PRAGMA integrity_check } {ok}