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