diff options
Diffstat (limited to 'libraries/sqlite/unix/sqlite-3.5.1/test/sync.test')
-rw-r--r-- | libraries/sqlite/unix/sqlite-3.5.1/test/sync.test | 97 |
1 files changed, 97 insertions, 0 deletions
diff --git a/libraries/sqlite/unix/sqlite-3.5.1/test/sync.test b/libraries/sqlite/unix/sqlite-3.5.1/test/sync.test new file mode 100644 index 0000000..88a1b7d --- /dev/null +++ b/libraries/sqlite/unix/sqlite-3.5.1/test/sync.test | |||
@@ -0,0 +1,97 @@ | |||
1 | # 2005 August 28 | ||
2 | # | ||
3 | # The author disclaims copyright to this source code. In place of | ||
4 | # a legal notice, here is a blessing: | ||
5 | # | ||
6 | # May you do good and not evil. | ||
7 | # May you find forgiveness for yourself and forgive others. | ||
8 | # May you share freely, never taking more than you give. | ||
9 | # | ||
10 | #*********************************************************************** | ||
11 | # This file implements regression tests for SQLite library. | ||
12 | # | ||
13 | # This file implements tests to verify that fsync is disabled when | ||
14 | # pragma synchronous=off even for multi-database commits. | ||
15 | # | ||
16 | # $Id: sync.test,v 1.5 2006/02/11 01:25:51 drh Exp $ | ||
17 | |||
18 | set testdir [file dirname $argv0] | ||
19 | source $testdir/tester.tcl | ||
20 | |||
21 | # | ||
22 | # These tests are only applicable on unix when pager pragma are | ||
23 | # enabled. | ||
24 | # | ||
25 | if {$::tcl_platform(platform)!="unix"} { | ||
26 | finish_test | ||
27 | return | ||
28 | } | ||
29 | ifcapable !pager_pragmas { | ||
30 | finish_test | ||
31 | return | ||
32 | } | ||
33 | |||
34 | do_test sync-1.1 { | ||
35 | set sqlite_sync_count 0 | ||
36 | file delete -force test2.db | ||
37 | file delete -force test2.db-journal | ||
38 | execsql { | ||
39 | PRAGMA fullfsync=OFF; | ||
40 | CREATE TABLE t1(a,b); | ||
41 | ATTACH DATABASE 'test2.db' AS db2; | ||
42 | CREATE TABLE db2.t2(x,y); | ||
43 | } | ||
44 | ifcapable !dirsync { | ||
45 | incr sqlite_sync_count 2 | ||
46 | } | ||
47 | set sqlite_sync_count | ||
48 | } 8 | ||
49 | ifcapable pager_pragmas { | ||
50 | do_test sync-1.2 { | ||
51 | set sqlite_sync_count 0 | ||
52 | execsql { | ||
53 | PRAGMA main.synchronous=on; | ||
54 | PRAGMA db2.synchronous=on; | ||
55 | BEGIN; | ||
56 | INSERT INTO t1 VALUES(1,2); | ||
57 | INSERT INTO t2 VALUES(3,4); | ||
58 | COMMIT; | ||
59 | } | ||
60 | ifcapable !dirsync { | ||
61 | incr sqlite_sync_count 3 | ||
62 | } | ||
63 | set sqlite_sync_count | ||
64 | } 8 | ||
65 | } | ||
66 | do_test sync-1.3 { | ||
67 | set sqlite_sync_count 0 | ||
68 | execsql { | ||
69 | PRAGMA main.synchronous=full; | ||
70 | PRAGMA db2.synchronous=full; | ||
71 | BEGIN; | ||
72 | INSERT INTO t1 VALUES(3,4); | ||
73 | INSERT INTO t2 VALUES(5,6); | ||
74 | COMMIT; | ||
75 | } | ||
76 | ifcapable !dirsync { | ||
77 | incr sqlite_sync_count 3 | ||
78 | } | ||
79 | set sqlite_sync_count | ||
80 | } 10 | ||
81 | ifcapable pager_pragmas { | ||
82 | do_test sync-1.4 { | ||
83 | set sqlite_sync_count 0 | ||
84 | execsql { | ||
85 | PRAGMA main.synchronous=off; | ||
86 | PRAGMA db2.synchronous=off; | ||
87 | BEGIN; | ||
88 | INSERT INTO t1 VALUES(5,6); | ||
89 | INSERT INTO t2 VALUES(7,8); | ||
90 | COMMIT; | ||
91 | } | ||
92 | set sqlite_sync_count | ||
93 | } 0 | ||
94 | } | ||
95 | |||
96 | |||
97 | finish_test | ||