summaryrefslogtreecommitdiff
path: root/lang/sql/sqlite/test/walfault.test
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@baserock.org>2015-02-17 17:25:57 +0000
committer <>2015-03-17 16:26:24 +0000
commit780b92ada9afcf1d58085a83a0b9e6bc982203d1 (patch)
tree598f8b9fa431b228d29897e798de4ac0c1d3d970 /lang/sql/sqlite/test/walfault.test
parent7a2660ba9cc2dc03a69ddfcfd95369395cc87444 (diff)
downloadberkeleydb-master.tar.gz
Imported from /home/lorry/working-area/delta_berkeleydb/db-6.1.23.tar.gz.HEADdb-6.1.23master
Diffstat (limited to 'lang/sql/sqlite/test/walfault.test')
-rw-r--r--lang/sql/sqlite/test/walfault.test47
1 files changed, 43 insertions, 4 deletions
diff --git a/lang/sql/sqlite/test/walfault.test b/lang/sql/sqlite/test/walfault.test
index 3a90f9c6..4e7064d5 100644
--- a/lang/sql/sqlite/test/walfault.test
+++ b/lang/sql/sqlite/test/walfault.test
@@ -123,7 +123,6 @@ do_faultsim_test walfault-3 -prep {
faultsim_test_result {0 {}}
}
-
#--------------------------------------------------------------------------
#
if {[permutation] != "inmemory_journal"} {
@@ -141,7 +140,9 @@ if {[permutation] != "inmemory_journal"} {
SELECT * FROM t1;
}
} -test {
- faultsim_test_result {0 {wal 0 7 7 a b}}
+ # Update: The following changed from {0 {wal 0 7 7 a b}} as a result
+ # of PSOW being set by default.
+ faultsim_test_result {0 {wal 0 5 5 a b}}
faultsim_integrity_check
}
}
@@ -465,7 +466,7 @@ do_test walfault-13-pre-1 {
COMMIT;
}
faultsim_save_and_close
- file delete sv_test.db-shm
+ delete_file sv_test.db-shm
} {}
do_faultsim_test walfault-13.1 -prep {
@@ -542,10 +543,48 @@ do_faultsim_test walfault-14 -prep {
INSERT INTO abc VALUES(randomblob(1500));
}
} -test {
- faultsim_test_result {0 {0 10 10}}
+ faultsim_test_result {0 {0 9 9}}
faultsim_integrity_check
set nRow [db eval {SELECT count(*) FROM abc}]
if {!(($nRow==2 && $testrc) || $nRow==3)} { error "Bad db content" }
}
+#-------------------------------------------------------------------------
+# Test fault-handling when switching out of exclusive-locking mode.
+#
+do_test walfault-14-pre {
+ faultsim_delete_and_reopen
+ execsql {
+ PRAGMA auto_vacuum = 0;
+ PRAGMA journal_mode = WAL;
+ BEGIN;
+ CREATE TABLE abc(a PRIMARY KEY);
+ INSERT INTO abc VALUES(randomblob(1500));
+ INSERT INTO abc VALUES(randomblob(1500));
+ COMMIT;
+ }
+ faultsim_save_and_close
+} {}
+do_faultsim_test walfault-14 -prep {
+ faultsim_restore_and_reopen
+ execsql {
+ SELECT count(*) FROM abc;
+ PRAGMA locking_mode = exclusive;
+ BEGIN;
+ INSERT INTO abc VALUES(randomblob(1500));
+ COMMIT;
+ }
+} -body {
+ db eval {
+ PRAGMA locking_mode = normal;
+ BEGIN;
+ INSERT INTO abc VALUES(randomblob(1500));
+ COMMIT;
+ }
+} -test {
+ faultsim_integrity_check
+ set nRow [db eval {SELECT count(*) FROM abc}]
+ if {$nRow!=3 && $nRow!=4} { error "Bad db content" }
+}
+
finish_test