sl@0: # 2001 September 15 sl@0: # sl@0: # Portions Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiaries. All rights reserved. sl@0: # sl@0: # The author disclaims copyright to this source code. In place of sl@0: # a legal notice, here is a blessing: sl@0: # sl@0: # May you do good and not evil. sl@0: # May you find forgiveness for yourself and forgive others. sl@0: # May you share freely, never taking more than you give. sl@0: # sl@0: #*********************************************************************** sl@0: # This file runs all tests. sl@0: # sl@0: # $Id: all.test,v 1.58 2008/09/09 18:28:07 danielk1977 Exp $ sl@0: sl@0: set testdir [file dirname $argv0] sl@0: source $testdir/tester.tcl sl@0: rename finish_test really_finish_test sl@0: proc finish_test {} { sl@0: # no-op sl@0: } sl@0: sl@0: # Symbian: the ISQUICK value is set to 1. The number of the running tests is reduced. sl@0: set ISQUICK 1 sl@0: sl@0: # Symbian: the COUNT value (the number of test runs) changed from 3 to 1. sl@0: if {[file exists ./sqlite_test_count]} { sl@0: set COUNT [exec cat ./sqlite_test_count] sl@0: } else { sl@0: set COUNT 1 sl@0: } sl@0: sl@0: if {[llength $argv]>0} { sl@0: foreach {name value} $argv { sl@0: switch -- $name { sl@0: -count { sl@0: set COUNT $value sl@0: } sl@0: -quick { sl@0: set ISQUICK $value sl@0: } sl@0: -soak { sl@0: set SOAKTEST $value sl@0: } sl@0: default { sl@0: puts stderr "Unknown option: $name" sl@0: exit sl@0: } sl@0: } sl@0: } sl@0: } sl@0: set argv {} sl@0: sl@0: # LeakList will hold a list of the number of unfreed mallocs after sl@0: # each round of the test. This number should be constant. If it sl@0: # grows, it may mean there is a memory leak in the library. sl@0: # sl@0: set LeakList {} sl@0: sl@0: set EXCLUDE {} sl@0: lappend EXCLUDE all.test ;# This file sl@0: lappend EXCLUDE async.test sl@0: lappend EXCLUDE crash.test ;# Run seperately later. sl@0: lappend EXCLUDE crash2.test ;# Run seperately later. sl@0: lappend EXCLUDE fuzz_malloc.test ;# Symbian: the test crashes the test executable. sl@0: lappend EXCLUDE quick.test ;# Alternate test driver script sl@0: lappend EXCLUDE veryquick.test ;# Alternate test driver script sl@0: lappend EXCLUDE malloc.test ;# Run seperately later. sl@0: lappend EXCLUDE misuse.test ;# Run seperately later. sl@0: lappend EXCLUDE memleak.test ;# Alternate test driver script sl@0: lappend EXCLUDE permutations.test ;# Run seperately later. sl@0: lappend EXCLUDE rtree.test ;# Excluded, because the Symbian SQLite port does not use the R-Tree module. sl@0: lappend EXCLUDE fuzz.test sl@0: lappend EXCLUDE fuzz3.test sl@0: lappend EXCLUDE soak.test ;# Takes a very long time (default 1 hr) sl@0: lappend EXCLUDE fts3.test ;# Wrapper for muliple fts3*.tests sl@0: lappend EXCLUDE mallocall.test ;# Wrapper for running all malloc tests sl@0: lappend EXCLUDE speed1.test ;# Symbian OS: Excluding all "speed" tests, the first one is crashing all.test. sl@0: lappend EXCLUDE speed1p.test ;# Also, these "speed" tests are not that useful for Symbian OS. sl@0: lappend EXCLUDE speed2.test sl@0: lappend EXCLUDE speed3.test sl@0: lappend EXCLUDE speed4.test sl@0: lappend EXCLUDE speed4p.test sl@0: sl@0: # Files to include in the test. If this list is empty then everything sl@0: # that is not in the EXCLUDE list is run. sl@0: # sl@0: set INCLUDE { sl@0: } sl@0: sl@0: for {set Counter 0} {$Counter<$COUNT && $nErr==0} {incr Counter} { sl@0: if {$Counter%2} { sl@0: set ::SETUP_SQL {PRAGMA default_synchronous=off;} sl@0: } else { sl@0: catch {unset ::SETUP_SQL} sl@0: } sl@0: foreach testfile [lsort -dictionary [glob $testdir/*.test]] { sl@0: #Symbian OS: tail is overwritten in misc5.test, so use a new var tname for it here. sl@0: set tname [file tail $testfile] sl@0: if {[lsearch -exact $EXCLUDE $tname]>=0} continue sl@0: if {[llength $INCLUDE]>0 && [lsearch -exact $INCLUDE $tname]<0} continue sl@0: print_text "" $tname sl@0: start_case $tname sl@0: reset_prng_state sl@0: source $testfile sl@0: catch {db close} sl@0: if {$sqlite_open_file_count>0} { sl@0: puts "$tname did not close all files: $sqlite_open_file_count" sl@0: # Symbian OS: Set and increase error count with do_fail procedure (definition in Tester.tcl) sl@0: do_fail $tname sl@0: set sqlite_open_file_count 0 sl@0: } sl@0: end_case $tname sl@0: } sl@0: if {[info exists Leak]} { sl@0: lappend LeakList $Leak sl@0: } sl@0: } sl@0: sl@0: # Symbian OS: permutation tests disabled. The permutation tests are not that important, because the SQLite port is offered with hard-coded config settings. sl@0: if {$::tcl_platform(platform)!="symbian"} { sl@0: set argv all sl@0: source $testdir/permutations.test sl@0: set argv "" sl@0: } sl@0: sl@0: # Do one last test to look for a memory leak in the library. This will sl@0: # only work if SQLite is compiled with the -DSQLITE_DEBUG=1 flag. sl@0: # sl@0: if {$LeakList!=""} { sl@0: puts -nonewline memory-leak-test... sl@0: incr ::nTest sl@0: foreach x $LeakList { sl@0: if {$x!=[lindex $LeakList 0]} { sl@0: puts " failed!" sl@0: puts "Expected: all values to be the same" sl@0: puts " Got: $LeakList" sl@0: # Symbian OS: Set and increase error count with do_fail procedure (definition in Tester.tcl) sl@0: do_fail memory-leak-test sl@0: break sl@0: } sl@0: } sl@0: puts " Ok" sl@0: } sl@0: sl@0: # Run the crashtest only on unix and only once. If the library does not sl@0: # always create auto-vacuum databases, also run autovacuum_crash.test. sl@0: # sl@0: if {$::tcl_platform(platform)=="unix"} { sl@0: source $testdir/crash.test sl@0: source $testdir/crash2.test sl@0: ifcapable !default_autovacuum { sl@0: set argv autovacuum_crash sl@0: source $testdir/permutations.test sl@0: set argv "" sl@0: } sl@0: } sl@0: sl@0: # Run the malloc tests and the misuse test after memory leak detection. sl@0: # Both tests leak memory. Currently, misuse.test also leaks a handful of sl@0: # file descriptors. This is not considered a problem, but can cause tests sl@0: # in malloc.test to fail. So set the open-file count to zero before running sl@0: # malloc.test to get around this. sl@0: # sl@0: # Symbian OS: misuse/malloc tests disabled sl@0: if {$::tcl_platform(platform)!="symbian"} { sl@0: catch {source $testdir/misuse.test} sl@0: set sqlite_open_file_count 0 sl@0: catch {source $testdir/malloc.test} sl@0: } sl@0: catch {db close} sl@0: set sqlite_open_file_count 0 sl@0: really_finish_test