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: # sl@0: # $Id: mallocA.test,v 1.8 2008/02/18 22:24:58 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 mallocA tests: not compiled with -DSQLITE_MEMDEBUG..." sl@0: finish_test sl@0: return sl@0: } sl@0: sl@0: sl@0: # Construct a test database sl@0: # sl@0: file delete -force test.db.bu sl@0: db eval { sl@0: CREATE TABLE t1(a COLLATE NOCASE,b,c); sl@0: INSERT INTO t1 VALUES(1,2,3); sl@0: INSERT INTO t1 VALUES(1,2,4); sl@0: INSERT INTO t1 VALUES(2,3,4); sl@0: CREATE INDEX t1i1 ON t1(a); sl@0: CREATE INDEX t1i2 ON t1(b,c); sl@0: CREATE TABLE t2(x,y,z); sl@0: } sl@0: db close sl@0: file copy test.db test.db.bu sl@0: sl@0: sl@0: do_malloc_test mallocA-1 -testdb test.db.bu -sqlbody { sl@0: ANALYZE sl@0: } sl@0: do_malloc_test mallocA-1.1 -testdb test.db.bu -sqlbody { sl@0: ANALYZE t1 sl@0: } sl@0: do_malloc_test mallocA-1.2 -testdb test.db.bu -sqlbody { sl@0: ANALYZE main sl@0: } sl@0: do_malloc_test mallocA-1.3 -testdb test.db.bu -sqlbody { sl@0: ANALYZE main.t1 sl@0: } sl@0: ifcapable reindex { sl@0: do_malloc_test mallocA-2 -testdb test.db.bu -sqlbody { sl@0: REINDEX; sl@0: } sl@0: do_malloc_test mallocA-3 -testdb test.db.bu -sqlbody { sl@0: REINDEX t1; sl@0: } sl@0: do_malloc_test mallocA-4 -testdb test.db.bu -sqlbody { sl@0: REINDEX main.t1; sl@0: } sl@0: do_malloc_test mallocA-5 -testdb test.db.bu -sqlbody { sl@0: REINDEX nocase; sl@0: } sl@0: } sl@0: sl@0: # Ensure that no file descriptors were leaked. sl@0: do_test malloc-99.X { sl@0: catch {db close} sl@0: set sqlite_open_file_count sl@0: } {0} sl@0: sl@0: file delete -force test.db.bu sl@0: finish_test