diff options
Diffstat (limited to 'test/malloc3.test')
-rw-r--r-- | test/malloc3.test | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/test/malloc3.test b/test/malloc3.test index a3d4ddf8a..d96519d59 100644 --- a/test/malloc3.test +++ b/test/malloc3.test @@ -13,13 +13,14 @@ # correctly. The emphasis of these tests are the _prepare(), _step() and # _finalize() calls. # -# $Id: malloc3.test,v 1.10 2007/03/28 01:59:34 drh Exp $ +# $Id: malloc3.test,v 1.11 2007/08/22 22:04:37 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # Only run these tests if memory debugging is turned on. -if {[info command sqlite_malloc_stat]==""} { +# +ifcapable !memdebug { puts "Skipping malloc tests: not compiled with -DSQLITE_MEMDEBUG..." finish_test return @@ -559,7 +560,7 @@ proc run_test {arglist {pcstart 0} {iFailStart 1}} { set ::rollback_hook_count 0 set ac [sqlite3_get_autocommit $::DB] ;# Auto-Commit - sqlite_malloc_fail $iFail + sqlite3_memdebug_fail $iFail 1 set rc [catch {db eval [lindex $v 1]} msg] ;# True error occurs set nac [sqlite3_get_autocommit $::DB] ;# New Auto-Commit @@ -574,11 +575,12 @@ proc run_test {arglist {pcstart 0} {iFailStart 1}} { } {1} } + set nFail [sqlite3_memdebug_fail -1 -1] if {$rc == 0} { # Successful execution of sql. Our "mallocs-until-failure" # count should be greater than 0. Otherwise a malloc() failed # and the error was not reported. - if {[lindex [sqlite_malloc_stat] 2] <= 0} { + if {$nFail>0} { error "Unreported malloc() failure" } @@ -591,7 +593,6 @@ proc run_test {arglist {pcstart 0} {iFailStart 1}} { incr pc set iFail 1 - sqlite_malloc_fail 0 integrity_check "malloc3-(integrity).$iterid" } elseif {[regexp {.*out of memory} $msg]} { # Out of memory error, as expected @@ -638,9 +639,7 @@ db cache size 0 run_test $::run_test_script 9 1 # run_test [lrange $::run_test_script 0 3] 0 63 -sqlite_malloc_fail 0 +sqlite3_memdebug_fail -1 -1 db close -pp_check_for_leaks - finish_test |