]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Test some extra error conditions in sqlite3_recover_snapshot().
authordan <dan@noemail.net>
Sat, 19 Nov 2016 17:30:57 +0000 (17:30 +0000)
committerdan <dan@noemail.net>
Sat, 19 Nov 2016 17:30:57 +0000 (17:30 +0000)
FossilOrigin-Name: db314213c08f27dd0ff5ede3c6a8eda36560809a

manifest
manifest.uuid
test/snapshot2.test

index c1d99f809d2d9ad6a5527520ba137f2c5d86844d..c697bbdef61b22972377d5483125fd6969387e78 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Add\sanother\sfault-injection\stest\sfor\ssqlite3_snapshot_recover().
-D 2016-11-19T17:20:28.983
+C Test\ssome\sextra\serror\sconditions\sin\ssqlite3_recover_snapshot().
+D 2016-11-19T17:30:57.131
 F Makefile.in 6b572807415d3f0a379cebc9461416d8df4a12c8
 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
 F Makefile.msc bb4d970894abbbe0e88d00aac29bd52af8bc95f4
@@ -1103,7 +1103,7 @@ F test/skipscan3.test ec5bab3f81c7038b43450e7b3062e04a198bdbb5
 F test/skipscan5.test 67817a4b6857c47e0e33ba3e506da6f23ef68de2
 F test/skipscan6.test 5866039d03a56f5bd0b3d172a012074a1d90a15b
 F test/snapshot.test 85735bd997a4f6d710140c28fd860519a299649f
-F test/snapshot2.test aeacd61be9ad4aafdab183e9137eeca87623edad
+F test/snapshot2.test 706498fdd1f03163473965faedd56b137ff7ec50
 F test/snapshot_fault.test 52c5e97ebd218846a8ae2da4d147d3e77d71f963
 F test/soak.test 0b5b6375c9f4110c828070b826b3b4b0bb65cd5f
 F test/softheap1.test 843cd84db9891b2d01b9ab64cef3e9020f98d087
@@ -1535,7 +1535,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
 F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
 F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P 525f75fa9fd4a95acc3fb3b0a01dabe2be39b383
-R 540803770026fc0e2bba54ecd3e455de
+P 7e040406138669bd67dd6ecae016b3e50dbfaaf8
+R 8677d727bb420bd9cae1a19aef039ec1
 U dan
-Z a16f9ea1f945ee0adbd8c25a4885f6d9
+Z 6dc3dd1ccc30316098a970a98f898ad5
index cb29e68423db85b819b4b208f6c81ca7b3496461..a26ea4d37dfe0d0771ddf65a45950f4e26bb2a2f 100644 (file)
@@ -1 +1 @@
-7e040406138669bd67dd6ecae016b3e50dbfaaf8
\ No newline at end of file
+db314213c08f27dd0ff5ede3c6a8eda36560809a
\ No newline at end of file
index 5c21b31005c6e22d186bfb9563b446a4ad5d76fe..b13bbe8862722802f052245cde992f24dc656126 100644 (file)
@@ -153,11 +153,51 @@ do_test 3.1 {
   db2 close
   sqlite3_snapshot_recover db main
 } {}
-breakpoint
 do_execsql_test 3.2 {
   SELECT * FROM t1;
 } {a b c d e f}
 
+#-------------------------------------------------------------------------
+# Check that sqlite3_snapshot_recover() returns an error if it is called
+# with an open read-transaction. Or on a database that does not exist. Or
+# on the temp database. Or on a db that is not in wal mode.
+#
+do_test 4.1 {
+  sqlite3_snapshot_recover db main
+} {}
+do_test 4.2 {
+  execsql {
+    BEGIN;
+      SELECT * FROM sqlite_master;
+  }
+  list [catch { sqlite3_snapshot_recover db main } msg] $msg
+} {1 SQLITE_ERROR}
+do_test 4.3 {
+  execsql COMMIT
+  sqlite3_snapshot_recover db main
+} {}
+do_test 4.4 {
+  list [catch { sqlite3_snapshot_recover db aux } msg] $msg
+} {1 SQLITE_ERROR}
+do_test 4.5 {
+  forcedelete test.db2
+  execsql {
+    ATTACH 'test.db2' AS aux;
+    PRAGMA aux.journal_mode = wal;
+    CREATE TABLE aux.t2(x, y);
+  }
+  list [catch { sqlite3_snapshot_recover db aux } msg] $msg
+} {0 {}}
+do_test 4.6 {
+  list [catch { sqlite3_snapshot_recover db temp } msg] $msg
+} {1 SQLITE_ERROR}
+do_test 4.7 {
+  execsql {
+    PRAGMA aux.journal_mode = delete;
+  }
+  list [catch { sqlite3_snapshot_recover db aux } msg] $msg
+} {1 SQLITE_ERROR}
+
 finish_test