OLD | NEW |
1 # 2007 April 12 | 1 # 2007 April 12 |
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 # The focus of the tests in this file are to verify that the | 12 # The focus of the tests in this file are to verify that the |
13 # pager optimizations implemented in version 3.3.14 work. | 13 # pager optimizations implemented in version 3.3.14 work. |
14 # | 14 # |
15 # $Id: pageropt.test,v 1.5 2008/08/20 14:49:25 danielk1977 Exp $ | 15 # $Id: pageropt.test,v 1.5 2008/08/20 14:49:25 danielk1977 Exp $ |
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 {!pager_pragmas||secure_delete} { | 20 ifcapable {!pager_pragmas||secure_delete||direct_read} { |
21 finish_test | 21 finish_test |
22 return | 22 return |
23 } | 23 } |
24 | 24 |
25 # Run the SQL statement supplied by the argument and return | 25 # Run the SQL statement supplied by the argument and return |
26 # the results. Prepend four integers to the beginning of the | 26 # the results. Prepend four integers to the beginning of the |
27 # result which are | 27 # result which are |
28 # | 28 # |
29 # (1) The number of page reads from the database | 29 # (1) The number of page reads from the database |
30 # (2) The number of page writes to the database | 30 # (2) The number of page writes to the database |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 set blobcontent [db2 one {SELECT hex(x) FROM t1}] | 80 set blobcontent [db2 one {SELECT hex(x) FROM t1}] |
81 do_test pageropt-1.4 { | 81 do_test pageropt-1.4 { |
82 pagercount_sql { | 82 pagercount_sql { |
83 SELECT hex(x) FROM t1 | 83 SELECT hex(x) FROM t1 |
84 } | 84 } |
85 } [list 0 0 0 $blobcontent] | 85 } [list 0 0 0 $blobcontent] |
86 | 86 |
87 # But if the other thread modifies the database, then the cache | 87 # But if the other thread modifies the database, then the cache |
88 # must refill. | 88 # must refill. |
89 # | 89 # |
| 90 ifcapable mmap { |
| 91 set x [expr {[permutation]=="mmap" ? 1 : 6}] |
| 92 } else { |
| 93 set x 6 |
| 94 } |
90 do_test pageropt-1.5 { | 95 do_test pageropt-1.5 { |
91 db2 eval {CREATE TABLE t2(y)} | 96 db2 eval {CREATE TABLE t2(y)} |
92 pagercount_sql { | 97 pagercount_sql { |
93 SELECT hex(x) FROM t1 | 98 SELECT hex(x) FROM t1 |
94 } | 99 } |
95 } [list 6 0 0 $blobcontent] | 100 } [list $x 0 0 $blobcontent] |
96 do_test pageropt-1.6 { | 101 do_test pageropt-1.6 { |
97 pagercount_sql { | 102 pagercount_sql { |
98 SELECT hex(x) FROM t1 | 103 SELECT hex(x) FROM t1 |
99 } | 104 } |
100 } [list 0 0 0 $blobcontent] | 105 } [list 0 0 0 $blobcontent] |
101 | 106 |
102 # Verify that the last page of an overflow chain is not read from | 107 # Verify that the last page of an overflow chain is not read from |
103 # disk when deleting a row. The one row of t1(x) has four pages | 108 # disk when deleting a row. The one row of t1(x) has four pages |
104 # of overflow. So deleting that row from t1 should involve reading | 109 # of overflow. So deleting that row from t1 should involve reading |
105 # the sqlite_master table (1 page) the main page of t1 (1 page) and | 110 # the sqlite_master table (1 page) the main page of t1 (1 page) and |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 db close | 195 db close |
191 sqlite3 db test.db | 196 sqlite3 db test.db |
192 pagercount_sql { | 197 pagercount_sql { |
193 DELETE FROM t1 | 198 DELETE FROM t1 |
194 } | 199 } |
195 } {12 3 3} | 200 } {12 3 3} |
196 | 201 |
197 sqlite3_soft_heap_limit $cmdlinearg(soft-heap-limit) | 202 sqlite3_soft_heap_limit $cmdlinearg(soft-heap-limit) |
198 catch {db2 close} | 203 catch {db2 close} |
199 finish_test | 204 finish_test |
OLD | NEW |