Same fix as r45172 for classes/iconimage:
[AROS-Contrib.git] / sqlite3 / test / all.test
blob2143b5ffb13fc2088845d6510a8030a46d4b1898
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: all.test,v 1.30 2005/01/17 07:53:44 danielk1977 Exp $
15 set testdir [file dirname $argv0]
16 source $testdir/tester.tcl
17 rename finish_test really_finish_test
18 proc finish_test {} {memleak_check}
20 if {[file exists ./sqlite_test_count]} {
21   set COUNT [exec cat ./sqlite_test_count]
22 } else {
23   set COUNT 3
26 if {[llength $argv]>0} {
27   foreach {name value} $argv {
28     switch -- $name {
29       -count {
30          set COUNT $value
31       }
32       -quick {
33          set ISQUICK $value
34       }
35       default {
36          puts stderr "Unknown option: $name"
37          exit
38       }
39     }
40   }
42 set argv {}
44 # LeakList will hold a list of the number of unfreed mallocs after
45 # each round of the test.  This number should be constant.  If it
46 # grows, it may mean there is a memory leak in the library.
48 set LeakList {}
50 set EXCLUDE {
51   all.test
52   crash.test
53   autovacuum_crash.test
54   quick.test
55   malloc.test
56   misuse.test
57   memleak.test
60 # Test files btree2.test and btree4.test don't work if the 
61 # SQLITE_DEFAULT_AUTOVACUUM macro is defined to true (because they depend
62 # on tables being allocated starting at page 2).
64 ifcapable default_autovacuum {
65   lappend EXCLUDE btree2.test
66   lappend EXCLUDE btree4.test
69 for {set Counter 0} {$Counter<$COUNT && $nErr==0} {incr Counter} {
70   if {$Counter%2} {
71     set ::SETUP_SQL {PRAGMA default_synchronous=off;}
72   } else {
73     catch {unset ::SETUP_SQL}
74   }
75   foreach testfile [lsort -dictionary [glob $testdir/*.test]] {
76     set tail [file tail $testfile]
77     if {[lsearch -exact $EXCLUDE $tail]>=0} continue
78     source $testfile
79     catch {db close}
80     if {$sqlite_open_file_count>0} {
81       puts "$tail did not close all files: $sqlite_open_file_count"
82       incr nErr
83       lappend ::failList $tail
84     }
85   }
86   if {[info exists Leak]} {
87     lappend LeakList $Leak
88   }
91 # Do one last test to look for a memory leak in the library.  This will
92 # only work if SQLite is compiled with the -DSQLITE_DEBUG=1 flag.
94 if {$LeakList!=""} {
95   puts -nonewline memory-leak-test...
96   incr ::nTest
97   foreach x $LeakList {
98     if {$x!=[lindex $LeakList 0]} {
99        puts " failed!"
100        puts "Expected: all values to be the same"
101        puts "     Got: $LeakList"
102        incr ::nErr
103        lappend ::failList memory-leak-test
104        break
105     }
106   }
107   puts " Ok"
110 # Run the crashtest only on unix and only once. If the library does not
111 # always create auto-vacuum databases, also run autovacuum_crash.test.
113 if {$::tcl_platform(platform)=="unix"} {
114   source $testdir/crash.test
115   ifcapable !default_autovacuum {
116     source $testdir/autovacuum_crash.test
117   }
120 # Run the malloc tests and the misuse test after memory leak detection.
121 # Both tests leak memory. Currently, misuse.test also leaks a handful of
122 # file descriptors. This is not considered a problem, but can cause tests
123 # in malloc.test to fail. So set the open-file count to zero before running
124 # malloc.test to get around this.
126 catch {source $testdir/misuse.test}
127 set sqlite_open_file_count 0
128 catch {source $testdir/malloc.test}
130 catch {db close}
131 set sqlite_open_file_count 0
132 really_finish_test