1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/persistentdata/persistentstorage/sqlite3api/TEST/TclScript/malloc9.test Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,51 @@
1.4 +# 2007 April 30
1.5 +#
1.6 +# The author disclaims copyright to this source code. In place of
1.7 +# a legal notice, here is a blessing:
1.8 +#
1.9 +# May you do good and not evil.
1.10 +# May you find forgiveness for yourself and forgive others.
1.11 +# May you share freely, never taking more than you give.
1.12 +#
1.13 +#***********************************************************************
1.14 +# This file contains additional out-of-memory checks (see malloc.tcl)
1.15 +# added to expose a bug in out-of-memory handling for sqlite3_prepare().
1.16 +#
1.17 +# $Id: malloc9.test,v 1.5 2008/04/04 12:21:26 drh Exp $
1.18 +
1.19 +set testdir [file dirname $argv0]
1.20 +source $testdir/tester.tcl
1.21 +source $testdir/malloc_common.tcl
1.22 +
1.23 +# Only run these tests if memory debugging is turned on.
1.24 +#
1.25 +if {!$MEMDEBUG} {
1.26 + puts "Skipping malloc9 tests: not compiled with -DSQLITE_MEMDEBUG..."
1.27 + finish_test
1.28 + return
1.29 +}
1.30 +
1.31 +
1.32 +do_malloc_test malloc-9.1 -tclprep {
1.33 + set sql {CREATE TABLE t1(x)}
1.34 + set sqlbytes [string length $sql]
1.35 + append sql {; INSERT INTO t1 VALUES(1)}
1.36 +} -tclbody {
1.37 + if {[catch {sqlite3_prepare db $sql $sqlbytes TAIL} STMT]} {
1.38 + set msg $STMT
1.39 + set STMT {}
1.40 + error $msg
1.41 + }
1.42 +} -cleanup {
1.43 + if {$STMT!=""} {
1.44 + sqlite3_finalize $STMT
1.45 + }
1.46 +}
1.47 +
1.48 +# Ensure that no file descriptors were leaked.
1.49 +do_test malloc9-99.X {
1.50 + catch {db close}
1.51 + set sqlite_open_file_count
1.52 +} {0}
1.53 +
1.54 +finish_test