1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/persistentdata/persistentstorage/sqlite3api/TEST/TclScript/malloc7.test Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,48 @@
1.4 +# 2006 July 26
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_prepare16().
1.16 +#
1.17 +# $Id: malloc7.test,v 1.5 2008/02/18 22:24:58 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 malloc7 tests: not compiled with -DSQLITE_MEMDEBUG..."
1.27 + finish_test
1.28 + return
1.29 +}
1.30 +
1.31 +
1.32 +do_malloc_test malloc7-1 -sqlprep {
1.33 + CREATE TABLE t1(a,b,c,d);
1.34 + CREATE INDEX i1 ON t1(b,c);
1.35 +} -tclbody {
1.36 + set sql16 [encoding convertto unicode "SELECT * FROM sqlite_master"]
1.37 + append sql16 "\00\00"
1.38 + set nbyte [string length $sql16]
1.39 + set ::STMT [sqlite3_prepare16 db $sql16 $nbyte DUMMY]
1.40 + sqlite3_finalize $::STMT
1.41 +}
1.42 +
1.43 +
1.44 +# Ensure that no file descriptors were leaked.
1.45 +do_test malloc-99.X {
1.46 + catch {db close}
1.47 + set sqlite_open_file_count
1.48 +} {0}
1.49 +
1.50 +puts open-file-count=$sqlite_open_file_count
1.51 +finish_test