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: all.test,v 1.19 2003/02/16 22:21:33 drh Exp $
18 set testdir [file dirname $argv0]
19 source $testdir/tester.tcl
20 rename finish_test really_finish_test
21 proc finish_test {} {memleak_check}
23 if {[file exists ./sqlite_test_count]} {
24 set COUNT [exec cat ./sqlite_test_count]
29 if {[llength $argv]>0} {
30 foreach {name value} $argv {
39 puts stderr "Unknown option: $name"
47 # LeakList will hold a list of the number of unfreed mallocs after
48 # each round of the test. This number should be constant. If it
49 # grows, it may mean there is a memory leak in the library.
62 for {set Counter 0} {$Counter<$COUNT && $nErr==0} {incr Counter} {
63 set btree_native_byte_order [expr {($Counter>>1)&0x1}]
65 set ::SETUP_SQL {PRAGMA default_synchronous=off;}
67 catch {unset ::SETUP_SQL}
69 foreach testfile [lsort -dictionary [glob $testdir/*.test]] {
70 set tail [file tail $testfile]
71 if {[lsearch -exact $EXCLUDE $tail]>=0} continue
74 if {$sqlite_open_file_count>0} {
75 puts "$tail did not close all files: $sqlite_open_file_count"
77 lappend ::failList $tail
80 if {[info exists Leak]} {
81 lappend LeakList $Leak
85 # Do one last test to look for a memory leak in the library. This will
86 # only work if SQLite is compiled with the -DMEMORY_DEBUG=1 flag.
89 puts -nonewline memory-leak-test...
92 if {$x!=[lindex $LeakList 0]} {
94 puts "Expected: all values to be the same"
95 puts " Got: $LeakList"
97 lappend ::failList memory-leak-test
104 # Run the malloc tests and the misuse test after memory leak detection.
105 # Both tests leak memory.
107 catch {source $testdir/misuse.test}
108 catch {source $testdir/malloc.test}
111 set sqlite_open_file_count 0