Chromium Code Reviews

Side by Side Diff: third_party/sqlite/sqlite-src-3080704/test/crash7.test

Issue 949043002: Add //third_party/sqlite to dirs_to_snapshot, remove net_sql.patch (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
OLDNEW
(Empty)
1 # 2008 March 20
2 #
3 # The author disclaims copyright to this source code. In place of
4 # a legal notice, here is a blessing:
5 #
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.
9 #
10 #***********************************************************************
11 #
12 # $Id: crash7.test,v 1.1 2008/04/03 14:36:26 danielk1977 Exp $
13
14 set testdir [file dirname $argv0]
15 source $testdir/tester.tcl
16 set testprefix crash7
17
18 ifcapable !crashtest {
19 finish_test
20 return
21 }
22
23 proc signature {} {
24 return [db eval {SELECT count(*), md5sum(a), md5sum(b), md5sum(c) FROM abc}]
25 }
26
27 foreach f [list test.db test.db-journal] {
28 for {set ii 1} {$ii < 64} {incr ii} {
29 db close
30 delete_file test.db
31 sqlite3 db test.db
32
33 set from_size [expr 1024 << ($ii&3)]
34 set to_size [expr 1024 << (($ii>>2)&3)]
35
36 execsql "
37 PRAGMA page_size = $from_size;
38 BEGIN;
39 CREATE TABLE abc(a PRIMARY KEY, b, c);
40 INSERT INTO abc VALUES(randomblob(100), randomblob(200), randomblob(1000)) ;
41 INSERT INTO abc
42 SELECT randomblob(1000), randomblob(200), randomblob(100)
43 FROM abc;
44 INSERT INTO abc
45 SELECT randomblob(100), randomblob(200), randomblob(1000)
46 FROM abc;
47 INSERT INTO abc
48 SELECT randomblob(100), randomblob(200), randomblob(1000)
49 FROM abc;
50 INSERT INTO abc
51 SELECT randomblob(100), randomblob(200), randomblob(1000)
52 FROM abc;
53 INSERT INTO abc
54 SELECT randomblob(100), randomblob(200), randomblob(1000)
55 FROM abc WHERE [expr $ii&16];
56 INSERT INTO abc
57 SELECT randomblob(25), randomblob(45), randomblob(9456)
58 FROM abc WHERE [expr $ii&32];
59 INSERT INTO abc
60 SELECT randomblob(100), randomblob(200), randomblob(1000)
61 FROM abc WHERE [expr $ii&8];
62 INSERT INTO abc
63 SELECT randomblob(25), randomblob(45), randomblob(9456)
64 FROM abc WHERE [expr $ii&4];
65 COMMIT;
66 "
67
68 set sig [signature]
69 db close
70
71 do_test crash7-1.$ii.crash {
72 crashsql -file $f "
73 PRAGMA page_size = $to_size;
74 VACUUM;
75 "
76 } {1 {child process exited abnormally}}
77
78 sqlite3 db test.db
79 integrity_check crash7-1.$ii.integrity
80 }
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
116 finish_test
OLDNEW
« no previous file with comments | « third_party/sqlite/sqlite-src-3080704/test/crash6.test ('k') | third_party/sqlite/sqlite-src-3080704/test/crash8.test » ('j') | no next file with comments »

Powered by Google App Engine