Remove a lot of the text describing extended format options from the
[sqlite.git] / test / memleak.test
bloba24a901f50748e743dd202daf1ae8fd4118fc74c
1 # 2001 September 15
3 # The author disclaims copyright to this source code.  In place of
4 # a legal notice, here is a blessing:
6 #    May you do good and not evil.
7 #    May you find forgiveness for yourself and forgive others.
8 #    May you share freely, never taking more than you give.
10 #***********************************************************************
11 # This file runs all tests.
13 # $Id: memleak.test,v 1.10 2007/03/30 17:17:52 drh Exp $
15 set testdir [file dirname $argv0]
16 source $testdir/tester.tcl
17 rename finish_test memleak_finish_test
18 proc finish_test {} {
19   catch {db close}
20   memleak_check
23 if {[file exists ./sqlite_test_count]} {
24   set COUNT [exec cat ./sqlite_test_count]
25 } else {
26   set COUNT 3
29 # LeakList will hold a list of the number of unfreed mallocs after
30 # each round of the test.  This number should be constant.  If it
31 # grows, it may mean there is a memory leak in the library.
33 set LeakList {}
35 set EXCLUDE {
36   all.test
37   quick.test
38   misuse.test
39   memleak.test
40   btree2.test
41   async.test
42   async2.test
43   trans.test
44   crash.test
45   autovacuum_crash.test
47 # Test files btree2.test and btree4.test don't work if the 
48 # SQLITE_DEFAULT_AUTOVACUUM macro is defined to true (because they depend
49 # on tables being allocated starting at page 2).
51 ifcapable default_autovacuum {
52   lappend EXCLUDE btree2.test
53   lappend EXCLUDE btree4.test
56 if {[sqlite3 -has-codec]} {
57   # lappend EXCLUDE 
59 if {[llength $argv]>0} {
60   set FILELIST $argv
61   set argv {}
62 } else {
63   set FILELIST [lsort -dictionary [glob $testdir/*.test]]
66 foreach testfile $FILELIST {
67   set tail [file tail $testfile]
68   if {[lsearch -exact $EXCLUDE $tail]>=0} continue
69   set LeakList {}
70   for {set COUNTER 0} {$COUNTER<$COUNT} {incr COUNTER} {
71     source $testfile
72     if {[info exists Leak]} {
73       lappend LeakList $Leak
74     }
75   }
76   if {$LeakList!=""} {
77     puts -nonewline memory-leak-test-$tail...
78     incr_ntest
79     foreach x $LeakList {
80       if {$x!=[lindex $LeakList 0]} {
81          puts " failed! ($LeakList)"
82          fail_test memory-leak-test-$tail
83          break
84        }
85     }
86     puts " Ok"
87   }
89 memleak_finish_test
91 # Run the malloc tests and the misuse test after memory leak detection.
92 # Both tests leak memory.
94 #catch {source $testdir/misuse.test}
95 #catch {source $testdir/malloc.test}
97 memleak_finish_test