File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / sqlite3 / test / permutations.test
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue Feb 21 17:04:16 2012 UTC (12 years, 10 months ago) by misho
Branches: sqlite3, MAIN
CVS tags: v3_7_10, HEAD
sqlite3

    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: 
   13: set testdir [file dirname $argv0]
   14: source $testdir/tester.tcl
   15: db close
   16: 
   17: #-------------------------------------------------------------------------
   18: # test_suite NAME OPTIONS
   19: #
   20: # where available options are:  
   21: #
   22: #       -description TITLE                  (default "")
   23: #       -initialize  SCRIPT                 (default "")
   24: #       -shutdown    SCRIPT                 (default "")
   25: #       -presql      SQL                    (default "")
   26: #       -files       LIST-OF-FILES          (default $::ALLTESTS)
   27: #       -prefix      NAME                   (default "$::NAME.")
   28: #       -dbconfig    SCRIPT                 (default "")
   29: #
   30: proc test_suite {name args} {
   31: 
   32:   set default(-shutdown)    ""
   33:   set default(-initialize)  ""
   34:   set default(-presql)      ""
   35:   set default(-description) "no description supplied (fixme)"
   36:   set default(-files)       ""
   37:   set default(-prefix)      "${name}."
   38:   set default(-dbconfig)    ""
   39: 
   40:   array set options [array get default]
   41:   if {[llength $args]%2} {
   42:     error "uneven number of options/switches passed to test_suite"
   43:   }
   44:   foreach {k v} $args {
   45:     set o [array names options ${k}*]
   46:     if {[llength $o]>1}  { error "ambiguous option: $k" }
   47:     if {[llength $o]==0} { error "unknown option: $k" }
   48:     set options([lindex $o 0]) $v
   49:   }
   50: 
   51:   set     ::testspec($name) [array get options]
   52:   lappend ::testsuitelist $name
   53: }
   54: 
   55: #-------------------------------------------------------------------------
   56: # test_set ARGS...
   57: #
   58: proc test_set {args} {
   59:   set isExclude 0
   60:   foreach a $args {
   61:     if {[string match -* $a]} {
   62:       switch -- $a {
   63:         -include { set isExclude 0 }
   64:         -exclude { set isExclude 1 }
   65:         default {
   66:           error "Unknown switch: $a"
   67:         }
   68:       }
   69:     } elseif {$isExclude == 0} {
   70:       foreach f $a { set t($f) 1 }
   71:     } else {
   72:       foreach f $a { array unset t $f }
   73:       foreach f $a { array unset t */$f }
   74:     }
   75:   }
   76: 
   77:   return [array names t]
   78: }
   79: 
   80: #-------------------------------------------------------------------------
   81: # Set up the following global list variables containing the names of 
   82: # various test scripts:
   83: #
   84: #   $alltests
   85: #   $allquicktests
   86: #
   87: set alltests [list]
   88: foreach f [glob $testdir/*.test] { lappend alltests [file tail $f] }
   89: foreach f [glob -nocomplain $testdir/../ext/rtree/*.test] { 
   90:   lappend alltests $f 
   91: }
   92: 
   93: if {$::tcl_platform(platform)!="unix"} {
   94:   set alltests [test_set $alltests -exclude crash.test crash2.test]
   95: }
   96: set alltests [test_set $alltests -exclude {
   97:   all.test        async.test         quick.test  veryquick.test
   98:   memleak.test    permutations.test  soak.test   fts3.test
   99:   mallocAll.test  rtree.test
  100: }]
  101: 
  102: set allquicktests [test_set $alltests -exclude {
  103:   async2.test async3.test backup_ioerr.test corrupt.test
  104:   corruptC.test crash.test crash2.test crash3.test crash4.test crash5.test
  105:   crash6.test crash7.test delete3.test e_fts3.test fts3rnd.test
  106:   fkey_malloc.test fuzz.test fuzz3.test fuzz_malloc.test in2.test loadext.test
  107:   misc7.test mutex2.test notify2.test onefile.test pagerfault2.test 
  108:   savepoint4.test savepoint6.test select9.test 
  109:   speed1.test speed1p.test speed2.test speed3.test speed4.test 
  110:   speed4p.test sqllimits1.test tkt2686.test thread001.test thread002.test
  111:   thread003.test thread004.test thread005.test trans2.test vacuum3.test 
  112:   incrvacuum_ioerr.test autovacuum_crash.test btree8.test shared_err.test
  113:   vtab_err.test walslow.test walcrash.test walcrash3.test
  114:   walthread.test rtree3.test indexfault.test 
  115: }]
  116: if {[info exists ::env(QUICKTEST_INCLUDE)]} {
  117:   set allquicktests [concat $allquicktests $::env(QUICKTEST_INCLUDE)]
  118: }
  119: 
  120: #############################################################################
  121: # Start of tests
  122: #
  123: 
  124: #-------------------------------------------------------------------------
  125: # Define the generic test suites:
  126: #
  127: #   veryquick
  128: #   quick
  129: #   full
  130: #
  131: lappend ::testsuitelist xxx
  132: 
  133: test_suite "veryquick" -prefix "" -description {
  134:   "Very" quick test suite. Runs in less than 5 minutes on a workstation. 
  135:   This test suite is the same as the "quick" tests, except that some files
  136:   that test malloc and IO errors are omitted.
  137: } -files [
  138:   test_set $allquicktests -exclude *malloc* *ioerr* *fault*
  139: ]
  140: 
  141: test_suite "valgrind" -prefix "" -description {
  142:   Run the "veryquick" test suite with a couple of multi-process tests (that
  143:   fail under valgrind) omitted.
  144: } -files [
  145:   test_set $allquicktests -exclude *malloc* *ioerr* *fault* wal.test
  146: ] -initialize {
  147:   set ::G(valgrind) 1
  148: } -shutdown {
  149:   unset -nocomplain ::G(valgrind)
  150: }
  151: 
  152: test_suite "quick" -prefix "" -description {
  153:   Quick test suite. Runs in around 10 minutes on a workstation.
  154: } -files [
  155:   test_set $allquicktests
  156: ]
  157: 
  158: test_suite "full" -prefix "" -description {
  159:   Full test suite. Takes a long time.
  160: } -files [ 
  161:   test_set $alltests 
  162: ] -initialize {
  163:   unset -nocomplain ::G(isquick)
  164: }
  165: 
  166: test_suite "threads" -prefix "" -description {
  167:   All multi-threaded tests.
  168: } -files {
  169:   notify2.test   thread001.test thread002.test thread003.test 
  170:   thread004.test thread005.test walthread.test
  171: }
  172: 
  173: test_suite "fts3" -prefix "" -description {
  174:   All FTS3 tests except fts3rnd.test.
  175: } -files {
  176:   fts3aa.test fts3ab.test fts3ac.test fts3ad.test fts3ae.test
  177:   fts3af.test fts3ag.test fts3ah.test fts3ai.test fts3aj.test
  178:   fts3ak.test fts3al.test fts3am.test fts3an.test fts3ao.test
  179:   fts3atoken.test fts3b.test fts3c.test fts3cov.test fts3d.test
  180:   fts3defer.test fts3defer2.test fts3e.test fts3expr.test fts3expr2.test 
  181:   fts3near.test fts3query.test fts3shared.test fts3snippet.test 
  182:   fts3sort.test
  183:   fts3fault.test fts3malloc.test fts3matchinfo.test
  184:   fts3aux1.test fts3comp1.test fts3auto.test
  185:   fts4aa.test fts4content.test
  186:   fts3conf.test fts3prefix.test fts3fault2.test fts3corrupt.test
  187:   fts3corrupt2.test
  188:   fts3first.test
  189: }
  190: 
  191: 
  192: lappend ::testsuitelist xxx
  193: #-------------------------------------------------------------------------
  194: # Define the coverage related test suites:
  195: #
  196: #   coverage-wal
  197: #
  198: test_suite "coverage-wal" -description {
  199:   Coverage tests for file wal.c.
  200: } -files {
  201:   wal.test       wal2.test     wal3.test       walmode.test    
  202:   walbak.test    walhook.test  walcrash2.test  walcksum.test
  203:   walfault.test  walbig.test   walnoshm.test
  204:   wal5.test
  205: } 
  206: 
  207: test_suite "coverage-pager" -description {
  208:   Coverage tests for file pager.c.
  209: } -files {
  210:   pager1.test    pager2.test  pagerfault.test  pagerfault2.test
  211:   walfault.test  walbak.test  journal2.test    tkt-9d68c883.test
  212: } 
  213: 
  214: 
  215: lappend ::testsuitelist xxx
  216: #-------------------------------------------------------------------------
  217: # Define the permutation test suites:
  218: #
  219: 
  220: # Run some tests using pre-allocated page and scratch blocks.
  221: #
  222: test_suite "memsubsys1" -description {
  223:   Tests using pre-allocated page and scratch blocks
  224: } -files [
  225:   test_set $::allquicktests -exclude ioerr5.test malloc5.test
  226: ] -initialize {
  227:   catch {db close}
  228:   sqlite3_shutdown
  229:   sqlite3_config_pagecache 4096 24
  230:   sqlite3_config_scratch 25000 1
  231:   sqlite3_initialize
  232:   autoinstall_test_functions
  233: } -shutdown {
  234:   catch {db close}
  235:   sqlite3_shutdown
  236:   sqlite3_config_pagecache 0 0
  237:   sqlite3_config_scratch 0 0
  238:   sqlite3_initialize
  239:   autoinstall_test_functions
  240: }
  241: 
  242: # Run some tests using pre-allocated page and scratch blocks. This time
  243: # the allocations are too small to use in most cases.
  244: #
  245: # Both ioerr5.test and malloc5.test are excluded because they test the
  246: # sqlite3_soft_heap_limit() and sqlite3_release_memory() functionality.
  247: # This functionality is disabled if a pre-allocated page block is provided.
  248: #
  249: test_suite "memsubsys2" -description {
  250:   Tests using small pre-allocated page and scratch blocks
  251: } -files [
  252:   test_set $::allquicktests -exclude ioerr5.test malloc5.test
  253: ] -initialize {
  254:   catch {db close}
  255:   sqlite3_shutdown
  256:   sqlite3_config_pagecache 512 5
  257:   sqlite3_config_scratch 1000 1
  258:   sqlite3_initialize
  259:   autoinstall_test_functions
  260: } -shutdown {
  261:   catch {db close}
  262:   sqlite3_shutdown
  263:   sqlite3_config_pagecache 0 0
  264:   sqlite3_config_scratch 0 0
  265:   sqlite3_initialize
  266:   autoinstall_test_functions
  267: }
  268: 
  269: # Run all tests with the lookaside allocator disabled.
  270: #
  271: test_suite "nolookaside" -description {
  272:   OOM tests with lookaside disabled
  273: } -initialize {
  274:   catch {db close}
  275:   sqlite3_shutdown
  276:   sqlite3_config_lookaside 0 0
  277:   sqlite3_initialize
  278:   autoinstall_test_functions
  279: } -shutdown {
  280:   catch {db close}
  281:   sqlite3_shutdown
  282:   sqlite3_config_lookaside 100 500
  283:   sqlite3_initialize
  284:   autoinstall_test_functions
  285: } -files $::allquicktests
  286: 
  287: # Run some tests in SQLITE_CONFIG_SINGLETHREAD mode.
  288: #
  289: test_suite "singlethread" -description {
  290:   Tests run in SQLITE_CONFIG_SINGLETHREAD mode
  291: } -initialize {
  292:   catch {db close}
  293:   sqlite3_shutdown
  294:   catch {sqlite3_config singlethread}
  295:   sqlite3_initialize
  296:   autoinstall_test_functions
  297: } -files {
  298:   delete.test   delete2.test  insert.test  rollback.test  select1.test
  299:   select2.test  trans.test    update.test  vacuum.test    types.test
  300:   types2.test   types3.test
  301: } -shutdown {
  302:   catch {db close}
  303:   sqlite3_shutdown
  304:   catch {sqlite3_config serialized}
  305:   sqlite3_initialize
  306:   autoinstall_test_functions
  307: }
  308: 
  309: test_suite "nomutex" -description {
  310:   Tests run with the SQLITE_OPEN_MULTITHREADED flag passed to sqlite3_open().
  311: } -initialize {
  312:   rename sqlite3 sqlite3_nomutex
  313:   proc sqlite3 {args} {
  314:     if {[string range [lindex $args 0] 0 0] ne "-"} {
  315:       lappend args -fullmutex 0 -nomutex 1
  316:     }
  317:     uplevel [concat sqlite3_nomutex $args]
  318:   }
  319: } -files {
  320:   delete.test   delete2.test  insert.test  rollback.test  select1.test
  321:   select2.test  trans.test    update.test  vacuum.test    types.test
  322:   types2.test   types3.test
  323: } -shutdown {
  324:   rename sqlite3 {}
  325:   rename sqlite3_nomutex sqlite3
  326: }
  327: 
  328: # Run some tests in SQLITE_CONFIG_MULTITHREAD mode.
  329: #
  330: test_suite "multithread" -description {
  331:   Tests run in SQLITE_CONFIG_MULTITHREAD mode
  332: } -initialize {
  333:   catch {db close}
  334:   sqlite3_shutdown
  335:   catch {sqlite3_config multithread}
  336:   sqlite3_initialize
  337:   autoinstall_test_functions
  338: } -files {
  339:   delete.test   delete2.test  insert.test  rollback.test  select1.test
  340:   select2.test  trans.test    update.test  vacuum.test    types.test
  341:   types2.test   types3.test
  342: } -shutdown {
  343:   catch {db close}
  344:   sqlite3_shutdown
  345:   catch {sqlite3_config serialized}
  346:   sqlite3_initialize
  347:   autoinstall_test_functions
  348: }
  349: 
  350: # Run some tests in SQLITE_OPEN_FULLMUTEX mode.
  351: #
  352: test_suite "fullmutex" -description {
  353:   Tests run in SQLITE_OPEN_FULLMUTEX mode
  354: } -initialize {
  355:   rename sqlite3 sqlite3_fullmutex
  356:   proc sqlite3 {args} {
  357:     if {[string range [lindex $args 0] 0 0] ne "-"} {
  358:       lappend args -nomutex 0 -fullmutex 1
  359:     }
  360:     uplevel [concat sqlite3_fullmutex $args]
  361:   }
  362: } -files {
  363:   delete.test   delete2.test  insert.test  rollback.test  select1.test
  364:   select2.test  trans.test    update.test  vacuum.test    types.test
  365:   types2.test   types3.test
  366: } -shutdown {
  367:   rename sqlite3 {}
  368:   rename sqlite3_fullmutex sqlite3
  369: }
  370: 
  371: # Run some tests using the "onefile" demo.
  372: #
  373: test_suite "onefile" -description {
  374:   Run some tests using the "test_onefile.c" demo
  375: } -initialize {
  376:   rename sqlite3 sqlite3_onefile
  377:   proc sqlite3 {args} {
  378:     if {[string range [lindex $args 0] 0 0] ne "-"} {
  379:       lappend args -vfs fs
  380:     }
  381:     uplevel [concat sqlite3_onefile $args]
  382:   }
  383: } -files {
  384:   conflict.test  insert.test   insert2.test  insert3.test
  385:   rollback.test  select1.test  select2.test  select3.test
  386: } -shutdown {
  387:   rename sqlite3 {}
  388:   rename sqlite3_onefile sqlite3
  389: }
  390: 
  391: # Run some tests using UTF-16 databases.
  392: #
  393: test_suite "utf16" -description {
  394:   Run tests using UTF-16 databases
  395: } -presql {
  396:   pragma encoding = 'UTF-16'
  397: } -files {
  398:     alter.test alter3.test
  399:     auth.test bind.test blob.test capi2.test capi3.test collate1.test
  400:     collate2.test collate3.test collate4.test collate5.test collate6.test
  401:     conflict.test date.test delete.test expr.test fkey1.test func.test
  402:     hook.test index.test insert2.test insert.test interrupt.test in.test
  403:     intpkey.test ioerr.test join2.test join.test lastinsert.test
  404:     laststmtchanges.test limit.test lock2.test lock.test main.test 
  405:     memdb.test minmax.test misc1.test misc2.test misc3.test notnull.test
  406:     null.test progress.test quote.test rowid.test select1.test select2.test
  407:     select3.test select4.test select5.test select6.test sort.test 
  408:     subselect.test tableapi.test table.test temptable.test
  409:     trace.test trigger1.test trigger2.test trigger3.test
  410:     trigger4.test types2.test types.test unique.test update.test
  411:     vacuum.test view.test where.test
  412: }
  413: 
  414: # Run some tests in exclusive locking mode.
  415: #
  416: test_suite "exclusive" -description {
  417:   Run tests in exclusive locking mode.
  418: } -presql {
  419:   pragma locking_mode = 'exclusive'
  420: } -files {
  421:   rollback.test select1.test select2.test 
  422:   malloc.test ioerr.test
  423: } 
  424: 
  425: # Run some tests in exclusive locking mode with truncated journals.
  426: #
  427: test_suite "exclusive-truncate" -description {
  428:   Run tests in exclusive locking mode and truncate journal mode.
  429: } -presql {
  430:   pragma locking_mode = 'exclusive';
  431:   pragma journal_mode = TRUNCATE;
  432: } -files {
  433:   delete.test delete2.test insert.test rollback.test select1.test
  434:   select2.test update.test malloc.test ioerr.test
  435: } 
  436: 
  437: # Run some tests in persistent journal mode.
  438: #
  439: test_suite "persistent_journal" -description {
  440:   Run tests in persistent-journal mode.
  441: } -presql {
  442:   pragma journal_mode = persist
  443: } -files {
  444:   delete.test delete2.test insert.test rollback.test select1.test
  445:   select2.test trans.test update.test vacuum.test 
  446: }
  447: 
  448: # Run some tests in truncating journal mode.
  449: #
  450: test_suite "truncate_journal" -description {
  451:   Run tests in persistent-journal mode.
  452: } -presql {
  453:   pragma journal_mode = truncate
  454: } -files {
  455:   delete.test delete2.test insert.test rollback.test select1.test
  456:   select2.test trans.test update.test vacuum.test 
  457:   malloc.test ioerr.test
  458: }
  459: 
  460: # Run some error tests in persistent journal mode.
  461: #
  462: test_suite "persistent_journal_error" -description {
  463:   Run malloc.test and ioerr.test in persistent-journal mode.
  464: } -presql {
  465:   pragma journal_mode = persist
  466: } -files {
  467:   malloc.test ioerr.test
  468: }
  469: 
  470: # Run some tests in no journal mode.
  471: #
  472: test_suite "no_journal" -description {
  473:   Run tests in no-journal mode.
  474: } -presql {
  475:   pragma journal_mode = persist
  476: } -files {
  477:   delete.test delete2.test insert.test rollback.test select1.test
  478:   select2.test trans.test update.test vacuum.test 
  479: }
  480: 
  481: # Run some error tests in no journal mode.
  482: #
  483: test_suite "no_journal_error" -description {
  484:   Run malloc.test and ioerr.test in no-journal mode.
  485: } -presql {
  486:   pragma journal_mode = persist
  487: } -files {
  488:   malloc.test ioerr.test
  489: }
  490: 
  491: # Run some crash-tests in autovacuum mode.
  492: #
  493: test_suite "autovacuum_crash" -description {
  494:   Run crash.test in autovacuum mode.
  495: } -presql {
  496:   pragma auto_vacuum = 1
  497: } -files crash.test
  498: 
  499: # Run some ioerr-tests in autovacuum mode.
  500: #
  501: test_suite "autovacuum_ioerr" -description {
  502:   Run ioerr.test in autovacuum mode.
  503: } -presql {
  504:   pragma auto_vacuum = 1
  505: } -files ioerr.test
  506: 
  507: # Run tests with an in-memory journal.
  508: #
  509: test_suite "inmemory_journal" -description {
  510:   Run tests with an in-memory journal file.
  511: } -presql {
  512:   pragma journal_mode = 'memory'
  513: } -files [test_set $::allquicktests -exclude {
  514:   # Exclude all tests that simulate IO errors.
  515:   autovacuum_ioerr2.test incrvacuum_ioerr.test ioerr.test
  516:   ioerr.test ioerr2.test ioerr3.test ioerr4.test ioerr5.test
  517:   vacuum3.test incrblob_err.test diskfull.test backup_ioerr.test
  518:   e_fts3.test fts3cov.test fts3malloc.test fts3rnd.test
  519:   fts3snippet.test
  520: 
  521:   # Exclude test scripts that use tcl IO to access journal files or count
  522:   # the number of fsync() calls.
  523:   pager.test exclusive.test jrnlmode.test sync.test misc1.test 
  524:   journal1.test conflict.test crash8.test tkt3457.test io.test
  525:   journal3.test 8_3_names.test
  526: 
  527:   pager1.test async4.test corrupt.test filefmt.test pager2.test
  528:   corrupt5.test corruptA.test pageropt.test
  529: 
  530:   # Exclude stmt.test, which expects sub-journals to use temporary files.
  531:   stmt.test
  532: 
  533:   zerodamage.test
  534: 
  535:   # WAL mode is different.
  536:   wal* tkt-2d1a5c67d.test backcompat.test
  537: }]
  538: 
  539: ifcapable mem3 {
  540:   test_suite "memsys3" -description {
  541:     Run tests using the allocator in mem3.c.
  542:   } -files [test_set $::allquicktests -exclude {
  543:     autovacuum.test           delete3.test              manydb.test
  544:     bigrow.test               incrblob2.test            memdb.test
  545:     bitvec.test               index2.test               memsubsys1.test
  546:     capi3c.test               ioerr.test                memsubsys2.test
  547:     capi3.test                join3.test                pagesize.test
  548:     collate5.test             limit.test                backup_ioerr.test
  549:     backup_malloc.test
  550:   }] -initialize {
  551:     catch {db close}
  552:     sqlite3_reset_auto_extension
  553:     sqlite3_shutdown
  554:     sqlite3_config_heap 25000000 0
  555:     sqlite3_config_lookaside 0 0
  556:     ifcapable mem5 {
  557:       # If both memsys3 and memsys5 are enabled in the build, the call to
  558:       # [sqlite3_config_heap] will initialize the system to use memsys5.
  559:       # The following overrides this preference and installs the memsys3
  560:       # allocator.
  561:       sqlite3_install_memsys3
  562:     }
  563:     install_malloc_faultsim 1 
  564:     sqlite3_initialize
  565:     autoinstall_test_functions
  566:   } -shutdown {
  567:     catch {db close}
  568:     sqlite3_shutdown
  569:     sqlite3_config_heap 0 0
  570:     sqlite3_config_lookaside 100 500
  571:     install_malloc_faultsim 1 
  572:     sqlite3_initialize
  573:     autoinstall_test_functions
  574:   }
  575: }
  576: 
  577: ifcapable mem5 {
  578:   test_suite "memsys5" -description {
  579:     Run tests using the allocator in mem5.c.
  580:   } -files [test_set $::allquicktests -exclude {
  581:     autovacuum.test           delete3.test              manydb.test
  582:     bigrow.test               incrblob2.test            memdb.test
  583:     bitvec.test               index2.test               memsubsys1.test
  584:     capi3c.test               ioerr.test                memsubsys2.test
  585:     capi3.test                join3.test                pagesize.test
  586:     collate5.test             limit.test                zeroblob.test
  587:   }] -initialize {
  588:     catch {db close}
  589:     sqlite3_shutdown
  590:     sqlite3_config_heap 25000000 64
  591:     sqlite3_config_lookaside 0 0
  592:     install_malloc_faultsim 1 
  593:     sqlite3_initialize
  594:     autoinstall_test_functions
  595:   } -shutdown {
  596:     catch {db close}
  597:     sqlite3_shutdown
  598:     sqlite3_config_heap 0 0
  599:     sqlite3_config_lookaside 100 500
  600:     install_malloc_faultsim 1 
  601:     sqlite3_initialize
  602:     autoinstall_test_functions
  603:   }
  604: 
  605:   test_suite "memsys5-2" -description {
  606:     Run tests using the allocator in mem5.c in a different configuration.
  607:   } -files {
  608:     select1.test 
  609:   } -initialize {
  610:     catch {db close}
  611:     sqlite3_shutdown
  612:     sqlite3_config_memstatus 0
  613:     sqlite3_config_heap 40000000 16
  614:     sqlite3_config_lookaside 0 0
  615:     install_malloc_faultsim 1 
  616:     sqlite3_initialize
  617:     autoinstall_test_functions
  618:   } -shutdown {
  619:     catch {db close}
  620:     sqlite3_shutdown
  621:     sqlite3_config_heap 0 0
  622:     sqlite3_config_lookaside 100 500
  623:     install_malloc_faultsim 1 
  624:     sqlite3_initialize
  625:     autoinstall_test_functions
  626:   }
  627: }
  628: 
  629: ifcapable threadsafe {
  630:   test_suite "no_mutex_try" -description {
  631:      The sqlite3_mutex_try() interface always fails
  632:   } -files [
  633:     test_set $::allquicktests -exclude mutex1.test mutex2.test
  634:   ] -initialize {
  635:     catch {db close}
  636:     sqlite3_shutdown
  637:     install_mutex_counters 1
  638:     set ::disable_mutex_try 1
  639:     sqlite3_initialize
  640:     autoinstall_test_functions
  641:   } -shutdown {
  642:     catch {db close}
  643:     sqlite3_shutdown
  644:     install_mutex_counters 0
  645:     sqlite3_initialize
  646:     autoinstall_test_functions
  647:   }
  648: }
  649: 
  650: # run_tests "crash_safe_append" -description {
  651: #   Run crash.test with persistent journals on a SAFE_APPEND file-system.
  652: # } -initialize {
  653: #   rename crashsql sa_crashsql
  654: #   proc crashsql {args} {
  655: #     set options [lrange $args 0 [expr {[llength $args]-2}]]
  656: #     lappend options -char safe_append
  657: #     set sql [lindex $args end]
  658: #     lappend options "
  659: #       PRAGMA journal_mode=persistent;
  660: #       $sql
  661: #     "
  662: #     set fd [open test.db-journal w]
  663: #     puts $fd [string repeat 1234567890 100000]
  664: #     close $fd
  665: #     eval sa_crashsql $options
  666: #   }
  667: # } -shutdown {
  668: #   rename crashsql {}
  669: #   rename sa_crashsql crashsql
  670: # } -files crash.test
  671: 
  672: test_suite "safe_append" -description {
  673:   Run some tests on a SAFE_APPEND file-system.
  674: } -initialize {
  675:   rename sqlite3 sqlite3_safeappend
  676:   proc sqlite3 {args} {
  677:     if {[string range [lindex $args 0] 0 0] ne "-"} {
  678:       lappend args -vfs devsym
  679:     }
  680:     uplevel [concat sqlite3_safeappend $args]
  681:   }
  682:   sqlite3_simulate_device -char safe_append
  683: } -shutdown {
  684:   rename sqlite3 {}
  685:   rename sqlite3_shutdown sqlite3
  686: } -files [
  687:   test_set $::allquicktests shared_err.test -exclude async3.test
  688: ]
  689: 
  690: # The set of tests to run on the alternative-pcache
  691: set perm-alt-pcache-testset {
  692:   async.test
  693:   attach.test
  694:   delete.test delete2.test
  695:   index.test
  696:   insert.test insert2.test
  697:   join.test join2.test
  698:   rollback.test
  699:   select1.test select2.test
  700:   trans.test
  701:   update.test
  702: }
  703: 
  704: foreach discard_rate {0 10 50 90 100} {
  705:   test_suite "pcache${discard_rate}" -description "
  706:     Alternative pcache implementation with ${discard_rate}% random discard
  707:   " -initialize "
  708:     catch {db close}
  709:     sqlite3_shutdown
  710:     sqlite3_config_alt_pcache 1 $discard_rate 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_config_lookaside 100 500
  718:     install_malloc_faultsim 1 
  719:     sqlite3_initialize
  720:     autoinstall_test_functions
  721:   } -files ${perm-alt-pcache-testset}
  722: }
  723: 
  724: test_suite "journaltest" -description {
  725:   Check that pages are synced before being written (test_journal.c).
  726: } -initialize {
  727:   catch {db close}
  728:   register_jt_vfs -default ""
  729: } -shutdown {
  730:   unregister_jt_vfs
  731: } -files [test_set $::allquicktests -exclude {
  732:   wal* incrvacuum.test ioerr.test corrupt4.test io.test crash8.test 
  733:   async4.test bigfile.test backcompat.test
  734: }]
  735: 
  736: if {[info commands register_demovfs] != ""} {
  737:   test_suite "demovfs" -description {
  738:     Check that the demovfs (code in test_demovfs.c) more or less works.
  739:   } -initialize {
  740:     register_demovfs
  741:   } -shutdown {
  742:     unregister_demovfs
  743:   } -files {
  744:     insert.test   insert2.test  insert3.test rollback.test 
  745:     select1.test  select2.test  select3.test
  746:   }
  747: }
  748: 
  749: test_suite "wal" -description {
  750:   Run tests with journal_mode=WAL
  751: } -initialize {
  752:   set ::G(savepoint6_iterations) 100
  753: } -shutdown {
  754:   unset -nocomplain ::G(savepoint6_iterations)
  755: } -files {
  756:   savepoint.test     savepoint2.test     savepoint6.test
  757:   trans.test         avtrans.test
  758: 
  759:   fts3aa.test  fts3ab.test  fts3ac.test  fts3ad.test
  760:   fts3ae.test  fts3af.test  fts3ag.test  fts3ah.test
  761:   fts3ai.test  fts3aj.test  fts3ak.test  fts3al.test
  762:   fts3am.test  fts3an.test  fts3ao.test  fts3b.test
  763:   fts3c.test   fts3d.test   fts3e.test   fts3query.test 
  764: }
  765: 
  766: test_suite "rtree" -description {
  767:   All R-tree related tests. Provides coverage of source file rtree.c.
  768: } -files [glob -nocomplain $::testdir/../ext/rtree/*.test]
  769: 
  770: test_suite "no_optimization" -description {
  771:   Run test scripts with optimizations disabled using the
  772:   sqlite3_test_control(SQLITE_TESTCTRL_OPTIMIZATIONS) interface.
  773: } -files {
  774:   where.test where2.test where3.test where4.test where5.test
  775:   where6.test where7.test where8.test where9.test
  776:   whereA.test whereB.test wherelimit.test
  777:   select1.test select2.test select3.test select4.test select5.test
  778:   select7.test select8.test selectA.test selectC.test
  779: } -dbconfig {
  780:   optimization_control $::dbhandle all 0
  781: }
  782: 
  783: test_suite "prepare" -description {
  784:   Run tests with the db connection using sqlite3_prepare() instead of _v2().
  785: } -dbconfig {
  786:   db_use_legacy_prepare $::dbhandle 1
  787:   #$::dbhandle cache size 0
  788: } -files [
  789:   test_set $allquicktests -exclude *malloc* *ioerr* *fault*
  790: ]
  791: 
  792: # End of tests
  793: #############################################################################
  794: 
  795: # run_tests NAME OPTIONS
  796: #
  797: # where available options are:  
  798: #
  799: #       -description TITLE
  800: #       -initialize  SCRIPT
  801: #       -shutdown    SCRIPT
  802: #       -presql      SQL
  803: #       -files       LIST-OF-FILES
  804: #       -prefix      NAME
  805: #
  806: proc run_tests {name args} {
  807:   array set options $args
  808: 
  809:   set ::G(perm:name)         $name
  810:   set ::G(perm:prefix)       $options(-prefix)
  811:   set ::G(perm:presql)       $options(-presql)
  812:   set ::G(isquick)           1
  813:   set ::G(perm:dbconfig)     $options(-dbconfig)
  814: 
  815:   uplevel $options(-initialize)
  816: 
  817:   foreach file [lsort $options(-files)] {
  818:     if {[file tail $file] == $file} { set file [file join $::testdir $file] }
  819:     slave_test_file $file
  820:   }
  821: 
  822:   uplevel $options(-shutdown)
  823: 
  824:   unset ::G(perm:name)
  825:   unset ::G(perm:prefix)
  826:   unset ::G(perm:presql)
  827:   unset ::G(perm:dbconfig)
  828: }
  829: 
  830: proc run_test_suite {name} {
  831:   if {[info exists ::testspec($name)]==0} {
  832:     error "No such test suite: $name"
  833:   }
  834:   uplevel run_tests $name $::testspec($name)
  835: }
  836: 
  837: proc help {} {
  838:   puts "Usage: $::argv0 TESTSUITE ?TESTFILE?"
  839:   puts ""
  840:   puts "Available test-suites are:"
  841:   foreach k $::testsuitelist {
  842:     if {[info exists ::testspec($k)]==0} {
  843:       puts "         ----------------------------------------"
  844:       puts ""
  845:     } else {
  846:       array set o $::testspec($k)
  847:       puts "Test suite: \"$k\""
  848:       set d [string trim $o(-description)]
  849:       set d [regsub {\n *} $d "\n  "]
  850:       puts "  $d"
  851:       puts ""
  852:     }
  853:   }
  854:   exit -1
  855: }
  856: 
  857: if {[info script] == $argv0} {
  858:   proc main {argv} {
  859:     if {[llength $argv]==0} {
  860:       help
  861:     } else {
  862:       set suite [lindex $argv 0]
  863:       if {[info exists ::testspec($suite)]==0} help
  864:       set extra ""
  865:       if {[llength $argv]>1} { set extra [list -files [lrange $argv 1 end]] }
  866:       eval run_tests $suite $::testspec($suite) $extra
  867:     }
  868:   }
  869:   main $argv
  870:   finish_test
  871: }

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>