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]
26 if {[llength $argv]>0} {
27 foreach {name value} $argv {
36 puts stderr "Unknown option: $name"
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.
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} {
71 set ::SETUP_SQL {PRAGMA default_synchronous=off;}
73 catch {unset ::SETUP_SQL}
75 foreach testfile [lsort -dictionary [glob $testdir/*.test]] {
76 set tail [file tail $testfile]
77 if {[lsearch -exact $EXCLUDE $tail]>=0} continue
80 if {$sqlite_open_file_count>0} {
81 puts "$tail did not close all files: $sqlite_open_file_count"
83 lappend ::failList $tail
86 if {[info exists Leak]} {
87 lappend LeakList $Leak
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.
95 puts -nonewline memory-leak-test...
98 if {$x!=[lindex $LeakList 0]} {
100 puts "Expected: all values to be the same"
101 puts " Got: $LeakList"
103 lappend ::failList memory-leak-test
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
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}
131 set sqlite_open_file_count 0