Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(764)

Side by Side Diff: third_party/sqlite/src/test/crash6.test

Issue 901033002: Import SQLite 3.8.7.4. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Chromium changes to support SQLite 3.8.7.4. Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 # 2001 September 15 1 # 2001 September 15
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 # This file tests that rollback journals for databases that use a 11 # This file tests that rollback journals for databases that use a
12 # page-size other than the default page-size can be rolled back Ok. 12 # page-size other than the default page-size can be rolled back Ok.
13 # 13 #
14 # $Id: crash6.test,v 1.2 2008/04/14 15:27:19 drh Exp $ 14 # $Id: crash6.test,v 1.2 2008/04/14 15:27:19 drh Exp $
15 15
16 set testdir [file dirname $argv0] 16 set testdir [file dirname $argv0]
17 source $testdir/tester.tcl 17 source $testdir/tester.tcl
18 18
19 ifcapable !crashtest { 19 ifcapable !crashtest {
20 finish_test 20 finish_test
21 return 21 return
22 } 22 }
23 23
24 for {set ii 0} {$ii < 10} {incr ii} { 24 for {set ii 0} {$ii < 10} {incr ii} {
25 catch {db close} 25 catch {db close}
26 file delete -force test.db test.db-journal 26 forcedelete test.db test.db-journal
27 crashsql -delay 2 -file test.db { 27 crashsql -delay 2 -file test.db {
28 PRAGMA auto_vacuum=OFF; 28 PRAGMA auto_vacuum=OFF;
29 PRAGMA page_size=4096; 29 PRAGMA page_size=4096;
30 BEGIN; 30 BEGIN;
31 CREATE TABLE abc AS SELECT 1 AS a, 2 AS b, 3 AS c; 31 CREATE TABLE abc AS SELECT 1 AS a, 2 AS b, 3 AS c;
32 COMMIT; 32 COMMIT;
33 BEGIN; 33 BEGIN;
34 CREATE TABLE def AS SELECT 1 AS d, 2 AS e, 3 AS f; 34 CREATE TABLE def AS SELECT 1 AS d, 2 AS e, 3 AS f;
35 COMMIT; 35 COMMIT;
36 } 36 }
37 sqlite3 db test.db 37 sqlite3 db test.db
38 integrity_check crash6-1.$ii 38 integrity_check crash6-1.$ii
39 } 39 }
40 40
41 for {set ii 0} {$ii < 10} {incr ii} { 41 for {set ii 0} {$ii < 10} {incr ii} {
42 catch {db close} 42 catch {db close}
43 file delete -force test.db test.db-journal 43 forcedelete test.db test.db-journal
44 sqlite3 db test.db 44 sqlite3 db test.db
45 execsql { 45 execsql {
46 PRAGMA auto_vacuum=OFF; 46 PRAGMA auto_vacuum=OFF;
47 PRAGMA page_size=2048; 47 PRAGMA page_size=2048;
48 BEGIN; 48 BEGIN;
49 CREATE TABLE abc AS SELECT 1 AS a, 2 AS b, 3 AS c; 49 CREATE TABLE abc AS SELECT 1 AS a, 2 AS b, 3 AS c;
50 COMMIT; 50 COMMIT;
51 } 51 }
52 db close 52 db close
53 crashsql -delay 1 -file test.db { 53 crashsql -delay 1 -file test.db {
54 INSERT INTO abc VALUES(5, 6, 7); 54 INSERT INTO abc VALUES(5, 6, 7);
55 } 55 }
56 sqlite3 db test.db 56 sqlite3 db test.db
57 integrity_check crash6-2.$ii 57 integrity_check crash6-2.$ii
58 } 58 }
59 59
60 proc signature {} { 60 proc signature {} {
61 return [db eval {SELECT count(*), md5sum(a), md5sum(b), md5sum(c) FROM abc}] 61 return [db eval {SELECT count(*), md5sum(a), md5sum(b), md5sum(c) FROM abc}]
62 } 62 }
63 63
64 # Test case for crashing during database sync with page-size values 64 # Test case for crashing during database sync with page-size values
65 # from 1024 to 8192. 65 # from 1024 to 8192.
66 # 66 #
67 for {set ii 0} {$ii < 30} {incr ii} { 67 for {set ii 0} {$ii < 30} {incr ii} {
68 db close 68 db close
69 file delete -force test.db 69 forcedelete test.db
70 sqlite3 db test.db 70 sqlite3 db test.db
71 71
72 set pagesize [expr 1024 << ($ii % 4)] 72 set pagesize [expr 1024 << ($ii % 4)]
73 if {$pagesize>$::SQLITE_MAX_PAGE_SIZE} { 73 if {$pagesize>$::SQLITE_MAX_PAGE_SIZE} {
74 set pagesize $::SQLITE_MAX_PAGE_SIZE 74 set pagesize $::SQLITE_MAX_PAGE_SIZE
75 } 75 }
76 do_test crash6-3.$ii.0 { 76 do_test crash6-3.$ii.0 {
77 execsql "pragma page_size = $pagesize" 77 execsql "pragma page_size = $pagesize"
78 execsql "pragma page_size" 78 execsql "pragma page_size"
79 } $pagesize 79 } $pagesize
(...skipping 29 matching lines...) Expand all
109 " 109 "
110 } {1 {child process exited abnormally}} 110 } {1 {child process exited abnormally}}
111 111
112 do_test crash6-3.$ii.3 { 112 do_test crash6-3.$ii.3 {
113 sqlite3 db test.db 113 sqlite3 db test.db
114 signature 114 signature
115 } $sig 115 } $sig
116 } 116 }
117 117
118 finish_test 118 finish_test
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698