OLD | NEW |
1 # 2001 September 15 | 1 # 2001 September 15 |
2 # | 2 # |
3 # The author disclaims copyright to this source code. In place of | 3 # The author disclaims copyright to this source code. In place of |
4 # a legal notice, here is a blessing: | 4 # a legal notice, here is a blessing: |
5 # | 5 # |
6 # May you do good and not evil. | 6 # May you do good and not evil. |
7 # May you find forgiveness for yourself and forgive others. | 7 # May you find forgiveness for yourself and forgive others. |
8 # May you share freely, never taking more than you give. | 8 # May you share freely, never taking more than you give. |
9 # | 9 # |
10 #*********************************************************************** | 10 #*********************************************************************** |
11 # This file runs all tests. | 11 # This file runs all tests. |
12 # | 12 # |
13 # $Id: all.test,v 1.62 2009/01/06 18:43:51 drh Exp $ | |
14 | 13 |
15 set testdir [file dirname $argv0] | 14 set testdir [file dirname $argv0] |
16 source $testdir/tester.tcl | 15 source $testdir/permutations.test |
17 rename finish_test really_finish_test | |
18 proc finish_test {} { | |
19 catch {db close} | |
20 show_memstats | |
21 } | |
22 | 16 |
23 if {[file exists ./sqlite_test_count]} { | 17 run_test_suite full |
24 set COUNT [exec cat ./sqlite_test_count] | |
25 } else { | |
26 set COUNT 1 | |
27 } | |
28 | 18 |
29 if {[llength $argv]>0} { | 19 run_test_suite no_optimization |
30 foreach {name value} $argv { | 20 run_test_suite memsubsys1 |
31 switch -- $name { | 21 run_test_suite memsubsys2 |
32 -count { | 22 run_test_suite singlethread |
33 set COUNT $value | 23 run_test_suite multithread |
34 } | 24 run_test_suite onefile |
35 -quick { | 25 run_test_suite utf16 |
36 set ISQUICK $value | 26 run_test_suite exclusive |
37 } | 27 run_test_suite persistent_journal |
38 -soak { | 28 run_test_suite persistent_journal_error |
39 set SOAKTEST $value | 29 run_test_suite no_journal |
40 } | 30 run_test_suite no_journal_error |
41 default { | 31 run_test_suite autovacuum_ioerr |
42 puts stderr "Unknown option: $name" | 32 run_test_suite no_mutex_try |
43 exit | 33 run_test_suite fullmutex |
44 } | 34 run_test_suite journaltest |
45 } | 35 run_test_suite inmemory_journal |
46 } | 36 run_test_suite pcache0 |
47 } | 37 run_test_suite pcache10 |
48 set argv {} | 38 run_test_suite pcache50 |
| 39 run_test_suite pcache90 |
| 40 run_test_suite pcache100 |
49 | 41 |
50 # LeakList will hold a list of the number of unfreed mallocs after | |
51 # each round of the test. This number should be constant. If it | |
52 # grows, it may mean there is a memory leak in the library. | |
53 # | |
54 set LeakList {} | |
55 | |
56 set EXCLUDE {} | |
57 lappend EXCLUDE all.test ;# This file | |
58 lappend EXCLUDE async.test | |
59 lappend EXCLUDE crash.test ;# Run seperately later. | |
60 lappend EXCLUDE crash2.test ;# Run seperately later. | |
61 lappend EXCLUDE quick.test ;# Alternate test driver script | |
62 lappend EXCLUDE veryquick.test ;# Alternate test driver script | |
63 lappend EXCLUDE malloc.test ;# Run seperately later. | |
64 lappend EXCLUDE misuse.test ;# Run seperately later. | |
65 lappend EXCLUDE memleak.test ;# Alternate test driver script | |
66 lappend EXCLUDE permutations.test ;# Run seperately later. | |
67 lappend EXCLUDE soak.test ;# Takes a very long time (default 1 hr) | |
68 lappend EXCLUDE fts3.test ;# Wrapper for muliple fts3*.tests | |
69 lappend EXCLUDE mallocAll.test ;# Wrapper for running all malloc tests | |
70 | |
71 # Files to include in the test. If this list is empty then everything | |
72 # that is not in the EXCLUDE list is run. | |
73 # | |
74 set INCLUDE { | |
75 } | |
76 | |
77 for {set Counter 0} {$Counter<$COUNT && $nErr==0} {incr Counter} { | |
78 foreach testfile [lsort -dictionary [glob $testdir/*.test]] { | |
79 set tail [file tail $testfile] | |
80 if {[lsearch -exact $EXCLUDE $tail]>=0} continue | |
81 if {[llength $INCLUDE]>0 && [lsearch -exact $INCLUDE $tail]<0} continue | |
82 reset_prng_state | |
83 source $testfile | |
84 catch {db close} | |
85 if {$sqlite_open_file_count>0} { | |
86 puts "$tail did not close all files: $sqlite_open_file_count" | |
87 incr nErr | |
88 lappend ::failList $tail | |
89 set sqlite_open_file_count 0 | |
90 } | |
91 } | |
92 if {[info exists Leak]} { | |
93 lappend LeakList $Leak | |
94 } | |
95 } | |
96 set argv all | |
97 source $testdir/permutations.test | |
98 set argv "" | |
99 | |
100 # Do one last test to look for a memory leak in the library. This will | |
101 # only work if SQLite is compiled with the -DSQLITE_DEBUG=1 flag. | |
102 # | |
103 if {$LeakList!=""} { | |
104 puts -nonewline memory-leak-test... | |
105 incr ::nTest | |
106 foreach x $LeakList { | |
107 if {$x!=[lindex $LeakList 0]} { | |
108 puts " failed!" | |
109 puts "Expected: all values to be the same" | |
110 puts " Got: $LeakList" | |
111 incr ::nErr | |
112 lappend ::failList memory-leak-test | |
113 break | |
114 } | |
115 } | |
116 puts " Ok" | |
117 } | |
118 | |
119 # Run the crashtest only on unix and only once. If the library does not | |
120 # always create auto-vacuum databases, also run autovacuum_crash.test. | |
121 # | |
122 if {$::tcl_platform(platform)=="unix"} { | 42 if {$::tcl_platform(platform)=="unix"} { |
123 source $testdir/crash.test | |
124 source $testdir/crash2.test | |
125 ifcapable !default_autovacuum { | 43 ifcapable !default_autovacuum { |
126 set argv autovacuum_crash | 44 run_test_suite autovacuum_crash |
127 source $testdir/permutations.test | |
128 set argv "" | |
129 } | 45 } |
130 } | 46 } |
131 | 47 |
132 # Run the malloc tests and the misuse test after memory leak detection. | 48 finish_test |
133 # Both tests leak memory. Currently, misuse.test also leaks a handful of | |
134 # file descriptors. This is not considered a problem, but can cause tests | |
135 # in malloc.test to fail. So set the open-file count to zero before running | |
136 # malloc.test to get around this. | |
137 # | |
138 catch {source $testdir/misuse.test} | |
139 set sqlite_open_file_count 0 | |
140 catch {source $testdir/malloc.test} | |
141 | 49 |
142 catch {db close} | 50 |
143 set sqlite_open_file_count 0 | |
144 really_finish_test | |
OLD | NEW |