| OLD | NEW |
| 1 # 2008 August 01 | 1 # 2008 August 01 |
| 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 # | 11 # |
| 12 # Tests for the lookaside memory allocator. | 12 # Tests for the lookaside memory allocator. |
| 13 # | 13 # |
| 14 # $Id: lookaside.test,v 1.10 2009/04/09 01:23:49 drh Exp $ | 14 # $Id: lookaside.test,v 1.10 2009/04/09 01:23:49 drh Exp $ |
| 15 | 15 |
| 16 set testdir [file dirname $argv0] | 16 set testdir [file dirname $argv0] |
| 17 source $testdir/tester.tcl | 17 source $testdir/tester.tcl |
| 18 | 18 |
| 19 ifcapable !lookaside { | 19 ifcapable !lookaside { |
| 20 finish_test | 20 finish_test |
| 21 return | 21 return |
| 22 } | 22 } |
| 23 | 23 |
| 24 # The tests in this file configure the lookaside allocator after a |
| 25 # connection is opened. This will not work if there is any "presql" |
| 26 # configured (SQL run within the [sqlite3] wrapper in tester.tcl). |
| 27 if {[info exists ::G(perm:presql)]} { |
| 28 finish_test |
| 29 return |
| 30 } |
| 31 |
| 24 catch {db close} | 32 catch {db close} |
| 25 sqlite3_shutdown | 33 sqlite3_shutdown |
| 26 sqlite3_config_pagecache 0 0 | 34 sqlite3_config_pagecache 0 0 |
| 27 sqlite3_config_scratch 0 0 | 35 sqlite3_config_scratch 0 0 |
| 28 sqlite3_initialize | 36 sqlite3_initialize |
| 29 autoinstall_test_functions | 37 autoinstall_test_functions |
| 30 sqlite3 db test.db | 38 sqlite3 db test.db |
| 31 | 39 |
| 32 # Make sure sqlite3_db_config() and sqlite3_db_status are working. | 40 # Make sure sqlite3_db_config() and sqlite3_db_status are working. |
| 33 # | 41 # |
| 34 do_test lookaside-1.1 { | 42 do_test lookaside-1.1 { |
| 35 catch {sqlite3_config_error db} | 43 catch {sqlite3_config_error db} |
| 36 } {0} | 44 } {0} |
| 45 |
| 37 do_test lookaside-1.2 { | 46 do_test lookaside-1.2 { |
| 38 sqlite3_db_config_lookaside db 1 18 18 | 47 sqlite3_db_config_lookaside db 1 18 18 |
| 39 } {0} | 48 } {0} |
| 40 do_test lookaside-1.3 { | 49 do_test lookaside-1.3 { |
| 41 sqlite3_db_status db SQLITE_DBSTATUS_LOOKASIDE_USED 0 | 50 sqlite3_db_status db SQLITE_DBSTATUS_LOOKASIDE_USED 0 |
| 42 } {0 0 0} | 51 } {0 0 0} |
| 52 |
| 43 do_test lookaside-1.4 { | 53 do_test lookaside-1.4 { |
| 44 db eval {CREATE TABLE t1(w,x,y,z);} | 54 db eval {CREATE TABLE t1(w,x,y,z);} |
| 45 foreach {x y z} [sqlite3_db_status db SQLITE_DBSTATUS_LOOKASIDE_USED 0] break | 55 foreach {x y z} [sqlite3_db_status db SQLITE_DBSTATUS_LOOKASIDE_USED 0] break |
| 46 expr {$x==0 && $y<$z && $z==18} | 56 expr {$x==0 && $y<$z && $z==18} |
| 47 } {0} | 57 } {0} |
| 48 do_test lookaside-1.5 { | 58 do_test lookaside-1.5 { |
| 49 foreach {x y z} [sqlite3_db_status db SQLITE_DBSTATUS_LOOKASIDE_USED 1] break | 59 foreach {x y z} [sqlite3_db_status db SQLITE_DBSTATUS_LOOKASIDE_USED 1] break |
| 50 expr {$x==0 && $y<$z && $z==18} | 60 expr {$x==0 && $y<$z && $z==18} |
| 51 } {0} | 61 } {0} |
| 52 do_test lookaside-1.6 { | 62 do_test lookaside-1.6 { |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 # | 111 # |
| 102 do_test lookaside-4.1 { | 112 do_test lookaside-4.1 { |
| 103 db close | 113 db close |
| 104 sqlite3_shutdown | 114 sqlite3_shutdown |
| 105 catch sqlite3_config_error | 115 catch sqlite3_config_error |
| 106 } {0} | 116 } {0} |
| 107 sqlite3_initialize | 117 sqlite3_initialize |
| 108 autoinstall_test_functions | 118 autoinstall_test_functions |
| 109 | 119 |
| 110 finish_test | 120 finish_test |
| OLD | NEW |