blob: 3de46fba2970801cbdf6d6b2123a002d1d883a8b [file] [log] [blame]
drhb19a2bc2001-09-16 00:13:26 +00001# 2001 September 15
drhbec2bf42000-05-29 23:48:22 +00002#
drhb19a2bc2001-09-16 00:13:26 +00003# The author disclaims copyright to this source code. In place of
4# a legal notice, here is a blessing:
drhbec2bf42000-05-29 23:48:22 +00005#
drhb19a2bc2001-09-16 00:13:26 +00006# 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.
drhbec2bf42000-05-29 23:48:22 +00009#
10#***********************************************************************
11# This file runs all tests.
12#
drhb19a2bc2001-09-16 00:13:26 +000013# $Id: all.test,v 1.10 2001/09/16 00:13:28 drh Exp $
drhbec2bf42000-05-29 23:48:22 +000014
15set testdir [file dirname $argv0]
16source $testdir/tester.tcl
17rename finish_test really_finish_test
drh8c82b352000-12-10 18:23:50 +000018proc finish_test {} {memleak_check}
drhbec2bf42000-05-29 23:48:22 +000019
drhdf16aed2000-06-02 14:27:22 +000020if {[file exists ./sqlite_test_count]} {
21 set COUNT [exec cat ./sqlite_test_count]
22} else {
drhd4007282001-04-12 23:21:58 +000023 set COUNT 3
drhdf16aed2000-06-02 14:27:22 +000024}
25
drh8c82b352000-12-10 18:23:50 +000026# LeakList will hold a list of the number of unfreed mallocs after
27# each round of the test. This number should be constant. If it
28# grows, it may mean there is a memory leak in the library.
29#
30set LeakList {}
31
drhb19a2bc2001-09-16 00:13:26 +000032set EXCLUDE {
33 all.test
34 quick.test
35 malloc.test
36}
drh8c82b352000-12-10 18:23:50 +000037
drha1b351a2001-09-14 16:42:12 +000038for {set Counter 0} {$Counter<$COUNT && $nErr==0} {incr Counter} {
drh5edc3122001-09-13 21:53:09 +000039 foreach testfile [lsort -dictionary [glob $testdir/*.test]] {
drhb19a2bc2001-09-16 00:13:26 +000040 set tail [file tail $testfile]
41 if {[lsearch -exact $EXCLUDE $tail]>=0} continue
drh5edc3122001-09-13 21:53:09 +000042 source $testfile
drhdf16aed2000-06-02 14:27:22 +000043 }
drh8c82b352000-12-10 18:23:50 +000044 if {[info exists Leak]} {
45 lappend LeakList $Leak
46 }
47}
48
49# Do one last test to look for a memory leak in the library. This will
50# only work if SQLite is compiled with the -DMEMORY_DEBUG=1 flag.
51#
52if {$LeakList!=""} {
53 puts -nonewline memory-leak-test...
54 incr ::nTest
55 foreach x $LeakList {
56 if {$x!=[lindex $LeakList 0]} {
57 puts " failed!"
58 puts "Expected: all values to be the same"
59 puts " Got: $LeakList"
60 incr ::nErr
drha1b351a2001-09-14 16:42:12 +000061 lappend ::failList memory-leak-test
drh8c82b352000-12-10 18:23:50 +000062 break
63 }
64 }
65 puts " Ok"
drhbec2bf42000-05-29 23:48:22 +000066}
67
drhdaffd0e2001-04-11 14:28:42 +000068if {[file readable $testdir/malloc.test]} {
drh5edc3122001-09-13 21:53:09 +000069 source $testdir/malloc.test
drhdaffd0e2001-04-11 14:28:42 +000070}
71
drhbec2bf42000-05-29 23:48:22 +000072really_finish_test