]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Add tests to pager1.test.
authordan <dan@noemail.net>
Fri, 18 Jun 2010 18:59:49 +0000 (18:59 +0000)
committerdan <dan@noemail.net>
Fri, 18 Jun 2010 18:59:49 +0000 (18:59 +0000)
FossilOrigin-Name: 582fca89195af54e9668af249691654cfea63d04

manifest
manifest.uuid
test/pager1.test

index a2cd06dea2e763e18250b63ca52261bf238be381..5be23c9020d030e259d67a7929ddef3e6f65073e 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Rearrange\ssome\scode\sin\sOP_JournalMode\sto\savoid\sincorrect\sreturns\sfrom\ssubsequent\sinvocations\sof\s"PRAGMA\sjournal_mode"\sfollowing\san\sIO\serror.
-D 2010-06-18T16:13:45
+C Add\stests\sto\spager1.test.
+D 2010-06-18T18:59:49
 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
 F Makefile.in a5cad1f8f3e021356bfcc6c77dc16f6f1952bbc3
 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@@ -534,7 +534,7 @@ F test/notify2.test 195a467e021f74197be2c4fb02d6dee644b8d8db
 F test/notnull.test cc7c78340328e6112a13c3e311a9ab3127114347
 F test/null.test a8b09b8ed87852742343b33441a9240022108993
 F test/openv2.test af02ed0a9cbc0d2a61b8f35171d4d117e588e4ec
-F test/pager1.test 60dec408563461f9fbf04d4d301b1b4db23f7525
+F test/pager1.test f2806eeba269efbe0132302b789f9fb4abf62264
 F test/pagerfault.test 16e560bc4332d5b089b369d82ae4b65b8805b5eb
 F test/pageropt.test 8146bf448cf09e87bb1867c2217b921fb5857806
 F test/pagesize.test 76aa9f23ecb0741a4ed9d2e16c5fa82671f28efb
@@ -824,7 +824,7 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
 F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
-P 077b0e5bcd849130c8df373fc2134c4b44351882
-R 54f97d60c6d719c202a2c47c8f5392d5
+P ce0a4a9b5f981d066822a9ae63740c91b35bfc60
+R 43f6c397d741ef10ef5d1aeb6e2ade8c
 U dan
-Z fff7f7ea627d7c4a7f85eb236bd967cc
+Z 6cf151c823519ced3c5ca7c23ec3a1bb
index 9fc7060ef54e971c5523a2b8817804f88ddf1185..e5f96cb16dbbd0b81032413aac82da6c94e4a855 100644 (file)
@@ -1 +1 @@
-ce0a4a9b5f981d066822a9ae63740c91b35bfc60
\ No newline at end of file
+582fca89195af54e9668af249691654cfea63d04
\ No newline at end of file
index d0caaa9d41abcdc8385377f46dbab942f58a3f4f..c1a2a5ff27fd098576c32c70664e70945cae5502 100644 (file)
@@ -22,6 +22,8 @@ source $testdir/malloc_common.tcl
 #
 # pager1-3.*: Savepoint related tests.
 #
