1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/persistentdata/persistentstorage/sqlite3api/TEST/TclScript/mallocA.test Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,78 @@
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 +#
1.16 +# $Id: mallocA.test,v 1.8 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 mallocA tests: not compiled with -DSQLITE_MEMDEBUG..."
1.26 + finish_test
1.27 + return
1.28 +}
1.29 +
1.30 +
1.31 +# Construct a test database
1.32 +#
1.33 +file delete -force test.db.bu
1.34 +db eval {
1.35 + CREATE TABLE t1(a COLLATE NOCASE,b,c);
1.36 + INSERT INTO t1 VALUES(1,2,3);
1.37 + INSERT INTO t1 VALUES(1,2,4);
1.38 + INSERT INTO t1 VALUES(2,3,4);
1.39 + CREATE INDEX t1i1 ON t1(a);
1.40 + CREATE INDEX t1i2 ON t1(b,c);
1.41 + CREATE TABLE t2(x,y,z);
1.42 +}
1.43 +db close
1.44 +file copy test.db test.db.bu
1.45 +
1.46 +
1.47 +do_malloc_test mallocA-1 -testdb test.db.bu -sqlbody {
1.48 + ANALYZE
1.49 +}
1.50 +do_malloc_test mallocA-1.1 -testdb test.db.bu -sqlbody {
1.51 + ANALYZE t1
1.52 +}
1.53 +do_malloc_test mallocA-1.2 -testdb test.db.bu -sqlbody {
1.54 + ANALYZE main
1.55 +}
1.56 +do_malloc_test mallocA-1.3 -testdb test.db.bu -sqlbody {
1.57 + ANALYZE main.t1
1.58 +}
1.59 +ifcapable reindex {
1.60 + do_malloc_test mallocA-2 -testdb test.db.bu -sqlbody {
1.61 + REINDEX;
1.62 + }
1.63 + do_malloc_test mallocA-3 -testdb test.db.bu -sqlbody {
1.64 + REINDEX t1;
1.65 + }
1.66 + do_malloc_test mallocA-4 -testdb test.db.bu -sqlbody {
1.67 + REINDEX main.t1;
1.68 + }
1.69 + do_malloc_test mallocA-5 -testdb test.db.bu -sqlbody {
1.70 + REINDEX nocase;
1.71 + }
1.72 +}
1.73 +
1.74 +# Ensure that no file descriptors were leaked.
1.75 +do_test malloc-99.X {
1.76 + catch {db close}
1.77 + set sqlite_open_file_count
1.78 +} {0}
1.79 +
1.80 +file delete -force test.db.bu
1.81 +finish_test