-C Fix\sa\sproblem\scausing\ssqlite3_snapshot_recover()\sto\sreturn\nSQLITE_IOERR_SHORT_READ.
-D 2016-11-19T16:35:53.322
+C Add\sanother\sfault-injection\stest\sfor\ssqlite3_snapshot_recover().
+D 2016-11-19T17:20:28.983
F Makefile.in 6b572807415d3f0a379cebc9461416d8df4a12c8
F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
F Makefile.msc bb4d970894abbbe0e88d00aac29bd52af8bc95f4
F test/skipscan6.test 5866039d03a56f5bd0b3d172a012074a1d90a15b
F test/snapshot.test 85735bd997a4f6d710140c28fd860519a299649f
F test/snapshot2.test aeacd61be9ad4aafdab183e9137eeca87623edad
-F test/snapshot_fault.test 566e8a45a2ba71c67bad2077072c85ac54e9dded
+F test/snapshot_fault.test 52c5e97ebd218846a8ae2da4d147d3e77d71f963
F test/soak.test 0b5b6375c9f4110c828070b826b3b4b0bb65cd5f
F test/softheap1.test 843cd84db9891b2d01b9ab64cef3e9020f98d087
F test/sort.test c2adc635c2564241fefec0b3a68391ef6868fd3b
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P 9abeb7980a34cec11a3420e14ad98a4ec0d9c599
-R 7b6eb1e1f049ba4c986979f464295360
+P 525f75fa9fd4a95acc3fb3b0a01dabe2be39b383
+R 540803770026fc0e2bba54ecd3e455de
U dan
-Z 9f95743e0b02ecca5491496b02c4041a
+Z a16f9ea1f945ee0adbd8c25a4885f6d9
ifcapable !snapshot {finish_test; return}
set testprefix snapshot_fault
-if 1 {
-
#-------------------------------------------------------------------------
# Check that an sqlite3_snapshot_open() client cannot be tricked into
# reading a corrupt snapshot even if a second client fails while
sqlite3_snapshot_free $::snapshot
}
-}
-
#-------------------------------------------------------------------------
# Test the handling of faults that occur within sqlite3_snapshot_recover().
#
} {wal}
faultsim_save_and_close
-do_test 4.1 {
+do_test 4.0.1 {
faultsim_restore_and_reopen
db eval { SELECT * FROM sqlite_master }
sqlite3_snapshot_recover db main
} {}
db close
-do_faultsim_test 4 -faults oom* -prep {
+do_faultsim_test 4.0 -faults oom* -prep {
faultsim_restore_and_reopen
db eval { SELECT * FROM sqlite_master }
} -body {
faultsim_test_result {0 {}} {1 SQLITE_NOMEM} {1 SQLITE_IOERR_NOMEM}
}
+# The following test cases contrive to call sqlite3_snapshot_recover()
+# before all pages of the *-shm file have been mapped. This tests an
+# extra branch of error handling logic in snapshot_recover().
+#
+reset_db
+do_execsql_test 4.1.0 {
+ PRAGMA page_size = 512;
+ PRAGMA journal_mode = wal;
+ PRAGMA wal_autocheckpoint = 0;
+ CREATE TABLE t1(zzz);
+ INSERT INTO t1 VALUES(randomblob( 500 * 9500 ));
+ PRAGMA user_version = 211;
+} {wal 0}
+
+do_test 4.1.1 {
+ list [file size test.db-shm] [file size test.db]
+} {98304 512}
+
+faultsim_save_and_close
+do_faultsim_test 4.1 -faults shm* -prep {
+ catch { db2 close }
+ catch { db close }
+ faultsim_restore_and_reopen
+ sqlite3 db2 test.db
+ db2 eval { SELECT * FROM sqlite_master }
+ db eval BEGIN
+ sqlite3_snapshot_get_blob db main
+ db eval COMMIT
+} -body {
+ sqlite3_snapshot_recover db main
+} -test {
+ faultsim_test_result {0 {}} {1 SQLITE_IOERR}
+}
+
+
finish_test