Index: third_party/sqlite/src/test/crash8.test |
diff --git a/third_party/sqlite/src/test/crash8.test b/third_party/sqlite/src/test/crash8.test |
index 9e7f814e26f65540b718c645740bfab5e5e09959..6424a1abb96b7e38fb5276cb4be05451fa403f37 100644 |
--- a/third_party/sqlite/src/test/crash8.test |
+++ b/third_party/sqlite/src/test/crash8.test |
@@ -258,6 +258,7 @@ ifcapable pragma { |
INSERT INTO ab VALUES(6, NULL); |
UPDATE ab SET b = randstr(1000,1000); |
ATTACH 'test2.db' AS aux; |
+ PRAGMA aux.journal_mode = persist; |
CREATE TABLE aux.ab(a, b); |
INSERT INTO aux.ab SELECT * FROM main.ab; |
@@ -340,4 +341,62 @@ ifcapable pragma { |
} {jkl} |
} |
+for {set i 1} {$i < 10} {incr i} { |
+ catch { db close } |
+ file delete -force test.db test.db-journal |
+ sqlite3 db test.db |
+ do_test crash8-5.$i.1 { |
+ execsql { |
+ CREATE TABLE t1(x PRIMARY KEY); |
+ INSERT INTO t1 VALUES(randomblob(900)); |
+ INSERT INTO t1 SELECT randomblob(900) FROM t1; |
+ INSERT INTO t1 SELECT randomblob(900) FROM t1; |
+ INSERT INTO t1 SELECT randomblob(900) FROM t1; |
+ INSERT INTO t1 SELECT randomblob(900) FROM t1; |
+ INSERT INTO t1 SELECT randomblob(900) FROM t1; |
+ INSERT INTO t1 SELECT randomblob(900) FROM t1; /* 64 rows */ |
+ } |
+ crashsql -file test.db -delay [expr ($::i%2) + 1] { |
+ PRAGMA cache_size = 10; |
+ BEGIN; |
+ UPDATE t1 SET x = randomblob(900); |
+ ROLLBACK; |
+ INSERT INTO t1 VALUES(randomblob(900)); |
+ } |
+ execsql { PRAGMA integrity_check } |
+ } {ok} |
+ |
+ catch { db close } |
+ file delete -force test.db test.db-journal |
+ sqlite3 db test.db |
+ do_test crash8-5.$i.2 { |
+ execsql { |
+ PRAGMA cache_size = 10; |
+ CREATE TABLE t1(x PRIMARY KEY); |
+ INSERT INTO t1 VALUES(randomblob(900)); |
+ INSERT INTO t1 SELECT randomblob(900) FROM t1; |
+ INSERT INTO t1 SELECT randomblob(900) FROM t1; |
+ INSERT INTO t1 SELECT randomblob(900) FROM t1; |
+ INSERT INTO t1 SELECT randomblob(900) FROM t1; |
+ INSERT INTO t1 SELECT randomblob(900) FROM t1; |
+ INSERT INTO t1 SELECT randomblob(900) FROM t1; /* 64 rows */ |
+ BEGIN; |
+ UPDATE t1 SET x = randomblob(900); |
+ } |
+ file delete -force testX.db testX.db-journal testX.db-wal |
+ copy_file test.db testX.db |
+ copy_file test.db-journal testX.db-journal |
+ db close |
+ |
+ crashsql -file test.db -delay [expr ($::i%2) + 1] { |
+ SELECT * FROM sqlite_master; |
+ INSERT INTO t1 VALUES(randomblob(900)); |
+ } |
+ |
+ sqlite3 db2 testX.db |
+ execsql { PRAGMA integrity_check } db2 |
+ } {ok} |
+} |
+catch {db2 close} |
+ |
finish_test |