+# pager1-4.*: Hot-journal related tests.
+#
 
 proc do_execsql_test {testname sql result} {
   uplevel do_test $testname [list "execsql {$sql}"] [list $result]
@@ -210,6 +212,99 @@ do_execsql_test pager1-3.4 { SELECT * FROM counter } {3 0}
 do_execsql_test pager1-3.5 { SELECT a FROM t1 } {1 2 3}
 do_execsql_test pager1-3.6 { COMMIT } {}
 
+testvfs tv -default 1
+foreach code [list {
+  set s 512
+  set sql { PRAGMA synchronous = off }
+} {
+  set s 1024
+  set sql { PRAGMA journal_mode = memory }
+} {
+  set s 2048
+  tv devchar safe_append
+} {
+  set s 4096
+  set sql { PRAGMA journal_mode = WAL }
+}] {
+  eval $code
+  tv sectorsize $s
+  
+  do_test pager1-3.7.$s.1 {
+    faultsim_delete_and_reopen
+    execsql $sql
+    execsql {
+      PRAGMA cache_size = 10;
+      CREATE TABLE t1(i INTEGER PRIMARY KEY, j blob);
+    }
+  } {}
+
+  set tn 0
+  set lowpoint 0
+  foreach x {
+    70 22 96 59 96 50 22 56 21 16 37 64 43 40  0 38 22 38 55  0  6   
+    43 62 32 93 54 18 13 29 45 66 29 25 61 31 53 82 75 25 96 86 10 69   
+     2 29  6 60 80 95 42 82 85 50 68 96 90 39 78 69 87 97 48 74 65 43   
+  x
+    86 34 26 50 41 85 58 44 89 22  6 51 45 46 58 32 97  6  1 12 32  2   
+    69 39 48 71 33 31  5 58 90 43 24 54 12  9 18 57  4 38 91 42 27 45   
+    50 38 56 29 10  0 26 37 83  1 78 15 47 30 75 62 46 29 68  5 30  4   
+    27 96 33 95 79 75 56 10 29 70 32 75 52 88  5 36 50 57 46 63 88 65   
+  x
+    44 95 64 20 24 35 69 61 61  2 35 92 42 46 23 98 78  1 38 72 79 35   
+    94 37 13 59  5 93 27 58 80 75 58  7 67 13 10 76 84  4  8 70 81 45   
+     8 41 98  5 60 26 92 29 91 90  2 62 40  4  5 22 80 15 83 76 52 88   
+    29  5 68 73 72  7 54 17 89 32 81 94 51 28 53 71  8 42 54 59 70 79   
+  x
+    35 59 37 22  8 72 10 48 79  6 87 96 59 95 45 56  6  4 86 68 25 28   
+    43 75 47  9 53 18 69 51 11 94 86 65 23 87 49 19 20 20 33 14 11 86   
+    42 23  8 40 94 55  4 38 52 30  6 25 44 79 57 82 30 87 86 75 40 92   
+    29 26 82 91 67 64 15 51 17 11 15 27 32  7 38  1 52 82 26 99 17 18   
+    38 13 20 65 91 98 50 81 49 15 94 45 84 35 31 67 13 43 78  3 94 77   
+    47 18 96 66 99 77 11 11 70 18  1 29 79 57 59 86 94 34 91 15 24 53   
+    61 73 58 46 36 79 90 89 12  0 91  0 86 44 71 83 75 76 97 65 13 80   
+    42 39 15 44 90 18 67 69  1 72 17 99 12 72 77 17  3 34 75 59 92 76   
+    18 86 60 12 20 98 48 14 12 67 45 44 10  2  5 88  7 45  5 47 45 75   
+    19 25 42 62 66 17 94 63  0 53 38 81 26 11 97 33 13 36 81 82 73 26   
+    78 90 28 78 26 61  9 74 70 53 17 86 51 90  3 30 99  5 25 44  6 72   
+    84 32 74 46 16 44 74 82 84  9 58 90 85 82 53 40 37 
+  } {
+    incr tn
+    set now [db one {SELECT count(i) FROM t1}]
+    if {$x == "x"} {
+      execsql { COMMIT ; BEGIN }
+      set lowpoint $now
+      do_test pager1.3.7.$s.2.$tn { 
+        sqlite3 db2 test.db
+        execsql {
+          SELECT COALESCE(max(i), 0) FROM t1;
+          PRAGMA integrity_check;
+        } 
+      } [list $lowpoint ok]
+      db2 close
+    } else {
+      if {$now > $x } {
+        if { $x>=$lowpoint } {
+          execsql "ROLLBACK TO sp_$x"
+        } else {
+          execsql "DELETE FROM t1 WHERE i>$x"
+          set lowpoint $x
+        }
+      } elseif {$now < $x} {
+        for {set k $now} {$k < $x} {incr k} {
+          execsql "SAVEPOINT sp_$k"
+          execsql { INSERT INTO t1(j) VALUES(randomblob(1500)) }
+        }
+      }
+      do_execsql_test pager1.3.7.$s.2.$tn { 
+        SELECT COALESCE(max(i), 0) FROM t1;
+        PRAGMA integrity_check;
+      } [list $x ok]
+    }
+  }
+}
+db close
+tv delete
+
 #-------------------------------------------------------------------------
 # Hot journal rollback related test cases.
 #