2 #pragma ident "%Z%%M% %I% %E% SMI"
6 # The author disclaims copyright to this source code. In place of
7 # a legal notice, here is a blessing:
9 # May you do good and not evil.
10 # May you find forgiveness for yourself and forgive others.
11 # May you share freely, never taking more than you give.
13 #***********************************************************************
14 # This file runs all tests.
16 # $Id: memleak.test,v 1.3 2004/02/12 18:46:39 drh Exp $
18 set testdir [file dirname $argv0]
19 source $testdir/tester.tcl
20 rename finish_test really_finish_test
26 if {[file exists ./sqlite_test_count]} {
27 set COUNT [exec cat ./sqlite_test_count]
32 # LeakList will hold a list of the number of unfreed mallocs after
33 # each round of the test. This number should be constant. If it
34 # grows, it may mean there is a memory leak in the library.
47 if {[sqlite -has-codec]} {
55 if {[llength $argv]>0} {
59 set FILELIST [lsort -dictionary [glob $testdir/*.test]]
62 foreach testfile $FILELIST {
63 set tail [file tail $testfile]
64 if {[lsearch -exact $EXCLUDE $tail]>=0} continue
66 for {set COUNTER 0} {$COUNTER<$COUNT} {incr COUNTER} {
68 if {[info exists Leak]} {
69 lappend LeakList $Leak
73 puts -nonewline memory-leak-test-$tail...
76 if {$x!=[lindex $LeakList 0]} {
77 puts " failed! ($LeakList)"
79 lappend ::failList memory-leak-test-$tail
88 # Run the malloc tests and the misuse test after memory leak detection.
89 # Both tests leak memory.
91 #catch {source $testdir/misuse.test}
92 #catch {source $testdir/malloc.test}