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

Side by Side Diff: third_party/sqlite/sqlite-src-3170000/test/savepointfault.test

Issue 2747283002: [sql] Import reference version of SQLite 3.17.. (Closed)
Patch Set: Created 3 years, 9 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
(Empty)
1 # 2008 December 15
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
13 set testdir [file dirname $argv0]
14 source $testdir/tester.tcl
15
16 source $testdir/malloc_common.tcl
17
18 set testprefix savepointfault
19
20 do_malloc_test 1 -sqlprep {
21 CREATE TABLE t1(a, b, c);
22 INSERT INTO t1 VALUES(1, 2, 3);
23 } -sqlbody {
24 SAVEPOINT one;
25 INSERT INTO t1 VALUES(4, 5, 6);
26 SAVEPOINT two;
27 DELETE FROM t1;
28 ROLLBACK TO two;
29 RELEASE one;
30 }
31
32 do_malloc_test 2 -sqlprep {
33 PRAGMA cache_size = 10;
34 CREATE TABLE t1(a, b, c);
35 INSERT INTO t1 VALUES(randstr(400,400), randstr(400,400), randstr(400,400));
36 INSERT INTO t1 SELECT
37 randstr(400,400), randstr(400,400), randstr(400,400) FROM t1;
38 INSERT INTO t1
39 SELECT randstr(400,400), randstr(400,400), randstr(400,400) FROM t1;
40 INSERT INTO t1
41 SELECT randstr(400,400), randstr(400,400), randstr(400,400) FROM t1;
42 INSERT INTO t1
43 SELECT randstr(400,400), randstr(400,400), randstr(400,400) FROM t1;
44 INSERT INTO t1
45 SELECT randstr(400,400), randstr(400,400), randstr(400,400) FROM t1;
46 INSERT INTO t1
47 SELECT randstr(400,400), randstr(400,400), randstr(400,400) FROM t1;
48 INSERT INTO t1
49 SELECT randstr(400,400), randstr(400,400), randstr(400,400) FROM t1;
50 INSERT INTO t1
51 SELECT randstr(400,400), randstr(400,400), randstr(400,400) FROM t1;
52 } -sqlbody {
53 PRAGMA cache_size = 10;
54 SAVEPOINT one;
55 DELETE FROM t1 WHERE rowid < 5;
56 SAVEPOINT two;
57 DELETE FROM t1 WHERE rowid > 10;
58 ROLLBACK TO two;
59 ROLLBACK TO one;
60 RELEASE one;
61 }
62
63 do_ioerr_test 3 -sqlprep {
64 CREATE TABLE t1(a, b, c);
65 INSERT INTO t1 VALUES(1, randstr(1000,1000), randstr(1000,1000));
66 INSERT INTO t1 VALUES(2, randstr(1000,1000), randstr(1000,1000));
67 } -sqlbody {
68 BEGIN;
69 UPDATE t1 SET a = 3 WHERE a = 1;
70 SAVEPOINT one;
71 UPDATE t1 SET a = 4 WHERE a = 2;
72 COMMIT;
73 } -cleanup {
74 db eval {
75 SAVEPOINT one;
76 RELEASE one;
77 }
78 }
79
80 # The following test does a really big savepoint rollback. One involving
81 # more than 4000 pages. The idea is to get a specific sqlite3BitvecSet()
82 # operation in pagerPlaybackSavepoint() to fail.
83 #do_malloc_test 4 -sqlprep {
84 # BEGIN;
85 # CREATE TABLE t1(a, b);
86 # CREATE INDEX i1 ON t1(a);
87 # CREATE INDEX i2 ON t1(b);
88 # INSERT INTO t1 VALUES(randstr(500,500), randstr(500,500)); -- 1
89 # INSERT INTO t1 VALUES(randstr(500,500), randstr(500,500)); -- 2
90 # INSERT INTO t1 SELECT randstr(500,500), randstr(500,500) FROM t1; -- 4
91 # INSERT INTO t1 SELECT randstr(500,500), randstr(500,500) FROM t1; -- 8
92 # INSERT INTO t1 SELECT randstr(500,500), randstr(500,500) FROM t1; -- 16
93 # INSERT INTO t1 SELECT randstr(500,500), randstr(500,500) FROM t1; -- 32
94 # INSERT INTO t1 SELECT randstr(500,500), randstr(500,500) FROM t1; -- 64
95 # INSERT INTO t1 SELECT randstr(500,500), randstr(500,500) FROM t1; -- 128
96 # INSERT INTO t1 SELECT randstr(500,500), randstr(500,500) FROM t1; -- 256
97 # INSERT INTO t1 SELECT randstr(500,500), randstr(500,500) FROM t1; -- 512
98 # INSERT INTO t1 SELECT randstr(500,500), randstr(500,500) FROM t1; -- 1024
99 # INSERT INTO t1 SELECT randstr(500,500), randstr(500,500) FROM t1; -- 2048
100 # COMMIT;
101 # BEGIN;
102 # SAVEPOINT abc;
103 # UPDATE t1 SET a = randstr(500,500);
104 #} -sqlbody {
105 # ROLLBACK TO abc;
106 #}
107
108
109 # Cause a specific malloc in savepoint rollback code to fail.
110 #
111 do_malloc_test 4 -start 7 -sqlprep {
112 PRAGMA auto_vacuum = incremental;
113 PRAGMA cache_size = 1000;
114
115 CREATE TABLE t1(a, b);
116 CREATE TABLE t2(a, b);
117 CREATE TABLE t3(a, b);
118 INSERT INTO t1 VALUES(1, randstr(500,500));
119 INSERT INTO t1 VALUES(2, randstr(500,500));
120 INSERT INTO t1 VALUES(3, randstr(500,500));
121 DELETE FROM t1;
122
123 BEGIN;
124 INSERT INTO t1 VALUES(1, randstr(500,500));
125 INSERT INTO t1 VALUES(2, randstr(500,500));
126 INSERT INTO t1 VALUES(3, randstr(500,500));
127 DROP TABLE t3; -- Page 5 of the database file is now free.
128 DROP TABLE t2; -- Page 4 of the database file is now free.
129
130 SAVEPOINT abc;
131 PRAGMA incremental_vacuum;
132 } -sqlbody {
133 ROLLBACK TO abc;
134 }
135
136
137 finish_test
OLDNEW
« no previous file with comments | « third_party/sqlite/sqlite-src-3170000/test/savepoint7.test ('k') | third_party/sqlite/sqlite-src-3170000/test/scanstatus.test » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698