| OLD | NEW |
| 1 # 2008 September 15 | 1 # 2008 September 15 |
| 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 # This file is focused on testing the pcache module. | 12 # This file is focused on testing the pcache module. |
| 13 # | 13 # |
| 14 # $Id: pcache2.test,v 1.5 2009/07/18 14:36:24 danielk1977 Exp $ | 14 # $Id: pcache2.test,v 1.5 2009/07/18 14:36:24 danielk1977 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 | |
| 20 # Set up a pcache memory pool so that we can easily track how many | 19 # Set up a pcache memory pool so that we can easily track how many |
| 21 # pages are being used for cache. | 20 # pages are being used for cache. |
| 22 # | 21 # |
| 23 do_test pcache2-1.1 { | 22 do_test pcache2-1.1 { |
| 24 db close | 23 db close |
| 25 sqlite3_reset_auto_extension | 24 sqlite3_reset_auto_extension |
| 26 sqlite3_shutdown | 25 sqlite3_shutdown |
| 27 sqlite3_config_pagecache 6000 100 | 26 sqlite3_config_pagecache 6000 100 |
| 28 sqlite3_initialize | 27 sqlite3_initialize |
| 29 autoinstall_test_functions | 28 autoinstall_test_functions |
| 30 sqlite3_status SQLITE_STATUS_PAGECACHE_USED 1 | 29 sqlite3_status SQLITE_STATUS_PAGECACHE_USED 1 |
| 31 sqlite3_status SQLITE_STATUS_PAGECACHE_USED 0 | 30 sqlite3_status SQLITE_STATUS_PAGECACHE_USED 0 |
| 32 } {0 0 0} | 31 } {0 0 0} |
| 33 | 32 |
| 34 # Open up two database connections to separate files. | 33 # Open up two database connections to separate files. |
| 35 # | 34 # |
| 36 do_test pcache2-1.2 { | 35 do_test pcache2-1.2 { |
| 37 file delete -force test.db test.db-journal | 36 forcedelete test.db test.db-journal |
| 38 sqlite3 db test.db | 37 sqlite3 db test.db |
| 39 db eval {PRAGMA cache_size=10} | 38 db eval {PRAGMA cache_size=10} |
| 40 lindex [sqlite3_status SQLITE_STATUS_PAGECACHE_USED 0] 1 | 39 lindex [sqlite3_status SQLITE_STATUS_PAGECACHE_USED 0] 1 |
| 41 } {2} | 40 } {2} |
| 42 do_test pcache2-1.3 { | 41 do_test pcache2-1.3 { |
| 43 file delete -force test2.db test2.db-journal | 42 forcedelete test2.db test2.db-journal |
| 44 sqlite3 db2 test2.db | 43 sqlite3 db2 test2.db |
| 45 db2 eval {PRAGMA cache_size=50} | 44 db2 eval {PRAGMA cache_size=50} |
| 46 lindex [sqlite3_status SQLITE_STATUS_PAGECACHE_USED 0] 1 | 45 lindex [sqlite3_status SQLITE_STATUS_PAGECACHE_USED 0] 1 |
| 47 } {4} | 46 } {4} |
| 48 | 47 |
| 49 | 48 |
| 50 # Make lots of changes on the first connection. Verify that the | 49 # Make lots of changes on the first connection. Verify that the |
| 51 # page cache usage does not grow to consume the page space set aside | 50 # page cache usage does not grow to consume the page space set aside |
| 52 # for the second connection. | 51 # for the second connection. |
| 53 # | 52 # |
| (...skipping 17 matching lines...) Expand all Loading... |
| 71 | 70 |
| 72 db close | 71 db close |
| 73 catch {db2 close} | 72 catch {db2 close} |
| 74 sqlite3_reset_auto_extension | 73 sqlite3_reset_auto_extension |
| 75 sqlite3_shutdown | 74 sqlite3_shutdown |
| 76 sqlite3_config_pagecache 0 0 | 75 sqlite3_config_pagecache 0 0 |
| 77 sqlite3_initialize | 76 sqlite3_initialize |
| 78 autoinstall_test_functions | 77 autoinstall_test_functions |
| 79 | 78 |
| 80 finish_test | 79 finish_test |
| OLD | NEW |