| OLD | NEW | 
 | (Empty) | 
|    1 # 2008 June 21 |  | 
|    2 # |  | 
|    3 # The author disclaims copyright to this source code.  In place of |  | 
|    4 # a legal notice, here is a blessing: |  | 
|    5 # |  | 
|    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. |  | 
|    9 # |  | 
|   10 #*********************************************************************** |  | 
|   11 # |  | 
|   12 # $Id: permutations.test,v 1.51 2009/07/01 18:09:02 danielk1977 Exp $ |  | 
|   13  |  | 
|   14 set testdir [file dirname $argv0] |  | 
|   15 source $testdir/tester.tcl |  | 
|   16  |  | 
|   17 # Argument processing. |  | 
|   18 # |  | 
|   19 #puts "PERM-DEBUG: argv=$argv" |  | 
|   20 namespace eval ::perm { |  | 
|   21   variable testmode [lindex $::argv 0] |  | 
|   22   variable testfile [lindex $::argv 1] |  | 
|   23 } |  | 
|   24 set argv [lrange $argv 2 end] |  | 
|   25 #puts "PERM-DEBUG: testmode=$::perm::testmode tstfile=$::perm::testfile" |  | 
|   26  |  | 
|   27 set ::permutations_presql "" |  | 
|   28 set ::permutations_test_prefix "" |  | 
|   29  |  | 
|   30 if {$::perm::testmode eq "veryquick"} { |  | 
|   31   set ::perm::testmode [list persistent_journal no_journal] |  | 
|   32   set ISQUICK 1 |  | 
|   33 } |  | 
|   34 if {$::perm::testmode eq "quick"} { |  | 
|   35   set ::perm::testmode [list persistent_journal no_journal autovacuum_ioerr] |  | 
|   36   set ISQUICK 1 |  | 
|   37 } |  | 
|   38 if {$::perm::testmode eq "all" || $::perm::testmode eq ""} { |  | 
|   39   set ::perm::testmode { |  | 
|   40     memsubsys1 memsubsys2 singlethread multithread onefile utf16 exclusive |  | 
|   41     persistent_journal persistent_journal_error no_journal no_journal_error |  | 
|   42     autovacuum_ioerr no_mutex_try fullmutex journaltest inmemory_journal |  | 
|   43     pcache0 pcache10 pcache50 pcache90 pcache100 |  | 
|   44   } |  | 
|   45 } |  | 
|   46 if {$::perm::testmode eq "targets"} {  |  | 
|   47   puts "" |  | 
|   48   puts -nonewline "veryquick            " |  | 
|   49   puts "Same as persistent_journal and no_journal" |  | 
|   50   puts -nonewline "quick                " |  | 
|   51   puts "Same as persistent_journal, no_journal and autovacuum_ioerr" |  | 
|   52   puts -nonewline "all                  " |  | 
|   53   puts "Everything except autovacuum_crash" |  | 
|   54 } |  | 
|   55 #puts "PERM-DEBUG: testmode=$::perm::testmode" |  | 
|   56  |  | 
|   57 set EXCLUDE { |  | 
|   58   all.test                  in2.test                  onefile.test |  | 
|   59   async2.test               incrvacuum_ioerr.test     permutations.test |  | 
|   60   async.test                jrnlmode2.test            quick.test |  | 
|   61   autovacuum_crash.test     jrnlmode3.test            shared_err.test |  | 
|   62   autovacuum_ioerr.test     jrnlmode4.test            soak.test |  | 
|   63   btree8.test               loadext.test              speed1p.test |  | 
|   64   corrupt.test              malloc2.test              speed1.test |  | 
|   65   crash2.test               malloc3.test              speed2.test |  | 
|   66   crash3.test               malloc4.test              speed3.test |  | 
|   67   crash4.test               mallocAll.test            speed4p.test |  | 
|   68   crash6.test               malloc.test               speed4.test |  | 
|   69   crash7.test               memleak.test              sqllimits1.test |  | 
|   70   crash.test                memsubsys1.test           thread001.test |  | 
|   71   exclusive3.test           memsubsys2.test           thread002.test |  | 
|   72   fts3.test                 misc7.test                utf16.test |  | 
|   73   fuzz_malloc.test          misuse.test               veryquick.test |  | 
|   74   fuzz.test                 mutex2.test               vtab_err.test |  | 
|   75   lookaside.test            fuzz3.test                savepoint4.test |  | 
|   76   savepoint6.test |  | 
|   77 } |  | 
|   78 set ALLTESTS [list] |  | 
|   79 foreach filename [glob $testdir/*.test] { |  | 
|   80   set filename [file tail $filename] |  | 
|   81   if {[lsearch $EXCLUDE $filename] < 0} { lappend ALLTESTS $filename } |  | 
|   82 } |  | 
|   83 set ALLTESTS [lsort $ALLTESTS] |  | 
|   84  |  | 
|   85 rename finish_test really_finish_test2 |  | 
|   86 proc finish_test {} {} |  | 
|   87  |  | 
|   88 rename do_test really_do_test |  | 
|   89  |  | 
|   90 proc do_test {name args} { |  | 
|   91   eval really_do_test [list "perm-$::permutations_test_prefix.$name"] $args |  | 
|   92 } |  | 
|   93  |  | 
|   94 # Overload the [sqlite3] command |  | 
|   95 rename sqlite3 really_sqlite3 |  | 
|   96 proc sqlite3 {args} { |  | 
|   97   set r [eval really_sqlite3 $args] |  | 
|   98   if { [llength $args] == 2 && $::permutations_presql ne "" } { |  | 
|   99     [lindex $args 0] eval $::permutations_presql |  | 
|  100   } |  | 
|  101   set r |  | 
|  102 } |  | 
|  103  |  | 
|  104 # run_tests OPTIONS |  | 
|  105 # |  | 
|  106 # where available options are:   |  | 
|  107 # |  | 
|  108 #       -initialize  SCRIPT                 (default "") |  | 
|  109 #       -shutdown    SCRIPT                 (default "") |  | 
|  110 #       -include     LIST-OF-FILES          (default $::ALLTESTS) |  | 
|  111 #       -exclude     LIST-OF-FILES          (default "") |  | 
|  112 #       -presql      SQL                    (default "") |  | 
|  113 #       -description TITLE                  (default "") |  | 
|  114 # |  | 
|  115 proc run_tests {name args} { |  | 
|  116   set ::permutations_test_prefix $name |  | 
|  117   set options(-shutdown) "" |  | 
|  118   set options(-initialize) "" |  | 
|  119   set options(-exclude) "" |  | 
|  120   set options(-include) $::ALLTESTS |  | 
|  121   set options(-presql) "" |  | 
|  122   set options(-description) "no description supplied (fixme)" |  | 
|  123   array set options $args |  | 
|  124   #puts "PERM-DEBUG: name=$name testfile=$::perm::testfile" |  | 
|  125   #puts "PERM-DEBUG: [array get options]" |  | 
|  126  |  | 
|  127   if {$::perm::testmode eq "targets"} { |  | 
|  128     puts [format "% -20s %s" $name [string trim $options(-description)]] |  | 
|  129     return |  | 
|  130   } |  | 
|  131   if {$::perm::testmode ne "" && [lsearch $::perm::testmode $name]<0} { |  | 
|  132     puts "skipping permutation test $name..." |  | 
|  133     return |  | 
|  134   } |  | 
|  135  |  | 
|  136   uplevel $options(-initialize) |  | 
|  137   set ::permutations_presql $options(-presql) |  | 
|  138  |  | 
|  139   foreach file [lsort $options(-include)] { |  | 
|  140     if {[lsearch $options(-exclude) $file] < 0 && |  | 
|  141        ( $::perm::testfile eq "" || |  | 
|  142          $::perm::testfile eq $file || |  | 
|  143         "$::perm::testfile.test" eq $file ) |  | 
|  144     } { |  | 
|  145       set ::perm::shared_cache_setting [shared_cache_setting] |  | 
|  146       uplevel source $::testdir/$file |  | 
|  147       if {$::perm::shared_cache_setting ne [shared_cache_setting]} { |  | 
|  148         error "File $::testdir/$file changed the shared cache setting from $::pe
     rm::shared_cache_setting to [shared_cache_setting]" |  | 
|  149       } |  | 
|  150     } else { |  | 
|  151       # puts "skipping file $file" |  | 
|  152     } |  | 
|  153   } |  | 
|  154  |  | 
|  155   uplevel $options(-shutdown) |  | 
|  156   set ::permutations_test_prefix "" |  | 
|  157 } |  | 
|  158  |  | 
|  159 proc shared_cache_setting {} { |  | 
|  160   set ret 0 |  | 
|  161   catch { |  | 
|  162     set ret [sqlite3_enable_shared_cache] |  | 
|  163   } |  | 
|  164   return $ret |  | 
|  165 } |  | 
|  166  |  | 
|  167 ############################################################################# |  | 
|  168 # Start of tests |  | 
|  169  |  | 
|  170 # Run some tests using pre-allocated page and scratch blocks. |  | 
|  171 # |  | 
|  172 run_tests "memsubsys1" -description { |  | 
|  173   Tests using pre-allocated page and scratch blocks |  | 
|  174 } -exclude { |  | 
|  175   ioerr5.test |  | 
|  176   malloc5.test |  | 
|  177 } -initialize { |  | 
|  178   catch {db close} |  | 
|  179   sqlite3_shutdown |  | 
|  180   sqlite3_config_pagecache 4096 24 |  | 
|  181   sqlite3_config_scratch 25000 1 |  | 
|  182   sqlite3_initialize |  | 
|  183   autoinstall_test_functions |  | 
|  184 } -shutdown { |  | 
|  185   catch {db close} |  | 
|  186   sqlite3_shutdown |  | 
|  187   sqlite3_config_pagecache 0 0 |  | 
|  188   sqlite3_config_scratch 0 0 |  | 
|  189   sqlite3_initialize |  | 
|  190   autoinstall_test_functions |  | 
|  191 } |  | 
|  192  |  | 
|  193 # Run some tests using pre-allocated page and scratch blocks. This time |  | 
|  194 # the allocations are too small to use in most cases. |  | 
|  195 # |  | 
|  196 # Both ioerr5.test and malloc5.test are excluded because they test the |  | 
|  197 # sqlite3_soft_heap_limit() and sqlite3_release_memory() functionality. |  | 
|  198 # This functionality is disabled if a pre-allocated page block is provided. |  | 
|  199 # |  | 
|  200 run_tests "memsubsys2" -description { |  | 
|  201   Tests using small pre-allocated page and scratch blocks |  | 
|  202 } -exclude { |  | 
|  203   ioerr5.test |  | 
|  204   malloc5.test |  | 
|  205 } -initialize { |  | 
|  206   catch {db close} |  | 
|  207   sqlite3_shutdown |  | 
|  208   sqlite3_config_pagecache 512 5 |  | 
|  209   sqlite3_config_scratch 1000 1 |  | 
|  210   sqlite3_initialize |  | 
|  211   autoinstall_test_functions |  | 
|  212 } -shutdown { |  | 
|  213   catch {db close} |  | 
|  214   sqlite3_shutdown |  | 
|  215   sqlite3_config_pagecache 0 0 |  | 
|  216   sqlite3_config_scratch 0 0 |  | 
|  217   sqlite3_initialize |  | 
|  218   autoinstall_test_functions |  | 
|  219 } |  | 
|  220  |  | 
|  221 # Run all tests with the lookaside allocator disabled. |  | 
|  222 # |  | 
|  223 run_tests "nolookaside" -description { |  | 
|  224   OOM tests with lookaside disabled |  | 
|  225 } -initialize { |  | 
|  226   catch {db close} |  | 
|  227   sqlite3_shutdown |  | 
|  228   sqlite3_config_lookaside 0 0 |  | 
|  229   sqlite3_initialize |  | 
|  230   autoinstall_test_functions |  | 
|  231 } -shutdown { |  | 
|  232   catch {db close} |  | 
|  233   sqlite3_shutdown |  | 
|  234   sqlite3_config_lookaside 100 500 |  | 
|  235   sqlite3_initialize |  | 
|  236   autoinstall_test_functions |  | 
|  237 } |  | 
|  238  |  | 
|  239 # Run some tests in SQLITE_CONFIG_SINGLETHREAD mode. |  | 
|  240 # |  | 
|  241 run_tests "singlethread" -description { |  | 
|  242   Tests run in SQLITE_CONFIG_SINGLETHREAD mode |  | 
|  243 } -initialize { |  | 
|  244   catch {db close} |  | 
|  245   sqlite3_shutdown |  | 
|  246   catch {sqlite3_config singlethread} |  | 
|  247   sqlite3_initialize |  | 
|  248   autoinstall_test_functions |  | 
|  249 } -include { |  | 
|  250   delete.test   delete2.test  insert.test  rollback.test  select1.test |  | 
|  251   select2.test  trans.test    update.test  vacuum.test    types.test |  | 
|  252   types2.test   types3.test |  | 
|  253 } -shutdown { |  | 
|  254   catch {db close} |  | 
|  255   sqlite3_shutdown |  | 
|  256   catch {sqlite3_config serialized} |  | 
|  257   sqlite3_initialize |  | 
|  258   autoinstall_test_functions |  | 
|  259 } |  | 
|  260  |  | 
|  261 run_tests "nomutex" -description { |  | 
|  262   Tests run with the SQLITE_OPEN_MULTITHREADED flag passed to sqlite3_open(). |  | 
|  263 } -initialize { |  | 
|  264   rename sqlite3 sqlite3_nomutex |  | 
|  265   proc sqlite3 {args} { |  | 
|  266     if {[string range [lindex $args 0] 0 0] ne "-"} { |  | 
|  267       lappend args -fullmutex 0 -nomutex 1 |  | 
|  268     } |  | 
|  269     uplevel [concat sqlite3_nomutex $args] |  | 
|  270   } |  | 
|  271 } -include { |  | 
|  272   delete.test   delete2.test  insert.test  rollback.test  select1.test |  | 
|  273   select2.test  trans.test    update.test  vacuum.test    types.test |  | 
|  274   types2.test   types3.test |  | 
|  275 } -shutdown { |  | 
|  276   rename sqlite3 {} |  | 
|  277   rename sqlite3_nomutex sqlite3 |  | 
|  278 } |  | 
|  279  |  | 
|  280 # Run some tests in SQLITE_CONFIG_MULTITHREAD mode. |  | 
|  281 # |  | 
|  282 run_tests "multithread" -description { |  | 
|  283   Tests run in SQLITE_CONFIG_MULTITHREAD mode |  | 
|  284 } -initialize { |  | 
|  285   catch {db close} |  | 
|  286   sqlite3_shutdown |  | 
|  287   catch {sqlite3_config multithread} |  | 
|  288   sqlite3_initialize |  | 
|  289   autoinstall_test_functions |  | 
|  290 } -include { |  | 
|  291   delete.test   delete2.test  insert.test  rollback.test  select1.test |  | 
|  292   select2.test  trans.test    update.test  vacuum.test    types.test |  | 
|  293   types2.test   types3.test |  | 
|  294 } -shutdown { |  | 
|  295   catch {db close} |  | 
|  296   sqlite3_shutdown |  | 
|  297   catch {sqlite3_config serialized} |  | 
|  298   sqlite3_initialize |  | 
|  299   autoinstall_test_functions |  | 
|  300 } |  | 
|  301  |  | 
|  302 # Run some tests in SQLITE_OPEN_FULLMUTEX mode. |  | 
|  303 # |  | 
|  304 run_tests "fullmutex" -description { |  | 
|  305   Tests run in SQLITE_OPEN_FULLMUTEX mode |  | 
|  306 } -initialize { |  | 
|  307   rename sqlite3 sqlite3_fullmutex |  | 
|  308   proc sqlite3 {args} { |  | 
|  309     if {[string range [lindex $args 0] 0 0] ne "-"} { |  | 
|  310       lappend args -nomutex 0 -fullmutex 1 |  | 
|  311     } |  | 
|  312     uplevel [concat sqlite3_fullmutex $args] |  | 
|  313   } |  | 
|  314 } -include { |  | 
|  315   delete.test   delete2.test  insert.test  rollback.test  select1.test |  | 
|  316   select2.test  trans.test    update.test  vacuum.test    types.test |  | 
|  317   types2.test   types3.test |  | 
|  318 } -shutdown { |  | 
|  319   rename sqlite3 {} |  | 
|  320   rename sqlite3_fullmutex sqlite3 |  | 
|  321 } |  | 
|  322  |  | 
|  323 # Run some tests using the "onefile" demo. |  | 
|  324 # |  | 
|  325 run_tests "onefile" -description { |  | 
|  326   Run some tests using the "test_onefile.c" demo |  | 
|  327 } -initialize { |  | 
|  328   rename sqlite3 sqlite3_onefile |  | 
|  329   proc sqlite3 {args} { |  | 
|  330     if {[string range [lindex $args 0] 0 0] ne "-"} { |  | 
|  331       lappend args -vfs fs |  | 
|  332     } |  | 
|  333     uplevel [concat sqlite3_onefile $args] |  | 
|  334   } |  | 
|  335 } -include { |  | 
|  336   conflict.test  insert.test   insert2.test  insert3.test |  | 
|  337   rollback.test  select1.test  select2.test  select3.test |  | 
|  338 } -shutdown { |  | 
|  339   rename sqlite3 {} |  | 
|  340   rename sqlite3_onefile sqlite3 |  | 
|  341 } |  | 
|  342  |  | 
|  343 # Run some tests using UTF-16 databases. |  | 
|  344 # |  | 
|  345 run_tests "utf16" -description { |  | 
|  346   Run tests using UTF-16 databases |  | 
|  347 } -presql { |  | 
|  348   pragma encoding = 'UTF-16' |  | 
|  349 } -include { |  | 
|  350     alter.test alter3.test |  | 
|  351     auth.test bind.test blob.test capi2.test capi3.test collate1.test |  | 
|  352     collate2.test collate3.test collate4.test collate5.test collate6.test |  | 
|  353     conflict.test date.test delete.test expr.test fkey1.test func.test |  | 
|  354     hook.test index.test insert2.test insert.test interrupt.test in.test |  | 
|  355     intpkey.test ioerr.test join2.test join.test lastinsert.test |  | 
|  356     laststmtchanges.test limit.test lock2.test lock.test main.test  |  | 
|  357     memdb.test minmax.test misc1.test misc2.test misc3.test notnull.test |  | 
|  358     null.test progress.test quote.test rowid.test select1.test select2.test |  | 
|  359     select3.test select4.test select5.test select6.test sort.test  |  | 
|  360     subselect.test tableapi.test table.test temptable.test |  | 
|  361     trace.test trigger1.test trigger2.test trigger3.test |  | 
|  362     trigger4.test types2.test types.test unique.test update.test |  | 
|  363     vacuum.test view.test where.test |  | 
|  364 } |  | 
|  365  |  | 
|  366 # Run some tests in exclusive locking mode. |  | 
|  367 # |  | 
|  368 run_tests "exclusive" -description { |  | 
|  369   Run tests in exclusive locking mode. |  | 
|  370 } -presql { |  | 
|  371   pragma locking_mode = 'exclusive' |  | 
|  372 } -include { |  | 
|  373   rollback.test select1.test select2.test  |  | 
|  374   malloc.test ioerr.test |  | 
|  375 }  |  | 
|  376  |  | 
|  377 # Run some tests in exclusive locking mode with truncated journals. |  | 
|  378 # |  | 
|  379 run_tests "exclusive-truncate" -description { |  | 
|  380   Run tests in exclusive locking mode and truncate journal mode. |  | 
|  381 } -presql { |  | 
|  382   pragma locking_mode = 'exclusive'; |  | 
|  383   pragma journal_mode = TRUNCATE; |  | 
|  384 } -include { |  | 
|  385   delete.test delete2.test insert.test rollback.test select1.test |  | 
|  386   select2.test update.test malloc.test ioerr.test |  | 
|  387 }  |  | 
|  388  |  | 
|  389 # Run some tests in persistent journal mode. |  | 
|  390 # |  | 
|  391 run_tests "persistent_journal" -description { |  | 
|  392   Run tests in persistent-journal mode. |  | 
|  393 } -presql { |  | 
|  394   pragma journal_mode = persist |  | 
|  395 } -include { |  | 
|  396   delete.test delete2.test insert.test rollback.test select1.test |  | 
|  397   select2.test trans.test update.test vacuum.test  |  | 
|  398 } |  | 
|  399  |  | 
|  400 # Run some tests in truncating journal mode. |  | 
|  401 # |  | 
|  402 run_tests "truncate_journal" -description { |  | 
|  403   Run tests in persistent-journal mode. |  | 
|  404 } -presql { |  | 
|  405   pragma journal_mode = truncate |  | 
|  406 } -include { |  | 
|  407   delete.test delete2.test insert.test rollback.test select1.test |  | 
|  408   select2.test trans.test update.test vacuum.test  |  | 
|  409   malloc.test ioerr.test |  | 
|  410 } |  | 
|  411  |  | 
|  412 # Run some error tests in persistent journal mode. |  | 
|  413 # |  | 
|  414 run_tests "persistent_journal_error" -description { |  | 
|  415   Run malloc.test and ioerr.test in persistent-journal mode. |  | 
|  416 } -presql { |  | 
|  417   pragma journal_mode = persist |  | 
|  418 } -include { |  | 
|  419   malloc.test ioerr.test |  | 
|  420 } |  | 
|  421  |  | 
|  422 # Run some tests in no journal mode. |  | 
|  423 # |  | 
|  424 run_tests "no_journal" -description { |  | 
|  425   Run tests in no-journal mode. |  | 
|  426 } -presql { |  | 
|  427   pragma journal_mode = persist |  | 
|  428 } -include { |  | 
|  429   delete.test delete2.test insert.test rollback.test select1.test |  | 
|  430   select2.test trans.test update.test vacuum.test  |  | 
|  431 } |  | 
|  432  |  | 
|  433 # Run some error tests in no journal mode. |  | 
|  434 # |  | 
|  435 run_tests "no_journal_error" -description { |  | 
|  436   Run malloc.test and ioerr.test in no-journal mode. |  | 
|  437 } -presql { |  | 
|  438   pragma journal_mode = persist |  | 
|  439 } -include { |  | 
|  440   malloc.test ioerr.test |  | 
|  441 } |  | 
|  442  |  | 
|  443 # Run some crash-tests in autovacuum mode. |  | 
|  444 # |  | 
|  445 run_tests "autovacuum_crash" -description { |  | 
|  446   Run crash.test in autovacuum mode. |  | 
|  447 } -presql { |  | 
|  448   pragma auto_vacuum = 1 |  | 
|  449 } -include crash.test |  | 
|  450  |  | 
|  451 # Run some ioerr-tests in autovacuum mode. |  | 
|  452 # |  | 
|  453 run_tests "autovacuum_ioerr" -description { |  | 
|  454   Run ioerr.test in autovacuum mode. |  | 
|  455 } -presql { |  | 
|  456   pragma auto_vacuum = 1 |  | 
|  457 } -include ioerr.test |  | 
|  458  |  | 
|  459 # Run tests with an in-memory journal. |  | 
|  460 # |  | 
|  461 run_tests "inmemory_journal" -description { |  | 
|  462   Run tests with an in-memory journal file. |  | 
|  463 } -presql { |  | 
|  464   pragma journal_mode = 'memory' |  | 
|  465 } -exclude { |  | 
|  466   # Exclude all tests that simulate IO errors. |  | 
|  467   autovacuum_ioerr2.test incrvacuum_ioerr.test ioerr.test |  | 
|  468   ioerr.test ioerr2.test ioerr3.test ioerr4.test ioerr5.test |  | 
|  469   vacuum3.test incrblob_err.test diskfull.test backup_ioerr.test |  | 
|  470  |  | 
|  471   # Exclude test scripts that use tcl IO to access journal files or count |  | 
|  472   # the number of fsync() calls. |  | 
|  473   pager.test exclusive.test jrnlmode.test sync.test misc1.test  |  | 
|  474   journal1.test conflict.test crash8.test tkt3457.test io.test |  | 
|  475 } |  | 
|  476  |  | 
|  477 ifcapable mem3 { |  | 
|  478   run_tests "memsys3" -description { |  | 
|  479     Run tests using the allocator in mem3.c. |  | 
|  480   } -exclude { |  | 
|  481     autovacuum.test           delete3.test              manydb.test |  | 
|  482     bigrow.test               incrblob2.test            memdb.test |  | 
|  483     bitvec.test               index2.test               memsubsys1.test |  | 
|  484     capi3c.test               ioerr.test                memsubsys2.test |  | 
|  485     capi3.test                join3.test                pagesize.test |  | 
|  486     collate5.test             limit.test                backup_ioerr.test |  | 
|  487     backup_malloc.test |  | 
|  488   } -initialize { |  | 
|  489     catch {db close} |  | 
|  490     sqlite3_reset_auto_extension |  | 
|  491     sqlite3_shutdown |  | 
|  492     sqlite3_config_heap 25000000 0 |  | 
|  493     sqlite3_config_lookaside 0 0 |  | 
|  494     ifcapable mem5 { |  | 
|  495       # If both memsys3 and memsys5 are enabled in the build, the call to |  | 
|  496       # [sqlite3_config_heap] will initialize the system to use memsys5. |  | 
|  497       # The following overrides this preference and installs the memsys3 |  | 
|  498       # allocator. |  | 
|  499       sqlite3_install_memsys3 |  | 
|  500     } |  | 
|  501     install_malloc_faultsim 1  |  | 
|  502     sqlite3_initialize |  | 
|  503     autoinstall_test_functions |  | 
|  504   } -shutdown { |  | 
|  505     catch {db close} |  | 
|  506     sqlite3_shutdown |  | 
|  507     sqlite3_config_heap 0 0 |  | 
|  508     sqlite3_config_lookaside 100 500 |  | 
|  509     install_malloc_faultsim 1  |  | 
|  510     sqlite3_initialize |  | 
|  511     autoinstall_test_functions |  | 
|  512   } |  | 
|  513 } |  | 
|  514  |  | 
|  515 ifcapable mem5 { |  | 
|  516   run_tests "memsys5" -description { |  | 
|  517     Run tests using the allocator in mem5.c. |  | 
|  518   } -exclude { |  | 
|  519     autovacuum.test           delete3.test              manydb.test |  | 
|  520     bigrow.test               incrblob2.test            memdb.test |  | 
|  521     bitvec.test               index2.test               memsubsys1.test |  | 
|  522     capi3c.test               ioerr.test                memsubsys2.test |  | 
|  523     capi3.test                join3.test                pagesize.test |  | 
|  524     collate5.test             limit.test                zeroblob.test |  | 
|  525   } -initialize { |  | 
|  526     catch {db close} |  | 
|  527     sqlite3_shutdown |  | 
|  528     sqlite3_config_heap 25000000 64 |  | 
|  529     sqlite3_config_lookaside 0 0 |  | 
|  530     install_malloc_faultsim 1  |  | 
|  531     sqlite3_initialize |  | 
|  532     autoinstall_test_functions |  | 
|  533   } -shutdown { |  | 
|  534     catch {db close} |  | 
|  535     sqlite3_shutdown |  | 
|  536     sqlite3_config_heap 0 0 |  | 
|  537     sqlite3_config_lookaside 100 500 |  | 
|  538     install_malloc_faultsim 1  |  | 
|  539     sqlite3_initialize |  | 
|  540     autoinstall_test_functions |  | 
|  541   } |  | 
|  542  |  | 
|  543   run_tests "memsys5-2" -description { |  | 
|  544     Run tests using the allocator in mem5.c in a different configuration. |  | 
|  545   } -include { |  | 
|  546     select1.test  |  | 
|  547   } -initialize { |  | 
|  548     catch {db close} |  | 
|  549     sqlite3_shutdown |  | 
|  550     sqlite3_config_heap 40000000 16 |  | 
|  551     sqlite3_config_lookaside 0 0 |  | 
|  552     install_malloc_faultsim 1  |  | 
|  553     sqlite3_initialize |  | 
|  554     autoinstall_test_functions |  | 
|  555   } -shutdown { |  | 
|  556     catch {db close} |  | 
|  557     sqlite3_shutdown |  | 
|  558     sqlite3_config_heap 0 0 |  | 
|  559     sqlite3_config_lookaside 100 500 |  | 
|  560     install_malloc_faultsim 1  |  | 
|  561     sqlite3_initialize |  | 
|  562     autoinstall_test_functions |  | 
|  563   } |  | 
|  564 } |  | 
|  565  |  | 
|  566 ifcapable threadsafe { |  | 
|  567   run_tests "no_mutex_try" -description { |  | 
|  568      The sqlite3_mutex_try() interface always fails |  | 
|  569   } -exclude [concat $EXCLUDE mutex1.test mutex2.test] \ |  | 
|  570   -initialize { |  | 
|  571     catch {db close} |  | 
|  572     sqlite3_shutdown |  | 
|  573     install_mutex_counters 1 |  | 
|  574     set ::disable_mutex_try 1 |  | 
|  575     sqlite3_initialize |  | 
|  576     autoinstall_test_functions |  | 
|  577   } -shutdown { |  | 
|  578     catch {db close} |  | 
|  579     sqlite3_shutdown |  | 
|  580     install_mutex_counters 0 |  | 
|  581     sqlite3_initialize |  | 
|  582     autoinstall_test_functions |  | 
|  583   } |  | 
|  584 } |  | 
|  585  |  | 
|  586 # run_tests "crash_safe_append" -description { |  | 
|  587 #   Run crash.test with persistent journals on a SAFE_APPEND file-system. |  | 
|  588 # } -initialize { |  | 
|  589 #   rename crashsql sa_crashsql |  | 
|  590 #   proc crashsql {args} { |  | 
|  591 #     set options [lrange $args 0 [expr {[llength $args]-2}]] |  | 
|  592 #     lappend options -char safe_append |  | 
|  593 #     set sql [lindex $args end] |  | 
|  594 #     lappend options " |  | 
|  595 #       PRAGMA journal_mode=persistent; |  | 
|  596 #       $sql |  | 
|  597 #     " |  | 
|  598 #     set fd [open test.db-journal w] |  | 
|  599 #     puts $fd [string repeat 1234567890 100000] |  | 
|  600 #     close $fd |  | 
|  601 #     eval sa_crashsql $options |  | 
|  602 #   } |  | 
|  603 # } -shutdown { |  | 
|  604 #   rename crashsql {} |  | 
|  605 #   rename sa_crashsql crashsql |  | 
|  606 # } -include crash.test |  | 
|  607  |  | 
|  608 run_tests "safe_append" -description { |  | 
|  609   Run some tests on a SAFE_APPEND file-system. |  | 
|  610 } -initialize { |  | 
|  611   rename sqlite3 sqlite3_safeappend |  | 
|  612   proc sqlite3 {args} { |  | 
|  613     if {[string range [lindex $args 0] 0 0] ne "-"} { |  | 
|  614       lappend args -vfs devsym |  | 
|  615     } |  | 
|  616     uplevel [concat sqlite3_safeappend $args] |  | 
|  617   } |  | 
|  618   sqlite3_simulate_device -char safe_append |  | 
|  619 } -shutdown { |  | 
|  620   rename sqlite3 {} |  | 
|  621   rename sqlite3_shutdown sqlite3 |  | 
|  622 } -include [lsort [concat shared_err.test $ALLTESTS]] \ |  | 
|  623   -exclude async3.test |  | 
|  624  |  | 
|  625 # The set of tests to run on the alternative-pcache |  | 
|  626 set perm-alt-pcache-testset { |  | 
|  627   async.test |  | 
|  628   attach.test |  | 
|  629   delete.test delete2.test |  | 
|  630   index.test |  | 
|  631   insert.test insert2.test |  | 
|  632   join.test join2.test |  | 
|  633   rollback.test |  | 
|  634   select1.test select2.test |  | 
|  635   trans.test |  | 
|  636   update.test |  | 
|  637 } |  | 
|  638  |  | 
|  639 run_tests "pcache0" -description { |  | 
|  640   Alternative pcache implementation without random discard |  | 
|  641 } -initialize { |  | 
|  642   catch {db close} |  | 
|  643   sqlite3_shutdown |  | 
|  644   sqlite3_config_alt_pcache 1 0 1 |  | 
|  645   sqlite3_initialize |  | 
|  646   autoinstall_test_functions |  | 
|  647 } -shutdown { |  | 
|  648   catch {db close} |  | 
|  649   sqlite3_shutdown |  | 
|  650   sqlite3_config_alt_pcache 0 0 0 |  | 
|  651   sqlite3_config_lookaside 100 500 |  | 
|  652   install_malloc_faultsim 1  |  | 
|  653   sqlite3_initialize |  | 
|  654   autoinstall_test_functions |  | 
|  655 } -include ${perm-alt-pcache-testset} |  | 
|  656  |  | 
|  657 run_tests "pcache10" -description { |  | 
|  658   Alternative pcache implementation without 10% random discard |  | 
|  659 } -initialize { |  | 
|  660   catch {db close} |  | 
|  661   sqlite3_shutdown |  | 
|  662   sqlite3_config_alt_pcache 1 50 1 |  | 
|  663   sqlite3_initialize |  | 
|  664   autoinstall_test_functions |  | 
|  665 } -shutdown { |  | 
|  666   catch {db close} |  | 
|  667   sqlite3_shutdown |  | 
|  668   sqlite3_config_alt_pcache 0 0 0 |  | 
|  669   sqlite3_initialize |  | 
|  670   autoinstall_test_functions |  | 
|  671 } -include ${perm-alt-pcache-testset} |  | 
|  672  |  | 
|  673 run_tests "pcache50" -description { |  | 
|  674   Alternative pcache implementation without 50% random discard |  | 
|  675 } -initialize { |  | 
|  676   catch {db close} |  | 
|  677   sqlite3_shutdown |  | 
|  678   sqlite3_config_alt_pcache 1 50 1 |  | 
|  679   sqlite3_initialize |  | 
|  680   autoinstall_test_functions |  | 
|  681 } -shutdown { |  | 
|  682   catch {db close} |  | 
|  683   sqlite3_shutdown |  | 
|  684   sqlite3_config_alt_pcache 0 0 0 |  | 
|  685   sqlite3_initialize |  | 
|  686   autoinstall_test_functions |  | 
|  687 } -include ${perm-alt-pcache-testset} |  | 
|  688  |  | 
|  689 run_tests "pcache90" -description { |  | 
|  690   Alternative pcache implementation without 90% random discard |  | 
|  691 } -initialize { |  | 
|  692   catch {db close} |  | 
|  693   sqlite3_shutdown |  | 
|  694   sqlite3_config_alt_pcache 1 50 1 |  | 
|  695   sqlite3_initialize |  | 
|  696   autoinstall_test_functions |  | 
|  697 } -shutdown { |  | 
|  698   catch {db close} |  | 
|  699   sqlite3_shutdown |  | 
|  700   sqlite3_config_alt_pcache 0 0 0 |  | 
|  701   sqlite3_initialize |  | 
|  702   autoinstall_test_functions |  | 
|  703 } -include ${perm-alt-pcache-testset} |  | 
|  704  |  | 
|  705 run_tests "pcache100" -description { |  | 
|  706   Alternative pcache implementation that always discards when unpinning |  | 
|  707 } -initialize { |  | 
|  708   catch {db close} |  | 
|  709   sqlite3_shutdown |  | 
|  710   sqlite3_config_alt_pcache 1 100 1 |  | 
|  711   sqlite3_initialize |  | 
|  712   autoinstall_test_functions |  | 
|  713 } -shutdown { |  | 
|  714   catch {db close} |  | 
|  715   sqlite3_shutdown |  | 
|  716   sqlite3_config_alt_pcache 0 0 0 |  | 
|  717   sqlite3_initialize |  | 
|  718   autoinstall_test_functions |  | 
|  719 } -include ${perm-alt-pcache-testset} |  | 
|  720  |  | 
|  721 run_tests "journaltest" -description { |  | 
|  722   Check that pages are synced before being written (test_journal.c). |  | 
|  723 } -initialize { |  | 
|  724   set ISQUICK 1 |  | 
|  725   catch {db close} |  | 
|  726   register_jt_vfs -default "" |  | 
|  727   #sqlite3_instvfs binarylog -default binarylog ostrace.bin |  | 
|  728 } -shutdown { |  | 
|  729   #sqlite3_instvfs destroy binarylog |  | 
|  730   unregister_jt_vfs |  | 
|  731 } -include [concat $::ALLTESTS savepoint6.test |  | 
|  732 ] -exclude { |  | 
|  733   incrvacuum.test |  | 
|  734   ioerr.test |  | 
|  735   corrupt4.test  |  | 
|  736   io.test  |  | 
|  737   crash8.test  |  | 
|  738   async4.test  |  | 
|  739 } |  | 
|  740  |  | 
|  741 # End of tests |  | 
|  742 ############################################################################# |  | 
|  743  |  | 
|  744 if {$::perm::testmode eq "targets"} { puts "" ; exit } |  | 
|  745  |  | 
|  746 # Restore the [sqlite3] command. |  | 
|  747 # |  | 
|  748 rename sqlite3 {} |  | 
|  749 rename really_sqlite3 sqlite3 |  | 
|  750  |  | 
|  751 # Restore the [finish_test] command. |  | 
|  752 # |  | 
|  753 rename finish_test "" |  | 
|  754 rename really_finish_test2 finish_test |  | 
|  755  |  | 
|  756 # Restore the [do_test] command. |  | 
|  757 # |  | 
|  758 rename do_test "" |  | 
|  759 rename really_do_test do_test |  | 
|  760  |  | 
|  761 finish_test |  | 
| OLD | NEW |