Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(28)

Side by Side Diff: third_party/sqlite/src/test/malloc_common.tcl

Issue 1610963002: Import SQLite 3.10.2. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/sqlite/src/test/mallocK.test ('k') | third_party/sqlite/src/test/memdb.test » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # 2007 May 05 1 # 2007 May 05
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 #***********************************************************************
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 global FAULTSIM 122 global FAULTSIM
123 123
124 foreach n [array names FAULTSIM] { 124 foreach n [array names FAULTSIM] {
125 if {$n != "interrupt"} {lappend DEFAULT(-faults) $n} 125 if {$n != "interrupt"} {lappend DEFAULT(-faults) $n}
126 } 126 }
127 set DEFAULT(-prep) "" 127 set DEFAULT(-prep) ""
128 set DEFAULT(-body) "" 128 set DEFAULT(-body) ""
129 set DEFAULT(-test) "" 129 set DEFAULT(-test) ""
130 set DEFAULT(-install) "" 130 set DEFAULT(-install) ""
131 set DEFAULT(-uninstall) "" 131 set DEFAULT(-uninstall) ""
132 set DEFAULT(-start) 1
133 set DEFAULT(-end) 0
132 134
133 fix_testname name 135 fix_testname name
134 136
135 array set O [array get DEFAULT] 137 array set O [array get DEFAULT]
136 array set O $args 138 array set O $args
137 foreach o [array names O] { 139 foreach o [array names O] {
138 if {[info exists DEFAULT($o)]==0} { error "unknown option: $o" } 140 if {[info exists DEFAULT($o)]==0} { error "unknown option: $o" }
139 } 141 }
140 142
141 set faultlist [list] 143 set faultlist [list]
142 foreach f $O(-faults) { 144 foreach f $O(-faults) {
143 set flist [array names FAULTSIM $f] 145 set flist [array names FAULTSIM $f]
144 if {[llength $flist]==0} { error "unknown fault: $f" } 146 if {[llength $flist]==0} { error "unknown fault: $f" }
145 set faultlist [concat $faultlist $flist] 147 set faultlist [concat $faultlist $flist]
146 } 148 }
147 149
148 set testspec [list -prep $O(-prep) -body $O(-body) \ 150 set testspec [list -prep $O(-prep) -body $O(-body) \
149 -test $O(-test) -install $O(-install) -uninstall $O(-uninstall) 151 -test $O(-test) -install $O(-install) -uninstall $O(-uninstall) \
152 -start $O(-start) -end $O(-end)
150 ] 153 ]
151 foreach f [lsort -unique $faultlist] { 154 foreach f [lsort -unique $faultlist] {
152 eval do_one_faultsim_test "$name-$f" $FAULTSIM($f) $testspec 155 eval do_one_faultsim_test "$name-$f" $FAULTSIM($f) $testspec
153 } 156 }
154 } 157 }
155 158
156 159
157 #------------------------------------------------------------------------- 160 #-------------------------------------------------------------------------
158 # Procedures to save and restore the current file-system state: 161 # Procedures to save and restore the current file-system state:
159 # 162 #
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 } 285 }
283 286
284 # This command is not called directly. It is used by the 287 # This command is not called directly. It is used by the
285 # [faultsim_test_result] command created by [do_faultsim_test] and used 288 # [faultsim_test_result] command created by [do_faultsim_test] and used
286 # by -test scripts. 289 # by -test scripts.
287 # 290 #
288 proc faultsim_test_result_int {args} { 291 proc faultsim_test_result_int {args} {
289 upvar testrc testrc testresult testresult testnfail testnfail 292 upvar testrc testrc testresult testresult testnfail testnfail
290 set t [list $testrc $testresult] 293 set t [list $testrc $testresult]
291 set r $args 294 set r $args
292 if { ($testnfail==0 && $t != [lindex $r 0]) || [lsearch $r $t]<0 } { 295 if { ($testnfail==0 && $t != [lindex $r 0]) || [lsearch -exact $r $t]<0 } {
293 error "nfail=$testnfail rc=$testrc result=$testresult list=$r" 296 error "nfail=$testnfail rc=$testrc result=$testresult list=$r"
294 } 297 }
295 } 298 }
296 299
297 #-------------------------------------------------------------------------- 300 #--------------------------------------------------------------------------
298 # Usage do_one_faultsim_test NAME ?OPTIONS...? 301 # Usage do_one_faultsim_test NAME ?OPTIONS...?
299 # 302 #
300 # The first argument, <test number>, is used as a prefix of the test names 303 # The first argument, <test number>, is used as a prefix of the test names
301 # taken by tests executed by this command. Options are as follows. All 304 # taken by tests executed by this command. Options are as follows. All
302 # options take a single argument. 305 # options take a single argument.
303 # 306 #
304 # -injectstart Script to enable fault-injection. 307 # -injectstart Script to enable fault-injection.
305 # 308 #
306 # -injectstop Script to disable fault-injection. 309 # -injectstop Script to disable fault-injection.
307 # 310 #
308 # -injecterrlist List of generally acceptable test results (i.e. error 311 # -injecterrlist List of generally acceptable test results (i.e. error
309 # messages). Example: [list {1 {out of memory}}] 312 # messages). Example: [list {1 {out of memory}}]
310 # 313 #
311 # -injectinstall 314 # -injectinstall
312 # 315 #
313 # -injectuninstall 316 # -injectuninstall
314 # 317 #
315 # -prep Script to execute before -body. 318 # -prep Script to execute before -body.
316 # 319 #
317 # -body Script to execute (with fault injection). 320 # -body Script to execute (with fault injection).
318 # 321 #
319 # -test Script to execute after -body. 322 # -test Script to execute after -body.
320 # 323 #
324 # -start Index of first fault to inject (default 1)
325 #
321 proc do_one_faultsim_test {testname args} { 326 proc do_one_faultsim_test {testname args} {
322 327
323 set DEFAULT(-injectstart) "expr" 328 set DEFAULT(-injectstart) "expr"
324 set DEFAULT(-injectstop) "expr 0" 329 set DEFAULT(-injectstop) "expr 0"
325 set DEFAULT(-injecterrlist) [list] 330 set DEFAULT(-injecterrlist) [list]
326 set DEFAULT(-injectinstall) "" 331 set DEFAULT(-injectinstall) ""
327 set DEFAULT(-injectuninstall) "" 332 set DEFAULT(-injectuninstall) ""
328 set DEFAULT(-prep) "" 333 set DEFAULT(-prep) ""
329 set DEFAULT(-body) "" 334 set DEFAULT(-body) ""
330 set DEFAULT(-test) "" 335 set DEFAULT(-test) ""
331 set DEFAULT(-install) "" 336 set DEFAULT(-install) ""
332 set DEFAULT(-uninstall) "" 337 set DEFAULT(-uninstall) ""
338 set DEFAULT(-start) 1
339 set DEFAULT(-end) 0
333 340
334 array set O [array get DEFAULT] 341 array set O [array get DEFAULT]
335 array set O $args 342 array set O $args
336 foreach o [array names O] { 343 foreach o [array names O] {
337 if {[info exists DEFAULT($o)]==0} { error "unknown option: $o" } 344 if {[info exists DEFAULT($o)]==0} { error "unknown option: $o" }
338 } 345 }
339 346
340 proc faultsim_test_proc {testrc testresult testnfail} $O(-test) 347 proc faultsim_test_proc {testrc testresult testnfail} $O(-test)
341 proc faultsim_test_result {args} " 348 proc faultsim_test_result {args} "
342 uplevel faultsim_test_result_int \$args [list $O(-injecterrlist)] 349 uplevel faultsim_test_result_int \$args [list $O(-injecterrlist)]
343 " 350 "
344 351
345 eval $O(-injectinstall) 352 eval $O(-injectinstall)
346 eval $O(-install) 353 eval $O(-install)
347 354
348 set stop 0 355 set stop 0
349 for {set iFail 1} {!$stop} {incr iFail} { 356 for {set iFail $O(-start)} \
357 {!$stop && ($O(-end)==0 || $iFail<=$O(-end))} \
358 {incr iFail} \
359 {
350 360
351 # Evaluate the -prep script. 361 # Evaluate the -prep script.
352 # 362 #
353 eval $O(-prep) 363 eval $O(-prep)
354 364
355 # Start the fault-injection. Run the -body script. Stop the fault 365 # Start the fault-injection. Run the -body script. Stop the fault
356 # injection. Local var $nfail is set to the total number of faults 366 # injection. Local var $nfail is set to the total number of faults
357 # injected into the system this trial. 367 # injected into the system this trial.
358 # 368 #
359 eval $O(-injectstart) $iFail 369 eval $O(-injectstart) $iFail
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
678 if {[lsearch $answers $res]>=0} { 688 if {[lsearch $answers $res]>=0} {
679 set res $str 689 set res $str
680 } 690 }
681 do_test $name.$zName.$iFail [list set {} $res] $str 691 do_test $name.$zName.$iFail [list set {} $res] $str
682 set cksum2 [db one $cksumsql] 692 set cksum2 [db one $cksumsql]
683 if {$cksum1 != $cksum2} return 693 if {$cksum1 != $cksum2} return
684 } 694 }
685 } 695 }
686 } 696 }
687 } 697 }
OLDNEW
« no previous file with comments | « third_party/sqlite/src/test/mallocK.test ('k') | third_party/sqlite/src/test/memdb.test » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698