From 569c6676a6ddb0ff73821d7693b5e18ddef809b9 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Thu, 16 Oct 2014 22:51:35 -0400 Subject: Imported Upstream version 3.2.0 --- test/malloc_common.tcl | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) (limited to 'test/malloc_common.tcl') diff --git a/test/malloc_common.tcl b/test/malloc_common.tcl index 2ac619b..b586c88 100644 --- a/test/malloc_common.tcl +++ b/test/malloc_common.tcl @@ -93,6 +93,14 @@ set FAULTSIM(cantopen-persistent) [list \ -injectuninstall cantopen_injectuninstall \ ] +set FAULTSIM(interrupt) [list \ + -injectinstall interrupt_injectinstall \ + -injectstart interrupt_injectstart \ + -injectstop interrupt_injectstop \ + -injecterrlist {{1 interrupted} {1 interrupt}} \ + -injectuninstall interrupt_injectuninstall \ +] + #-------------------------------------------------------------------------- @@ -113,7 +121,9 @@ set FAULTSIM(cantopen-persistent) [list \ proc do_faultsim_test {name args} { global FAULTSIM - set DEFAULT(-faults) [array names FAULTSIM] + foreach n [array names FAULTSIM] { + if {$n != "interrupt"} {lappend DEFAULT(-faults) $n} + } set DEFAULT(-prep) "" set DEFAULT(-body) "" set DEFAULT(-test) "" @@ -255,6 +265,22 @@ proc cantopen_injectstop {} { shmfault cantopen } +# The following procs are used as [do_one_faultsim_test] callbacks +# when injecting SQLITE_INTERRUPT error faults into test cases. +# +proc interrupt_injectinstall {} { +} +proc interrupt_injectuninstall {} { +} +proc interrupt_injectstart {iFail} { + set ::sqlite_interrupt_count $iFail +} +proc interrupt_injectstop {} { + set res [expr $::sqlite_interrupt_count<=0] + set ::sqlite_interrupt_count 0 + set res +} + # This command is not called directly. It is used by the # [faultsim_test_result] command created by [do_faultsim_test] and used # by -test scripts. @@ -383,6 +409,7 @@ proc do_malloc_test {tn args} { if {[string is integer $tn]} { set tn malloc-$tn + catch { set tn $::testprefix-$tn } } if {[info exists ::mallocopts(-start)]} { set start $::mallocopts(-start) -- cgit v1.2.3