| OLD | NEW |
| 1 # 2011 November 16 | 1 # 2011 November 16 |
| 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 contains fault-injection test cases for the | 12 # This file contains fault-injection test cases for the |
| 13 # sqlite3_db_cacheflush API. | 13 # sqlite3_db_cacheflush API. |
| 14 # | 14 # |
| 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 set testprefix cacheflush | 18 set testprefix cffault |
| 19 source $testdir/malloc_common.tcl | 19 source $testdir/malloc_common.tcl |
| 20 | 20 |
| 21 # Run the supplied SQL on a copy of the database currently stored on | 21 # Run the supplied SQL on a copy of the database currently stored on |
| 22 # disk in file $dbfile. | 22 # disk in file $dbfile. |
| 23 proc diskquery {dbfile sql} { | 23 proc diskquery {dbfile sql} { |
| 24 forcecopy $dbfile dq.db | 24 forcecopy $dbfile dq.db |
| 25 sqlite3 dq dq.db | 25 sqlite3 dq dq.db |
| 26 set res [execsql $sql dq] | 26 set res [execsql $sql dq] |
| 27 dq close | 27 dq close |
| 28 set res | 28 set res |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 catch { sqlite3_db_release_memory db } | 149 catch { sqlite3_db_release_memory db } |
| 150 catch { sqlite3_db_cacheflush db } | 150 catch { sqlite3_db_cacheflush db } |
| 151 execsql { SELECT a, b FROM t1 } | 151 execsql { SELECT a, b FROM t1 } |
| 152 } -test { | 152 } -test { |
| 153 faultsim_test_result {0 {1 1 3 3 5 5 7 7 9 9}} {1 {disk I/O error}} | 153 faultsim_test_result {0 {1 1 3 3 5 5 7 7 9 9}} {1 {disk I/O error}} |
| 154 catchsql ROLLBACK | 154 catchsql ROLLBACK |
| 155 faultsim_integrity_check | 155 faultsim_integrity_check |
| 156 } | 156 } |
| 157 | 157 |
| 158 finish_test | 158 finish_test |
| 159 | |
| OLD | NEW |