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

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

Issue 6990047: Import SQLite 3.7.6.3. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « third_party/sqlite/src/test/corruptE.test ('k') | third_party/sqlite/src/test/ctime.test » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # 2009 January 8 1 # 2009 January 8
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 #***********************************************************************
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 CREATE TABLE ab(a, b); 251 CREATE TABLE ab(a, b);
252 INSERT INTO ab VALUES(0, 'abc'); 252 INSERT INTO ab VALUES(0, 'abc');
253 INSERT INTO ab VALUES(1, NULL); 253 INSERT INTO ab VALUES(1, NULL);
254 INSERT INTO ab VALUES(2, NULL); 254 INSERT INTO ab VALUES(2, NULL);
255 INSERT INTO ab VALUES(3, NULL); 255 INSERT INTO ab VALUES(3, NULL);
256 INSERT INTO ab VALUES(4, NULL); 256 INSERT INTO ab VALUES(4, NULL);
257 INSERT INTO ab VALUES(5, NULL); 257 INSERT INTO ab VALUES(5, NULL);
258 INSERT INTO ab VALUES(6, NULL); 258 INSERT INTO ab VALUES(6, NULL);
259 UPDATE ab SET b = randstr(1000,1000); 259 UPDATE ab SET b = randstr(1000,1000);
260 ATTACH 'test2.db' AS aux; 260 ATTACH 'test2.db' AS aux;
261 PRAGMA aux.journal_mode = persist;
261 CREATE TABLE aux.ab(a, b); 262 CREATE TABLE aux.ab(a, b);
262 INSERT INTO aux.ab SELECT * FROM main.ab; 263 INSERT INTO aux.ab SELECT * FROM main.ab;
263 264
264 UPDATE aux.ab SET b = randstr(1000,1000) WHERE a>=1; 265 UPDATE aux.ab SET b = randstr(1000,1000) WHERE a>=1;
265 UPDATE ab SET b = randstr(1000,1000) WHERE a>=1; 266 UPDATE ab SET b = randstr(1000,1000) WHERE a>=1;
266 } 267 }
267 list [file exists test.db-journal] [file exists test2.db-journal] 268 list [file exists test.db-journal] [file exists test2.db-journal]
268 } {1 1} 269 } {1 1}
269 270
270 do_test crash8-4.2 { 271 do_test crash8-4.2 {
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 do_test crash8-4.9 { 334 do_test crash8-4.9 {
334 execsql { SELECT b FROM aux.ab WHERE a = 0 } 335 execsql { SELECT b FROM aux.ab WHERE a = 0 }
335 } {def} 336 } {def}
336 337
337 do_test crash8-4.10 { 338 do_test crash8-4.10 {
338 file delete $zMasterJournal 339 file delete $zMasterJournal
339 execsql { SELECT b FROM main.ab WHERE a = 0 } 340 execsql { SELECT b FROM main.ab WHERE a = 0 }
340 } {jkl} 341 } {jkl}
341 } 342 }
342 343
344 for {set i 1} {$i < 10} {incr i} {
345 catch { db close }
346 file delete -force test.db test.db-journal
347 sqlite3 db test.db
348 do_test crash8-5.$i.1 {
349 execsql {
350 CREATE TABLE t1(x PRIMARY KEY);
351 INSERT INTO t1 VALUES(randomblob(900));
352 INSERT INTO t1 SELECT randomblob(900) FROM t1;
353 INSERT INTO t1 SELECT randomblob(900) FROM t1;
354 INSERT INTO t1 SELECT randomblob(900) FROM t1;
355 INSERT INTO t1 SELECT randomblob(900) FROM t1;
356 INSERT INTO t1 SELECT randomblob(900) FROM t1;
357 INSERT INTO t1 SELECT randomblob(900) FROM t1; /* 64 rows */
358 }
359 crashsql -file test.db -delay [expr ($::i%2) + 1] {
360 PRAGMA cache_size = 10;
361 BEGIN;
362 UPDATE t1 SET x = randomblob(900);
363 ROLLBACK;
364 INSERT INTO t1 VALUES(randomblob(900));
365 }
366 execsql { PRAGMA integrity_check }
367 } {ok}
368
369 catch { db close }
370 file delete -force test.db test.db-journal
371 sqlite3 db test.db
372 do_test crash8-5.$i.2 {
373 execsql {
374 PRAGMA cache_size = 10;
375 CREATE TABLE t1(x PRIMARY KEY);
376 INSERT INTO t1 VALUES(randomblob(900));
377 INSERT INTO t1 SELECT randomblob(900) FROM t1;
378 INSERT INTO t1 SELECT randomblob(900) FROM t1;
379 INSERT INTO t1 SELECT randomblob(900) FROM t1;
380 INSERT INTO t1 SELECT randomblob(900) FROM t1;
381 INSERT INTO t1 SELECT randomblob(900) FROM t1;
382 INSERT INTO t1 SELECT randomblob(900) FROM t1; /* 64 rows */
383 BEGIN;
384 UPDATE t1 SET x = randomblob(900);
385 }
386 file delete -force testX.db testX.db-journal testX.db-wal
387 copy_file test.db testX.db
388 copy_file test.db-journal testX.db-journal
389 db close
390
391 crashsql -file test.db -delay [expr ($::i%2) + 1] {
392 SELECT * FROM sqlite_master;
393 INSERT INTO t1 VALUES(randomblob(900));
394 }
395
396 sqlite3 db2 testX.db
397 execsql { PRAGMA integrity_check } db2
398 } {ok}
399 }
400 catch {db2 close}
401
343 finish_test 402 finish_test
OLDNEW
« no previous file with comments | « third_party/sqlite/src/test/corruptE.test ('k') | third_party/sqlite/src/test/ctime.test » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698