OLD | NEW |
1 # 2005 August 28 | 1 # 2005 August 28 |
2 # | 2 # |
3 # The author disclaims copyright to this source code. In place of | 3 # The author disclaims copyright to this source code. In place of |
4 # a legal notice, here is a blessing: | 4 # a legal notice, here is a blessing: |
5 # | 5 # |
6 # May you do good and not evil. | 6 # May you do good and not evil. |
7 # May you find forgiveness for yourself and forgive others. | 7 # May you find forgiveness for yourself and forgive others. |
8 # May you share freely, never taking more than you give. | 8 # May you share freely, never taking more than you give. |
9 # | 9 # |
10 #*********************************************************************** | 10 #*********************************************************************** |
11 # This file implements regression tests for SQLite library. | 11 # This file implements regression tests for SQLite library. |
12 # | 12 # |
13 # This file implements tests to verify that fsync is disabled when | 13 # This file implements tests to verify that fsync is disabled when |
14 # pragma synchronous=off even for multi-database commits. | 14 # pragma synchronous=off even for multi-database commits. |
15 # | 15 # |
16 # $Id: sync.test,v 1.6 2007/10/09 08:29:33 danielk1977 Exp $ | |
17 | 16 |
18 set testdir [file dirname $argv0] | 17 set testdir [file dirname $argv0] |
19 source $testdir/tester.tcl | 18 source $testdir/tester.tcl |
20 | 19 |
21 # | 20 # |
22 # These tests are only applicable when pager pragma are | 21 # These tests are only applicable when pager pragma are |
23 # enabled. Also, since every test uses an ATTACHed database, they | 22 # enabled. Also, since every test uses an ATTACHed database, they |
24 # are only run when ATTACH is enabled. | 23 # are only run when ATTACH is enabled. |
25 # | 24 # |
26 ifcapable !pager_pragmas||!attach { | 25 ifcapable !pager_pragmas||!attach { |
27 finish_test | 26 finish_test |
28 return | 27 return |
29 } | 28 } |
30 | 29 |
31 set sqlite_sync_count 0 | 30 set sqlite_sync_count 0 |
32 proc cond_incr_sync_count {adj} { | 31 proc cond_incr_sync_count {adj} { |
33 global sqlite_sync_count | 32 global sqlite_sync_count |
34 if {$::tcl_platform(platform) == "windows"} { | 33 if {$::tcl_platform(platform) == "windows"} { |
35 incr sqlite_sync_count $adj | 34 incr sqlite_sync_count $adj |
36 } { | 35 } else { |
37 ifcapable !dirsync { | 36 ifcapable !dirsync { |
38 incr sqlite_sync_count $adj | 37 incr sqlite_sync_count $adj |
39 } | 38 } |
40 } | 39 } |
41 } | 40 } |
42 | 41 |
43 do_test sync-1.1 { | 42 do_test sync-1.1 { |
44 set sqlite_sync_count 0 | 43 set sqlite_sync_count 0 |
45 forcedelete test2.db | 44 forcedelete test2.db |
46 forcedelete test2.db-journal | 45 forcedelete test2.db-journal |
(...skipping 10 matching lines...) Expand all Loading... |
57 do_test sync-1.2 { | 56 do_test sync-1.2 { |
58 set sqlite_sync_count 0 | 57 set sqlite_sync_count 0 |
59 execsql { | 58 execsql { |
60 PRAGMA main.synchronous=on; | 59 PRAGMA main.synchronous=on; |
61 PRAGMA db2.synchronous=on; | 60 PRAGMA db2.synchronous=on; |
62 BEGIN; | 61 BEGIN; |
63 INSERT INTO t1 VALUES(1,2); | 62 INSERT INTO t1 VALUES(1,2); |
64 INSERT INTO t2 VALUES(3,4); | 63 INSERT INTO t2 VALUES(3,4); |
65 COMMIT; | 64 COMMIT; |
66 } | 65 } |
67 cond_incr_sync_count 3 | 66 cond_incr_sync_count 4 |
68 set sqlite_sync_count | 67 set sqlite_sync_count |
69 } 8 | 68 } 9 |
70 } | 69 } |
71 do_test sync-1.3 { | 70 do_test sync-1.3 { |
72 set sqlite_sync_count 0 | 71 set sqlite_sync_count 0 |
73 execsql { | 72 execsql { |
74 PRAGMA main.synchronous=full; | 73 PRAGMA main.synchronous=full; |
75 PRAGMA db2.synchronous=full; | 74 PRAGMA db2.synchronous=full; |
76 BEGIN; | 75 BEGIN; |
77 INSERT INTO t1 VALUES(3,4); | 76 INSERT INTO t1 VALUES(3,4); |
78 INSERT INTO t2 VALUES(5,6); | 77 INSERT INTO t2 VALUES(5,6); |
79 COMMIT; | 78 COMMIT; |
80 } | 79 } |
81 cond_incr_sync_count 3 | 80 cond_incr_sync_count 4 |
82 set sqlite_sync_count | 81 set sqlite_sync_count |
83 } 10 | 82 } 11 |
84 ifcapable pager_pragmas { | 83 ifcapable pager_pragmas { |
| 84 if {[permutation]!="journaltest"} { |
85 do_test sync-1.4 { | 85 do_test sync-1.4 { |
86 set sqlite_sync_count 0 | 86 set sqlite_sync_count 0 |
87 execsql { | 87 execsql { |
88 PRAGMA main.synchronous=off; | 88 PRAGMA main.synchronous=off; |
89 PRAGMA db2.synchronous=off; | 89 PRAGMA db2.synchronous=off; |
90 BEGIN; | 90 BEGIN; |
91 INSERT INTO t1 VALUES(5,6); | 91 INSERT INTO t1 VALUES(5,6); |
92 INSERT INTO t2 VALUES(7,8); | 92 INSERT INTO t2 VALUES(7,8); |
93 COMMIT; | 93 COMMIT; |
94 } | 94 } |
95 set sqlite_sync_count | 95 set sqlite_sync_count |
96 } 0 | 96 } 0 |
97 } | 97 } |
| 98 } |
98 | 99 |
99 | 100 |
100 finish_test | 101 finish_test |
OLD | NEW |