os/persistentdata/persistentstorage/sqlite3api/TEST/TclScript/malloc6.test
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/persistentdata/persistentstorage/sqlite3api/TEST/TclScript/malloc6.test	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,55 @@
     1.4 +# 2006 June 25
     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 attempts to check the library in an out-of-memory situation.
    1.15 +#
    1.16 +# $Id: malloc6.test,v 1.5 2008/02/18 22:24:58 drh Exp $
    1.17 +
    1.18 +set testdir [file dirname $argv0]
    1.19 +source $testdir/tester.tcl
    1.20 +source $testdir/malloc_common.tcl
    1.21 +
    1.22 +# Only run these tests if memory debugging is turned on.
    1.23 +#
    1.24 +if {!$MEMDEBUG} {
    1.25 +   puts "Skipping malloc6 tests: not compiled with -DSQLITE_MEMDEBUG..."
    1.26 +   finish_test
    1.27 +   return
    1.28 +}
    1.29 +
    1.30 +
    1.31 +set sqlite_os_trace 0
    1.32 +do_malloc_test malloc6-1 -tclprep {
    1.33 +  db close
    1.34 +} -tclbody {
    1.35 +  if {[catch {sqlite3 db test.db}]} {
    1.36 +    error "out of memory"
    1.37 +  }
    1.38 +  sqlite3_extended_result_codes db 1
    1.39 +} -sqlbody {
    1.40 +  DROP TABLE IF EXISTS t1;
    1.41 +  CREATE TABLE IF NOT EXISTS t1(
    1.42 +     a int, b float, c double, d text, e varchar(20),
    1.43 +     primary key(a,b,c)
    1.44 +  );
    1.45 +  CREATE TABLE IF NOT EXISTS t1(
    1.46 +     a int, b float, c double, d text, e varchar(20),
    1.47 +     primary key(a,b,c)
    1.48 +  );
    1.49 +  DROP TABLE IF EXISTS t1;
    1.50 +} 
    1.51 +
    1.52 +# Ensure that no file descriptors were leaked.
    1.53 +do_test malloc6-1.X {
    1.54 +  catch {db close}
    1.55 +  set sqlite_open_file_count
    1.56 +} {0}
    1.57 +
    1.58 +finish_test