sl@0
|
1 |
# 2008 March 20
|
sl@0
|
2 |
#
|
sl@0
|
3 |
# The author disclaims copyright to this source code. In place of
|
sl@0
|
4 |
# a legal notice, here is a blessing:
|
sl@0
|
5 |
#
|
sl@0
|
6 |
# May you do good and not evil.
|
sl@0
|
7 |
# May you find forgiveness for yourself and forgive others.
|
sl@0
|
8 |
# May you share freely, never taking more than you give.
|
sl@0
|
9 |
#
|
sl@0
|
10 |
#***********************************************************************
|
sl@0
|
11 |
#
|
sl@0
|
12 |
# $Id: crash7.test,v 1.1 2008/04/03 14:36:26 danielk1977 Exp $
|
sl@0
|
13 |
|
sl@0
|
14 |
set testdir [file dirname $argv0]
|
sl@0
|
15 |
source $testdir/tester.tcl
|
sl@0
|
16 |
|
sl@0
|
17 |
ifcapable !crashtest {
|
sl@0
|
18 |
finish_test
|
sl@0
|
19 |
return
|
sl@0
|
20 |
}
|
sl@0
|
21 |
|
sl@0
|
22 |
proc signature {} {
|
sl@0
|
23 |
return [db eval {SELECT count(*), md5sum(a), md5sum(b), md5sum(c) FROM abc}]
|
sl@0
|
24 |
}
|
sl@0
|
25 |
|
sl@0
|
26 |
foreach f [list test.db test.db-journal] {
|
sl@0
|
27 |
for {set ii 1} {$ii < 64} {incr ii} {
|
sl@0
|
28 |
db close
|
sl@0
|
29 |
file delete test.db
|
sl@0
|
30 |
sqlite3 db test.db
|
sl@0
|
31 |
|
sl@0
|
32 |
set from_size [expr 1024 << ($ii&3)]
|
sl@0
|
33 |
set to_size [expr 1024 << (($ii>>2)&3)]
|
sl@0
|
34 |
|
sl@0
|
35 |
execsql "
|
sl@0
|
36 |
PRAGMA page_size = $from_size;
|
sl@0
|
37 |
BEGIN;
|
sl@0
|
38 |
CREATE TABLE abc(a PRIMARY KEY, b, c);
|
sl@0
|
39 |
INSERT INTO abc VALUES(randomblob(100), randomblob(200), randomblob(1000));
|
sl@0
|
40 |
INSERT INTO abc
|
sl@0
|
41 |
SELECT randomblob(1000), randomblob(200), randomblob(100)
|
sl@0
|
42 |
FROM abc;
|
sl@0
|
43 |
INSERT INTO abc
|
sl@0
|
44 |
SELECT randomblob(100), randomblob(200), randomblob(1000)
|
sl@0
|
45 |
FROM abc;
|
sl@0
|
46 |
INSERT INTO abc
|
sl@0
|
47 |
SELECT randomblob(100), randomblob(200), randomblob(1000)
|
sl@0
|
48 |
FROM abc;
|
sl@0
|
49 |
INSERT INTO abc
|
sl@0
|
50 |
SELECT randomblob(100), randomblob(200), randomblob(1000)
|
sl@0
|
51 |
FROM abc;
|
sl@0
|
52 |
INSERT INTO abc
|
sl@0
|
53 |
SELECT randomblob(100), randomblob(200), randomblob(1000)
|
sl@0
|
54 |
FROM abc WHERE [expr $ii&16];
|
sl@0
|
55 |
INSERT INTO abc
|
sl@0
|
56 |
SELECT randomblob(25), randomblob(45), randomblob(9456)
|
sl@0
|
57 |
FROM abc WHERE [expr $ii&32];
|
sl@0
|
58 |
INSERT INTO abc
|
sl@0
|
59 |
SELECT randomblob(100), randomblob(200), randomblob(1000)
|
sl@0
|
60 |
FROM abc WHERE [expr $ii&8];
|
sl@0
|
61 |
INSERT INTO abc
|
sl@0
|
62 |
SELECT randomblob(25), randomblob(45), randomblob(9456)
|
sl@0
|
63 |
FROM abc WHERE [expr $ii&4];
|
sl@0
|
64 |
COMMIT;
|
sl@0
|
65 |
"
|
sl@0
|
66 |
|
sl@0
|
67 |
set sig [signature]
|
sl@0
|
68 |
db close
|
sl@0
|
69 |
|
sl@0
|
70 |
do_test crash7-1.$ii.crash {
|
sl@0
|
71 |
crashsql -file $f "
|
sl@0
|
72 |
PRAGMA page_size = $to_size;
|
sl@0
|
73 |
VACUUM;
|
sl@0
|
74 |
"
|
sl@0
|
75 |
} {1 {child process exited abnormally}}
|
sl@0
|
76 |
|
sl@0
|
77 |
sqlite3 db test.db
|
sl@0
|
78 |
integrity_check crash7-1.$ii.integrity
|
sl@0
|
79 |
}
|
sl@0
|
80 |
}
|
sl@0
|
81 |
|
sl@0
|
82 |
finish_test
|