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