2001-09-16 04:13:26 +04:00
|
|
|
# 2001 September 15
|
2000-05-30 03:48:22 +04:00
|
|
|
#
|
2001-09-16 04:13:26 +04:00
|
|
|
# The author disclaims copyright to this source code. In place of
|
|
|
|
# a legal notice, here is a blessing:
|
2000-05-30 03:48:22 +04:00
|
|
|
#
|
2001-09-16 04:13:26 +04:00
|
|
|
# May you do good and not evil.
|
|
|
|
# May you find forgiveness for yourself and forgive others.
|
|
|
|
# May you share freely, never taking more than you give.
|
2000-05-30 03:48:22 +04:00
|
|
|
#
|
|
|
|
#***********************************************************************
|
|
|
|
# This file runs all tests.
|
|
|
|
#
|
2002-07-07 20:52:46 +04:00
|
|
|
# $Id: all.test,v 1.15 2002/07/07 16:52:47 drh Exp $
|
2000-05-30 03:48:22 +04:00
|
|
|
|
|
|
|
set testdir [file dirname $argv0]
|
|
|
|
source $testdir/tester.tcl
|
|
|
|
rename finish_test really_finish_test
|
2000-12-10 21:23:50 +03:00
|
|
|
proc finish_test {} {memleak_check}
|
2000-05-30 03:48:22 +04:00
|
|
|
|
2000-06-02 18:27:22 +04:00
|
|
|
if {[file exists ./sqlite_test_count]} {
|
|
|
|
set COUNT [exec cat ./sqlite_test_count]
|
|
|
|
} else {
|
2001-04-13 03:21:58 +04:00
|
|
|
set COUNT 3
|
2000-06-02 18:27:22 +04:00
|
|
|
}
|
|
|
|
|
2000-12-10 21:23:50 +03:00
|
|
|
# LeakList will hold a list of the number of unfreed mallocs after
|
|
|
|
# each round of the test. This number should be constant. If it
|
|
|
|
# grows, it may mean there is a memory leak in the library.
|
|
|
|
#
|
|
|
|
set LeakList {}
|
|
|
|
|
2001-09-16 04:13:26 +04:00
|
|
|
set EXCLUDE {
|
|
|
|
all.test
|
|
|
|
quick.test
|
|
|
|
malloc.test
|
2002-05-10 17:14:07 +04:00
|
|
|
misuse.test
|
2001-09-16 04:13:26 +04:00
|
|
|
}
|
2002-07-07 20:52:46 +04:00
|
|
|
# btree2.test
|
2000-12-10 21:23:50 +03:00
|
|
|
|
2001-09-14 20:42:12 +04:00
|
|
|
for {set Counter 0} {$Counter<$COUNT && $nErr==0} {incr Counter} {
|
2002-03-07 01:01:34 +03:00
|
|
|
if {$Counter%2} {
|
|
|
|
set ::SETUP_SQL {PRAGMA default_synchronous=off;}
|
|
|
|
} else {
|
|
|
|
catch {unset ::SETUP_SQL}
|
|
|
|
}
|
2001-09-14 01:53:09 +04:00
|
|
|
foreach testfile [lsort -dictionary [glob $testdir/*.test]] {
|
2001-09-16 04:13:26 +04:00
|
|
|
set tail [file tail $testfile]
|
|
|
|
if {[lsearch -exact $EXCLUDE $tail]>=0} continue
|
2001-09-14 01:53:09 +04:00
|
|
|
source $testfile
|
2000-06-02 18:27:22 +04:00
|
|
|
}
|
2000-12-10 21:23:50 +03:00
|
|
|
if {[info exists Leak]} {
|
|
|
|
lappend LeakList $Leak
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
# Do one last test to look for a memory leak in the library. This will
|
|
|
|
# only work if SQLite is compiled with the -DMEMORY_DEBUG=1 flag.
|
|
|
|
#
|
|
|
|
if {$LeakList!=""} {
|
|
|
|
puts -nonewline memory-leak-test...
|
|
|
|
incr ::nTest
|
|
|
|
foreach x $LeakList {
|
|
|
|
if {$x!=[lindex $LeakList 0]} {
|
|
|
|
puts " failed!"
|
|
|
|
puts "Expected: all values to be the same"
|
|
|
|
puts " Got: $LeakList"
|
|
|
|
incr ::nErr
|
2001-09-14 20:42:12 +04:00
|
|
|
lappend ::failList memory-leak-test
|
2000-12-10 21:23:50 +03:00
|
|
|
break
|
|
|
|
}
|
|
|
|
}
|
|
|
|
puts " Ok"
|
2000-05-30 03:48:22 +04:00
|
|
|
}
|
|
|
|
|
2002-05-10 17:14:07 +04:00
|
|
|
# Run the malloc tests and the misuse test after memory leak detection.
|
|
|
|
# Both tests leak memory.
|
2001-10-22 06:58:08 +04:00
|
|
|
#
|
2002-05-10 17:14:07 +04:00
|
|
|
catch {source $testdir/misuse.test}
|
2001-10-22 06:58:08 +04:00
|
|
|
catch {source $testdir/malloc.test}
|
2001-04-11 18:28:42 +04:00
|
|
|
|
2000-05-30 03:48:22 +04:00
|
|
|
really_finish_test
|