sl@0: # 2007 April 30 sl@0: # sl@0: # The author disclaims copyright to this source code. In place of sl@0: # a legal notice, here is a blessing: sl@0: # sl@0: # May you do good and not evil. sl@0: # May you find forgiveness for yourself and forgive others. sl@0: # May you share freely, never taking more than you give. sl@0: # sl@0: #*********************************************************************** sl@0: # This file contains additional out-of-memory checks (see malloc.tcl) sl@0: # added to expose a bug in out-of-memory handling for sqlite3_prepare(). sl@0: # sl@0: # $Id: malloc9.test,v 1.5 2008/04/04 12:21:26 drh Exp $ sl@0: sl@0: set testdir [file dirname $argv0] sl@0: source $testdir/tester.tcl sl@0: source $testdir/malloc_common.tcl sl@0: sl@0: # Only run these tests if memory debugging is turned on. sl@0: # sl@0: if {!$MEMDEBUG} { sl@0: puts "Skipping malloc9 tests: not compiled with -DSQLITE_MEMDEBUG..." sl@0: finish_test sl@0: return sl@0: } sl@0: sl@0: sl@0: do_malloc_test malloc-9.1 -tclprep { sl@0: set sql {CREATE TABLE t1(x)} sl@0: set sqlbytes [string length $sql] sl@0: append sql {; INSERT INTO t1 VALUES(1)} sl@0: } -tclbody { sl@0: if {[catch {sqlite3_prepare db $sql $sqlbytes TAIL} STMT]} { sl@0: set msg $STMT sl@0: set STMT {} sl@0: error $msg sl@0: } sl@0: } -cleanup { sl@0: if {$STMT!=""} { sl@0: sqlite3_finalize $STMT sl@0: } sl@0: } sl@0: sl@0: # Ensure that no file descriptors were leaked. sl@0: do_test malloc9-99.X { sl@0: catch {db close} sl@0: set sqlite_open_file_count sl@0: } {0} sl@0: sl@0: finish_test