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.
|
|
|
|
#
|
2009-01-06 21:43:51 +03:00
|
|
|
# $Id: all.test,v 1.62 2009/01/06 18:43:51 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
|
2007-04-16 21:07:55 +04:00
|
|
|
proc finish_test {} {
|
2008-10-13 18:16:11 +04:00
|
|
|
catch {db close}
|
|
|
|
show_memstats
|
2007-04-16 21:07:55 +04:00
|
|
|
}
|
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 {
|
2009-01-06 21:43:51 +03:00
|
|
|
set COUNT 1
|
2000-06-02 18:27:22 +04:00
|
|
|
}
|
|
|
|
|
2002-12-04 16:40:25 +03:00
|
|
|
if {[llength $argv]>0} {
|
|
|
|
foreach {name value} $argv {
|
|
|
|
switch -- $name {
|
|
|
|
-count {
|
|
|
|
set COUNT $value
|
|
|
|
}
|
|
|
|
-quick {
|
|
|
|
set ISQUICK $value
|
|
|
|
}
|
2007-06-18 16:22:43 +04:00
|
|
|
-soak {
|
|
|
|
set SOAKTEST $value
|
|
|
|
}
|
2002-12-04 16:40:25 +03:00
|
|
|
default {
|
|
|
|
puts stderr "Unknown option: $name"
|
|
|
|
exit
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
set argv {}
|
|
|
|
|
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 {}
|
|
|
|
|
2007-08-31 21:42:48 +04:00
|
|
|
set EXCLUDE {}
|
|
|
|
lappend EXCLUDE all.test ;# This file
|
|
|
|
lappend EXCLUDE async.test
|
|
|
|
lappend EXCLUDE crash.test ;# Run seperately later.
|
|
|
|
lappend EXCLUDE crash2.test ;# Run seperately later.
|
|
|
|
lappend EXCLUDE quick.test ;# Alternate test driver script
|
2008-04-01 03:51:35 +04:00
|
|
|
lappend EXCLUDE veryquick.test ;# Alternate test driver script
|
2007-08-31 21:42:48 +04:00
|
|
|
lappend EXCLUDE malloc.test ;# Run seperately later.
|
|
|
|
lappend EXCLUDE misuse.test ;# Run seperately later.
|
|
|
|
lappend EXCLUDE memleak.test ;# Alternate test driver script
|
2008-06-21 23:20:13 +04:00
|
|
|
lappend EXCLUDE permutations.test ;# Run seperately later.
|
2007-08-31 21:42:48 +04:00
|
|
|
lappend EXCLUDE soak.test ;# Takes a very long time (default 1 hr)
|
2007-11-23 21:19:22 +03:00
|
|
|
lappend EXCLUDE fts3.test ;# Wrapper for muliple fts3*.tests
|
2007-11-27 17:46:41 +03:00
|
|
|
lappend EXCLUDE mallocAll.test ;# Wrapper for running all malloc tests
|
2005-01-08 05:35:44 +03:00
|
|
|
|
2006-01-11 04:08:34 +03:00
|
|
|
# Files to include in the test. If this list is empty then everything
|
|
|
|
# that is not in the EXCLUDE list is run.
|
|
|
|
#
|
|
|
|
set INCLUDE {
|
|
|
|
}
|
|
|
|
|
2001-09-14 20:42:12 +04:00
|
|
|
for {set Counter 0} {$Counter<$COUNT && $nErr==0} {incr Counter} {
|
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
|
2006-01-11 04:08:34 +03:00
|
|
|
if {[llength $INCLUDE]>0 && [lsearch -exact $INCLUDE $tail]<0} continue
|
2008-01-19 23:11:25 +03:00
|
|
|
reset_prng_state
|
2001-09-14 01:53:09 +04:00
|
|
|
source $testfile
|
2003-02-17 01:21:32 +03:00
|
|
|
catch {db close}
|
|
|
|
if {$sqlite_open_file_count>0} {
|
|
|
|
puts "$tail did not close all files: $sqlite_open_file_count"
|
|
|
|
incr nErr
|
|
|
|
lappend ::failList $tail
|
2007-04-16 21:07:55 +04:00
|
|
|
set sqlite_open_file_count 0
|
|
|
|
}
|
2000-06-02 18:27:22 +04:00
|
|
|
}
|
2000-12-10 21:23:50 +03:00
|
|
|
if {[info exists Leak]} {
|
|
|
|
lappend LeakList $Leak
|
|
|
|
}
|
|
|
|
}
|
2008-06-21 22:07:37 +04:00
|
|
|
set argv all
|
|
|
|
source $testdir/permutations.test
|
|
|
|
set argv ""
|
2000-12-10 21:23:50 +03:00
|
|
|
|
|
|
|
# Do one last test to look for a memory leak in the library. This will
|
2005-01-03 04:32:59 +03:00
|
|
|
# only work if SQLite is compiled with the -DSQLITE_DEBUG=1 flag.
|
2000-12-10 21:23:50 +03:00
|
|
|
#
|
|
|
|
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
|
|
|
}
|
|
|
|
|
2005-01-08 05:35:44 +03:00
|
|
|
# Run the crashtest only on unix and only once. If the library does not
|
|
|
|
# always create auto-vacuum databases, also run autovacuum_crash.test.
|
2004-06-26 23:35:29 +04:00
|
|
|
#
|
2005-01-13 14:07:52 +03:00
|
|
|
if {$::tcl_platform(platform)=="unix"} {
|
2004-06-26 23:35:29 +04:00
|
|
|
source $testdir/crash.test
|
2007-04-02 18:19:16 +04:00
|
|
|
source $testdir/crash2.test
|
2005-01-08 05:35:44 +03:00
|
|
|
ifcapable !default_autovacuum {
|
2008-06-21 22:07:37 +04:00
|
|
|
set argv autovacuum_crash
|
|
|
|
source $testdir/permutations.test
|
|
|
|
set argv ""
|
2005-01-08 05:35:44 +03:00
|
|
|
}
|
2004-06-26 23:35:29 +04:00
|
|
|
}
|
|
|
|
|
2002-05-10 17:14:07 +04:00
|
|
|
# Run the malloc tests and the misuse test after memory leak detection.
|
2004-06-30 12:20:16 +04:00
|
|
|
# Both tests leak memory. Currently, misuse.test also leaks a handful of
|
|
|
|
# file descriptors. This is not considered a problem, but can cause tests
|
|
|
|
# in malloc.test to fail. So set the open-file count to zero before running
|
|
|
|
# malloc.test to get around this.
|
2001-10-22 06:58:08 +04:00
|
|
|
#
|
2002-05-10 17:14:07 +04:00
|
|
|
catch {source $testdir/misuse.test}
|
2004-06-30 12:20:16 +04:00
|
|
|
set sqlite_open_file_count 0
|
2006-01-17 18:36:32 +03:00
|
|
|
catch {source $testdir/malloc.test}
|
2001-04-11 18:28:42 +04:00
|
|
|
|
2003-02-17 01:21:32 +03:00
|
|
|
catch {db close}
|
|
|
|
set sqlite_open_file_count 0
|
2000-05-30 03:48:22 +04:00
|
|
|
really_finish_test
|