OLD | NEW |
1 # 2010 March 17 | 1 # 2010 March 17 |
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. The | 11 # This file implements regression tests for SQLite library. The |
12 # focus of this file is testing the operation of the library in | 12 # focus of this file is testing the operation of the library in |
13 # "PRAGMA journal_mode=WAL" mode. The tests in this file use | 13 # "PRAGMA journal_mode=WAL" mode. The tests in this file use |
14 # brute force methods, so may take a while to run. | 14 # brute force methods, so may take a while to run. |
15 # | 15 # |
16 | 16 |
17 set testdir [file dirname $argv0] | 17 set testdir [file dirname $argv0] |
18 source $testdir/tester.tcl | 18 source $testdir/tester.tcl |
19 | 19 |
20 ifcapable !wal {finish_test ; return } | 20 ifcapable !wal {finish_test ; return } |
21 | 21 |
22 proc reopen_db {} { | 22 proc reopen_db {} { |
23 catch { db close } | 23 catch { db close } |
24 file delete -force test.db test.db-wal | 24 forcedelete test.db test.db-wal |
25 sqlite3 db test.db | 25 sqlite3 db test.db |
26 execsql { PRAGMA journal_mode = wal } | 26 execsql { PRAGMA journal_mode = wal } |
27 } | 27 } |
28 | 28 |
29 db close | 29 db close |
30 save_prng_state | 30 save_prng_state |
31 for {set seed 1} {$seed<10} {incr seed} { | 31 for {set seed 1} {$seed<10} {incr seed} { |
32 expr srand($seed) | 32 expr srand($seed) |
33 restore_prng_state | 33 restore_prng_state |
34 reopen_db | 34 reopen_db |
(...skipping 11 matching lines...) Expand all Loading... |
46 execsql { INSERT INTO t1 VALUES(randomblob($w), randomblob($x)) } | 46 execsql { INSERT INTO t1 VALUES(randomblob($w), randomblob($x)) } |
47 execsql { PRAGMA integrity_check } | 47 execsql { PRAGMA integrity_check } |
48 } {ok} | 48 } {ok} |
49 | 49 |
50 do_test walslow-1.seed=$seed.$iTest.2 { | 50 do_test walslow-1.seed=$seed.$iTest.2 { |
51 execsql "PRAGMA wal_checkpoint;" | 51 execsql "PRAGMA wal_checkpoint;" |
52 execsql { PRAGMA integrity_check } | 52 execsql { PRAGMA integrity_check } |
53 } {ok} | 53 } {ok} |
54 | 54 |
55 do_test walslow-1.seed=$seed.$iTest.3 { | 55 do_test walslow-1.seed=$seed.$iTest.3 { |
56 file delete -force testX.db testX.db-wal | 56 forcedelete testX.db testX.db-wal |
57 file copy test.db testX.db | 57 copy_file test.db testX.db |
58 file copy test.db-wal testX.db-wal | 58 copy_file test.db-wal testX.db-wal |
59 | 59 |
60 sqlite3 db2 testX.db | 60 sqlite3 db2 testX.db |
61 execsql { PRAGMA journal_mode = WAL } db2 | 61 execsql { PRAGMA journal_mode = WAL } db2 |
62 execsql { PRAGMA integrity_check } db2 | 62 execsql { PRAGMA integrity_check } db2 |
63 } {ok} | 63 } {ok} |
64 | 64 |
65 do_test walslow-1.seed=$seed.$iTest.4 { | 65 do_test walslow-1.seed=$seed.$iTest.4 { |
66 execsql { SELECT count(*) FROM t1 WHERE a!=b } db2 | 66 execsql { SELECT count(*) FROM t1 WHERE a!=b } db2 |
67 } [execsql { SELECT count(*) FROM t1 WHERE a!=b }] | 67 } [execsql { SELECT count(*) FROM t1 WHERE a!=b }] |
68 db2 close | 68 db2 close |
69 } | 69 } |
70 } | 70 } |
71 | 71 |
72 | 72 |
73 finish_test | 73 finish_test |
OLD | NEW |