Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Change the OOM and IO error test cases in walfault.test so that each test case runs both types of error simulation. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
b627e1536822bb7e3ef91867661a53be |
User & Date: | dan 2010-06-01 17:46:38.000 |
Context
2010-06-01
| ||
19:15 | Changes to the way faults are injected into xShmXXX VFS calls. (check-in: 716d99f392 user: dan tags: trunk) | |
17:46 | Change the OOM and IO error test cases in walfault.test so that each test case runs both types of error simulation. (check-in: b627e15368 user: dan tags: trunk) | |
15:44 | Delay the decision to restart the log file until data is actually ready to be written to the log file (instead of at the start of a write transaction). (check-in: b1abfaaf53 user: dan tags: trunk) | |
Changes
Changes to test/malloc_common.tcl.
︙ | |||
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + - + - + + - + + + + - + - - - - - + + + + + + + + + | # ifcapable builtin_test { set MEMDEBUG 1 } else { set MEMDEBUG 0 return 0 } #-------------------------------------------------------------------------- # Usage do_faultsim_test NAME ?OPTIONS...? # # -faults List of fault types to simulate. # # -prep Script to execute before -body. # # -body Script to execute (with fault injection). # # -test Script to execute after -body. # proc do_faultsim_test {name args} { set DEFAULT(-faults) [list \ oom-transient oom-persistent \ ioerr-transient ioerr-persistent \ ] set DEFAULT(-prep) "" set DEFAULT(-body) "" set DEFAULT(-test) "" array set O [array get DEFAULT] array set O $args foreach o [array names O] { if {[info exists DEFAULT($o)]==0} { error "unknown option: $o" } } set A(oom-transient) [list \ -injectstart {oom_injectstart 0} \ -injectstop oom_injectstop \ -injecterrlist {{1 {out of memory}}} \ ] set A(oom-persistent) [list \ -injectstart {oom_injectstart 1000000} \ -injectstop oom_injectstop \ -injecterrlist {{1 {out of memory}}} \ ] set A(ioerr-transient) [list \ -injectstart {ioerr_injectstart 0} \ -injectstop ioerr_injectstop \ -injecterrlist {{1 {disk I/O error}}} \ ] set A(ioerr-persistent) [list \ -injectstart {ioerr_injectstart 1} \ -injectstop ioerr_injectstop \ -injecterrlist {{1 {disk I/O error}}} \ ] foreach f $O(-faults) { if {[info exists A($f)]==0} { error "unknown fault: $f" } } set testspec [list -prep $O(-prep) -body $O(-body) -test $O(-test)] foreach f $O(-faults) { eval do_one_faultsim_test "$name-$f" $A($f) $testspec } } #------------------------------------------------------------------------- # Procedures to save and restore the current file-system state: # # faultsim_save_and_close # faultsim_restore_and_reopen # proc faultsim_save_and_close {} { foreach {a => b} { test.db => testX.db test.db-wal => testX.db-wal test.db-journal => testX.db-journal } { if {[file exists $a]} { file copy -force $a $b } else { file delete -force $b } } catch { db close } return "" } proc faultsim_restore_and_reopen {} { catch { db close } foreach {a => b} { testX.db => test.db testX.db-wal => test.db-wal testX.db-journal => test.db-journal } { if {[file exists $a]} { file copy -force $a $b } else { file delete -force $b } } sqlite3 db test.db sqlite3_extended_result_codes db 1 sqlite3_db_config_lookaside db 0 0 0 } # The following procs are used as [do_faultsim_test] when injecting OOM # faults into test cases. # proc oom_injectstart {nRepeat iFail} { sqlite3_memdebug_fail $iFail -repeat $nRepeat } proc oom_injectstop {} { sqlite3_memdebug_fail -1 } proc ioerr_injectstart {persist iFail} { set ::sqlite_io_error_persist $persist set ::sqlite_io_error_pending $iFail } proc ioerr_injectstop {} { set sv $::sqlite_io_error_hit set ::sqlite_io_error_persist 0 set ::sqlite_io_error_pending 0 set ::sqlite_io_error_hardhit 0 set ::sqlite_io_error_hit 0 set ::sqlite_io_error_pending 0 return $sv } |
︙ |
Changes to test/walfault.test.
︙ | |||
15 16 17 18 19 20 21 | 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | + + + + + + + - - + + + + + - + | set testdir [file dirname $argv0] source $testdir/tester.tcl source $testdir/malloc_common.tcl ifcapable !wal {finish_test ; return } #------------------------------------------------------------------------- # This test case, walfault-1-*, simulates faults while executing a # # PRAGMA journal_mode = WAL; # # statement immediately after creating a new database. # |
︙ | |||
45 46 47 48 49 50 51 | 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 | + + + + - + + - + - - + - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + | set jm2 [db2 one {SELECT * FROM sqlite_master ; PRAGMA main.journal_mode}] db2 close if { $jm!=$jm2 } { error "Journal modes do not match: $jm $jm2" } if { $testrc==0 && $jm!="wal" } { error "Journal mode is not WAL" } } #-------------------------------------------------------------------------- # Test case walfault-2-* tests fault injection during recovery of a # short WAL file (a dozen frames or thereabouts). # |
︙ |