16626 sockfs: 'save_so_backlog' may be used uninitialized
[illumos-gate.git] / usr / src / lib / libsqlite / test / memleak.test
blob54cbadd39f50658733173ae2b5363231805725f9
2 # 2001 September 15
4 # The author disclaims copyright to this source code.  In place of
5 # a legal notice, here is a blessing:
7 #    May you do good and not evil.
8 #    May you find forgiveness for yourself and forgive others.
9 #    May you share freely, never taking more than you give.
11 #***********************************************************************
12 # This file runs all tests.
14 # $Id: memleak.test,v 1.3 2004/02/12 18:46:39 drh Exp $
16 set testdir [file dirname $argv0]
17 source $testdir/tester.tcl
18 rename finish_test really_finish_test
19 proc finish_test {} {
20   catch {db close}
21   memleak_check
24 if {[file exists ./sqlite_test_count]} {
25   set COUNT [exec cat ./sqlite_test_count]
26 } else {
27   set COUNT 3
30 # LeakList will hold a list of the number of unfreed mallocs after
31 # each round of the test.  This number should be constant.  If it
32 # grows, it may mean there is a memory leak in the library.
34 set LeakList {}
36 set EXCLUDE {
37   all.test
38   quick.test
39   malloc.test
40   misuse.test
41   memleak.test
42   btree2.test
43   trans.test
45 if {[sqlite -has-codec]} {
46   lappend EXCLUDE \
47     attach.test \
48     attach2.test \
49     auth.test \
50     format3.test \
51     version.test
53 if {[llength $argv]>0} {
54   set FILELIST $argv
55   set argv {}
56 } else {
57   set FILELIST [lsort -dictionary [glob $testdir/*.test]]
60 foreach testfile $FILELIST {
61   set tail [file tail $testfile]
62   if {[lsearch -exact $EXCLUDE $tail]>=0} continue
63   set LeakList {}
64   for {set COUNTER 0} {$COUNTER<$COUNT} {incr COUNTER} {
65     source $testfile
66     if {[info exists Leak]} {
67       lappend LeakList $Leak
68     }
69   }
70   if {$LeakList!=""} {
71     puts -nonewline memory-leak-test-$tail...
72     incr ::nTest
73     foreach x $LeakList {
74       if {$x!=[lindex $LeakList 0]} {
75          puts " failed! ($LeakList)"
76          incr ::nErr
77          lappend ::failList memory-leak-test-$tail
78          break
79        }
80     }
81     puts " Ok"
82   }
84 really_finish_test
86 # Run the malloc tests and the misuse test after memory leak detection.
87 # Both tests leak memory.
89 #catch {source $testdir/misuse.test}
90 #catch {source $testdir/malloc.test}
92 really_finish_test