persistentstorage/sqlite3api/TEST/TclScript/all.test
changeset 0 08ec8eefde2f
child 21 28839de615b4
equal deleted inserted replaced
-1:000000000000 0:08ec8eefde2f
       
     1 # 2001 September 15
       
     2 #
       
     3 # Portions Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiaries. All rights reserved.
       
     4 #
       
     5 # The author disclaims copyright to this source code.  In place of
       
     6 # a legal notice, here is a blessing:
       
     7 #
       
     8 #    May you do good and not evil.
       
     9 #    May you find forgiveness for yourself and forgive others.
       
    10 #    May you share freely, never taking more than you give.
       
    11 #
       
    12 #***********************************************************************
       
    13 # This file runs all tests.
       
    14 #
       
    15 # $Id: all.test,v 1.58 2008/09/09 18:28:07 danielk1977 Exp $
       
    16 
       
    17 set testdir [file dirname $argv0]
       
    18 source $testdir/tester.tcl
       
    19 rename finish_test really_finish_test
       
    20 proc finish_test {} {
       
    21   # no-op
       
    22 }
       
    23 
       
    24 # Symbian: the ISQUICK value is set to 1. The number of the running tests is reduced.
       
    25 set ISQUICK 1
       
    26 
       
    27 # Symbian: the COUNT value (the number of test runs) changed from 3 to 1. 
       
    28 if {[file exists ./sqlite_test_count]} {
       
    29   set COUNT [exec cat ./sqlite_test_count]
       
    30 } else {
       
    31   set COUNT 1
       
    32 }
       
    33 
       
    34 if {[llength $argv]>0} {
       
    35   foreach {name value} $argv {
       
    36     switch -- $name {
       
    37       -count {
       
    38          set COUNT $value
       
    39       }
       
    40       -quick {
       
    41          set ISQUICK $value
       
    42       }
       
    43       -soak {
       
    44          set SOAKTEST $value
       
    45       }
       
    46       default {
       
    47          puts stderr "Unknown option: $name"
       
    48          exit
       
    49       }
       
    50     }
       
    51   }
       
    52 }
       
    53 set argv {}
       
    54 
       
    55 # LeakList will hold a list of the number of unfreed mallocs after
       
    56 # each round of the test.  This number should be constant.  If it
       
    57 # grows, it may mean there is a memory leak in the library.
       
    58 #
       
    59 set LeakList {}
       
    60 
       
    61 set EXCLUDE {}
       
    62 lappend EXCLUDE all.test               ;# This file
       
    63 lappend EXCLUDE async.test
       
    64 lappend EXCLUDE crash.test             ;# Run seperately later.
       
    65 lappend EXCLUDE crash2.test            ;# Run seperately later.
       
    66 lappend EXCLUDE fuzz_malloc.test       ;# Symbian: the test crashes the test executable.
       
    67 lappend EXCLUDE quick.test             ;# Alternate test driver script
       
    68 lappend EXCLUDE veryquick.test         ;# Alternate test driver script
       
    69 lappend EXCLUDE malloc.test            ;# Run seperately later.
       
    70 lappend EXCLUDE misuse.test            ;# Run seperately later.
       
    71 lappend EXCLUDE memleak.test           ;# Alternate test driver script
       
    72 lappend EXCLUDE permutations.test      ;# Run seperately later.
       
    73 lappend EXCLUDE rtree.test             ;# Excluded, because the Symbian SQLite port does not use the R-Tree module.
       
    74 lappend EXCLUDE fuzz.test
       
    75 lappend EXCLUDE fuzz3.test
       
    76 lappend EXCLUDE soak.test              ;# Takes a very long time (default 1 hr)
       
    77 lappend EXCLUDE fts3.test              ;# Wrapper for muliple fts3*.tests
       
    78 lappend EXCLUDE mallocAll.test         ;# Wrapper for running all malloc tests
       
    79 lappend EXCLUDE speed1.test			   ;# Symbian OS: Excluding all "speed" tests, the first one is crashing all.test.
       
    80 lappend EXCLUDE speed1p.test		   ;# Also, these "speed" tests are not that useful for Symbian OS.
       
    81 lappend EXCLUDE speed2.test
       
    82 lappend EXCLUDE speed3.test
       
    83 lappend EXCLUDE speed4.test
       
    84 lappend EXCLUDE speed4p.test
       
    85 
       
    86 # Files to include in the test.  If this list is empty then everything
       
    87 # that is not in the EXCLUDE list is run.
       
    88 #
       
    89 set INCLUDE {
       
    90 }
       
    91 
       
    92 for {set Counter 0} {$Counter<$COUNT && $nErr==0} {incr Counter} {
       
    93   if {$Counter%2} {
       
    94     set ::SETUP_SQL {PRAGMA default_synchronous=off;}
       
    95   } else {
       
    96     catch {unset ::SETUP_SQL}
       
    97   }
       
    98   foreach testfile [lsort -dictionary [glob $testdir/*.test]] {
       
    99     #Symbian OS: tail is overwritten in misc5.test, so use a new var tname for it here.
       
   100     set tname [file tail $testfile]
       
   101     if {[lsearch -exact $EXCLUDE $tname]>=0} continue
       
   102     if {[llength $INCLUDE]>0 && [lsearch -exact $INCLUDE $tname]<0} continue
       
   103     print_text "" $tname
       
   104     start_case $tname
       
   105     reset_prng_state
       
   106     source $testfile
       
   107     catch {db close}
       
   108     if {$sqlite_open_file_count>0} {
       
   109       puts "$tname did not close all files: $sqlite_open_file_count"
       
   110       # Symbian OS: Set and increase error count with do_fail procedure (definition in Tester.tcl)
       
   111       do_fail $tname 
       
   112       set sqlite_open_file_count 0
       
   113     }
       
   114     end_case $tname
       
   115   }
       
   116   if {[info exists Leak]} {
       
   117     lappend LeakList $Leak
       
   118   }
       
   119 }
       
   120 
       
   121 # Symbian OS: permutation tests disabled. The permutation tests are not that important, because the SQLite port is offered with hard-coded config settings.
       
   122 if {$::tcl_platform(platform)!="symbian"} {
       
   123   set argv all
       
   124   source $testdir/permutations.test
       
   125   set argv ""
       
   126 }
       
   127 
       
   128 # Do one last test to look for a memory leak in the library.  This will
       
   129 # only work if SQLite is compiled with the -DSQLITE_DEBUG=1 flag.
       
   130 #
       
   131 if {$LeakList!=""} {
       
   132   puts -nonewline memory-leak-test...
       
   133   incr ::nTest
       
   134   foreach x $LeakList {
       
   135     if {$x!=[lindex $LeakList 0]} {
       
   136        puts " failed!"
       
   137        puts "Expected: all values to be the same"
       
   138        puts "     Got: $LeakList"
       
   139        # Symbian OS: Set and increase error count with do_fail procedure (definition in Tester.tcl)
       
   140        do_fail memory-leak-test 
       
   141        break
       
   142     }
       
   143   }
       
   144   puts " Ok"
       
   145 }
       
   146 
       
   147 # Run the crashtest only on unix and only once. If the library does not
       
   148 # always create auto-vacuum databases, also run autovacuum_crash.test.
       
   149 #
       
   150 if {$::tcl_platform(platform)=="unix"} {
       
   151   source $testdir/crash.test
       
   152   source $testdir/crash2.test
       
   153   ifcapable !default_autovacuum {
       
   154     set argv autovacuum_crash
       
   155     source $testdir/permutations.test
       
   156     set argv ""
       
   157   }
       
   158 }
       
   159 
       
   160 # Run the malloc tests and the misuse test after memory leak detection.
       
   161 # Both tests leak memory. Currently, misuse.test also leaks a handful of
       
   162 # file descriptors. This is not considered a problem, but can cause tests
       
   163 # in malloc.test to fail. So set the open-file count to zero before running
       
   164 # malloc.test to get around this.
       
   165 #
       
   166 # Symbian OS: misuse/malloc tests disabled
       
   167 if {$::tcl_platform(platform)!="symbian"} {
       
   168   catch {source $testdir/misuse.test}
       
   169   set sqlite_open_file_count 0
       
   170   catch {source $testdir/malloc.test}
       
   171 }
       
   172 catch {db close}
       
   173 set sqlite_open_file_count 0
       
   174 really_finish_test