| OLD | NEW |
| 1 # 2008 March 20 | 1 # 2008 March 20 |
| 2 # | 2 # |
| 3 # The author disclaims copyright to this source code. In place of | 3 # The author disclaims copyright to this source code. In place of |
| 4 # a legal notice, here is a blessing: | 4 # a legal notice, here is a blessing: |
| 5 # | 5 # |
| 6 # May you do good and not evil. | 6 # May you do good and not evil. |
| 7 # May you find forgiveness for yourself and forgive others. | 7 # May you find forgiveness for yourself and forgive others. |
| 8 # May you share freely, never taking more than you give. | 8 # May you share freely, never taking more than you give. |
| 9 # | 9 # |
| 10 #*********************************************************************** | 10 #*********************************************************************** |
| 11 # | 11 # |
| 12 # $Id: crash7.test,v 1.1 2008/04/03 14:36:26 danielk1977 Exp $ | 12 # $Id: crash7.test,v 1.1 2008/04/03 14:36:26 danielk1977 Exp $ |
| 13 | 13 |
| 14 set testdir [file dirname $argv0] | 14 set testdir [file dirname $argv0] |
| 15 source $testdir/tester.tcl | 15 source $testdir/tester.tcl |
| 16 set testprefix crash7 |
| 16 | 17 |
| 17 ifcapable !crashtest { | 18 ifcapable !crashtest { |
| 18 finish_test | 19 finish_test |
| 19 return | 20 return |
| 20 } | 21 } |
| 21 | 22 |
| 22 proc signature {} { | 23 proc signature {} { |
| 23 return [db eval {SELECT count(*), md5sum(a), md5sum(b), md5sum(c) FROM abc}] | 24 return [db eval {SELECT count(*), md5sum(a), md5sum(b), md5sum(c) FROM abc}] |
| 24 } | 25 } |
| 25 | 26 |
| 26 foreach f [list test.db test.db-journal] { | 27 foreach f [list test.db test.db-journal] { |
| 27 for {set ii 1} {$ii < 64} {incr ii} { | 28 for {set ii 1} {$ii < 64} {incr ii} { |
| 28 db close | 29 db close |
| 29 file delete test.db | 30 delete_file test.db |
| 30 sqlite3 db test.db | 31 sqlite3 db test.db |
| 31 | 32 |
| 32 set from_size [expr 1024 << ($ii&3)] | 33 set from_size [expr 1024 << ($ii&3)] |
| 33 set to_size [expr 1024 << (($ii>>2)&3)] | 34 set to_size [expr 1024 << (($ii>>2)&3)] |
| 34 | 35 |
| 35 execsql " | 36 execsql " |
| 36 PRAGMA page_size = $from_size; | 37 PRAGMA page_size = $from_size; |
| 37 BEGIN; | 38 BEGIN; |
| 38 CREATE TABLE abc(a PRIMARY KEY, b, c); | 39 CREATE TABLE abc(a PRIMARY KEY, b, c); |
| 39 INSERT INTO abc VALUES(randomblob(100), randomblob(200), randomblob(1000))
; | 40 INSERT INTO abc VALUES(randomblob(100), randomblob(200), randomblob(1000))
; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 PRAGMA page_size = $to_size; | 73 PRAGMA page_size = $to_size; |
| 73 VACUUM; | 74 VACUUM; |
| 74 " | 75 " |
| 75 } {1 {child process exited abnormally}} | 76 } {1 {child process exited abnormally}} |
| 76 | 77 |
| 77 sqlite3 db test.db | 78 sqlite3 db test.db |
| 78 integrity_check crash7-1.$ii.integrity | 79 integrity_check crash7-1.$ii.integrity |
| 79 } | 80 } |
| 80 } | 81 } |
| 81 | 82 |
| 83 db close |
| 84 forcedelete test.db |
| 85 sqlite3 db test.db |
| 86 do_execsql_test 2.0 { |
| 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; |
| 104 } |
| 105 db_save_and_close |
| 106 |
| 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} |
| 113 } |
| 114 |
| 115 |
| 82 finish_test | 116 finish_test |
| OLD | NEW |