]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Add tests for WAL mode to test/backcompat.test.
authordan <dan@noemail.net>
Thu, 19 Aug 2010 15:48:47 +0000 (15:48 +0000)
committerdan <dan@noemail.net>
Thu, 19 Aug 2010 15:48:47 +0000 (15:48 +0000)
FossilOrigin-Name: 7999910e85b1f24c5860425ba47e7ab10c22e887

manifest
manifest.uuid
test/backcompat.test

index fc7ea54348eb2028c5062e7f719fd43cee11ab42..a265e5437e16e5aad87e561b9ac4446bb4f1e613 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Merge\stwo\sleaves.
-D 2010-08-19T15:12:55
+C Add\stests\sfor\sWAL\smode\sto\stest/backcompat.test.
+D 2010-08-19T15:48:47
 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
 F Makefile.in 543f91f24cd7fee774ecc0a61c19704c0c3e78fd
 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -259,7 +259,7 @@ F test/autoindex1.test 7df441bf0e7a88644eb80993339dbf1db3a12c68
 F test/autovacuum.test bb7c0885e6f8f1d633045de48f2b66082162766d
 F test/autovacuum_ioerr2.test 598b0663074d3673a9c1bc9a16e80971313bafe6
 F test/avtrans.test 0252654f4295ddda3b2cce0e894812259e655a85
-F test/backcompat.test a64138b3f00bcb6af91fb609e805b03a7d74e690
+F test/backcompat.test f09684c48e5e467b4fd9e733e5867e23f957ecf2
 F test/backup.test 200e64bd91244b73ca8094bc1e03dfc83cc94c2e
 F test/backup2.test b7c69f937c912e85ac8a5dbd1e1cf290302b2d49
 F test/backup_ioerr.test 1f012e692f42c0442ae652443258f70e9f20fa38
@@ -845,7 +845,7 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
 F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
-P b9170f2903c480bca2bdc986e98aaeadfdb9ad2b 4c7ad73d22b7e8c90955730c2dbb79ed53cd750b
-R 26a0e08eb568545db964da4fcb9b01de
+P b03091fc3592896fcf1ec563ae9682a8e0a05baa
+R 52a8e7fbae7866867598a61fe83f6054
 U dan
-Z 9d459a63353ebad2047baf5fad1d4c83
+Z b9ee7c10dc1f3cce4f3c954e7b1d3a07
index 923cfcff003c83542c10f34e156623c13ec853c0..d221a9c940a87a54005c2e79f3fd954275db420e 100644 (file)
@@ -1 +1 @@
-b03091fc3592896fcf1ec563ae9682a8e0a05baa
\ No newline at end of file
+7999910e85b1f24c5860425ba47e7ab10c22e887
\ No newline at end of file
index 5c9a020ab311a8e45d20ae899bfbbeba36cd817c..469aeb6c7bb241f393e3d189285552cffdae98ba 100644 (file)
@@ -91,7 +91,9 @@ proc do_allbackcompat_test {script} {
     set nErr [set_test_counter errors]
     foreach dir {0 1} {
 
-      set ::bcname ".[string map {testfixture {}} $bin].$dir."
+      set bintag [string map {testfixture {}} $bin]
+      if {$bintag == ""} {set bintag self}
+      set ::bcname ".$bintag.$dir."
 
       rename do_test _do_test
       proc do_test {nm sql res} {
@@ -144,6 +146,10 @@ proc write_file_system {data} {
 #-------------------------------------------------------------------------
 # Actual tests begin here.
 #
+# This first block of tests checks to see that the same database and 
+# journal files can be used by old and new versions. WAL and wal-index
+# files are tested separately below.
+#
 do_allbackcompat_test {
 
   # Test that database files are backwards compatible.
@@ -206,9 +212,50 @@ do_allbackcompat_test {
   do_test backcompat-1.2.7 { sql1 { PRAGMA integrity_check } } {ok}
   do_test backcompat-1.2.8 { sql2 { PRAGMA integrity_check } } {ok}
 }
-
 foreach k [lsort [array names ::incompatible]] {
-  puts "ERROR: Detected incompatibility with version $k"
+  puts "ERROR: Detected journal incompatibility with version $k"
+}
+unset ::incompatible
+
+
+#-------------------------------------------------------------------------
+# Test that WAL and wal-index files may be shared between different 
+# SQLite versions.
+#
+do_allbackcompat_test {
+  if {[code1 {sqlite3 -version}] >= "3.7.0"
+   && [code2 {sqlite3 -version}] >= "3.7.0"
+  } {
+
+    do_test backcompat-2.1.1 { sql1 {
+      PRAGMA journal_mode = WAL;
+      CREATE TABLE t1(a PRIMARY KEY, b UNIQUE);
+      INSERT INTO t1 VALUES('I', 1);
+      INSERT INTO t1 VALUES('II', 2);
+      INSERT INTO t1 VALUES('III', 3);
+      SELECT * FROM t1;
+    } } {wal I 1 II 2 III 3}
+    do_test backcompat-2.1.2 { sql2 {
+      SELECT * FROM t1;
+    } } {I 1 II 2 III 3}
+
+    set data [read_file_system]
+    code1 {db close}
+    code2 {db close}
+    write_file_system $data
+    code1 {sqlite3 db test.db}
+    code2 {sqlite3 db test.db}
+
+    # The WAL file now in the file-system was created by the [code1]
+    # process. Check that the [code2] process can recover the log.
+    #
+    do_test backcompat-2.1.3 { sql2 {
+      SELECT * FROM t1;
+    } } {I 1 II 2 III 3}
+    do_test backcompat-2.1.4 { sql1 {
+      SELECT * FROM t1;
+    } } {I 1 II 2 III 3}
+  }
 }
 
 finish_test