drh | b19a2bc | 2001-09-16 00:13:26 +0000 | [diff] [blame^] | 1 | # 2001 September 15 |
drh | bec2bf4 | 2000-05-29 23:48:22 +0000 | [diff] [blame] | 2 | # |
drh | b19a2bc | 2001-09-16 00:13:26 +0000 | [diff] [blame^] | 3 | # The author disclaims copyright to this source code. In place of |
| 4 | # a legal notice, here is a blessing: |
drh | bec2bf4 | 2000-05-29 23:48:22 +0000 | [diff] [blame] | 5 | # |
drh | b19a2bc | 2001-09-16 00:13:26 +0000 | [diff] [blame^] | 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. |
drh | bec2bf4 | 2000-05-29 23:48:22 +0000 | [diff] [blame] | 9 | # |
| 10 | #*********************************************************************** |
| 11 | # This file runs all tests. |
| 12 | # |
drh | b19a2bc | 2001-09-16 00:13:26 +0000 | [diff] [blame^] | 13 | # $Id: all.test,v 1.10 2001/09/16 00:13:28 drh Exp $ |
drh | bec2bf4 | 2000-05-29 23:48:22 +0000 | [diff] [blame] | 14 | |
| 15 | set testdir [file dirname $argv0] |
| 16 | source $testdir/tester.tcl |
| 17 | rename finish_test really_finish_test |
drh | 8c82b35 | 2000-12-10 18:23:50 +0000 | [diff] [blame] | 18 | proc finish_test {} {memleak_check} |
drh | bec2bf4 | 2000-05-29 23:48:22 +0000 | [diff] [blame] | 19 | |
drh | df16aed | 2000-06-02 14:27:22 +0000 | [diff] [blame] | 20 | if {[file exists ./sqlite_test_count]} { |
| 21 | set COUNT [exec cat ./sqlite_test_count] |
| 22 | } else { |
drh | d400728 | 2001-04-12 23:21:58 +0000 | [diff] [blame] | 23 | set COUNT 3 |
drh | df16aed | 2000-06-02 14:27:22 +0000 | [diff] [blame] | 24 | } |
| 25 | |
drh | 8c82b35 | 2000-12-10 18:23:50 +0000 | [diff] [blame] | 26 | # 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 | # |
| 30 | set LeakList {} |
| 31 | |
drh | b19a2bc | 2001-09-16 00:13:26 +0000 | [diff] [blame^] | 32 | set EXCLUDE { |
| 33 | all.test |
| 34 | quick.test |
| 35 | malloc.test |
| 36 | } |
drh | 8c82b35 | 2000-12-10 18:23:50 +0000 | [diff] [blame] | 37 | |
drh | a1b351a | 2001-09-14 16:42:12 +0000 | [diff] [blame] | 38 | for {set Counter 0} {$Counter<$COUNT && $nErr==0} {incr Counter} { |
drh | 5edc312 | 2001-09-13 21:53:09 +0000 | [diff] [blame] | 39 | foreach testfile [lsort -dictionary [glob $testdir/*.test]] { |
drh | b19a2bc | 2001-09-16 00:13:26 +0000 | [diff] [blame^] | 40 | set tail [file tail $testfile] |
| 41 | if {[lsearch -exact $EXCLUDE $tail]>=0} continue |
drh | 5edc312 | 2001-09-13 21:53:09 +0000 | [diff] [blame] | 42 | source $testfile |
drh | df16aed | 2000-06-02 14:27:22 +0000 | [diff] [blame] | 43 | } |
drh | 8c82b35 | 2000-12-10 18:23:50 +0000 | [diff] [blame] | 44 | 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 | # |
| 52 | if {$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 |
drh | a1b351a | 2001-09-14 16:42:12 +0000 | [diff] [blame] | 61 | lappend ::failList memory-leak-test |
drh | 8c82b35 | 2000-12-10 18:23:50 +0000 | [diff] [blame] | 62 | break |
| 63 | } |
| 64 | } |
| 65 | puts " Ok" |
drh | bec2bf4 | 2000-05-29 23:48:22 +0000 | [diff] [blame] | 66 | } |
| 67 | |
drh | daffd0e | 2001-04-11 14:28:42 +0000 | [diff] [blame] | 68 | if {[file readable $testdir/malloc.test]} { |
drh | 5edc312 | 2001-09-13 21:53:09 +0000 | [diff] [blame] | 69 | source $testdir/malloc.test |
drh | daffd0e | 2001-04-11 14:28:42 +0000 | [diff] [blame] | 70 | } |
| 71 | |
drh | bec2bf4 | 2000-05-29 23:48:22 +0000 | [diff] [blame] | 72 | really_finish_test |