Debian Codegraph @

test/permutations.test

raw
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 if {[info vars ::trd::tcltest]==""} {
14 set testdir [file dirname $argv0]
15 source $testdir/tester.tcl
16 db close
17 }
18
19 #-------------------------------------------------------------------------
20 # test_suite NAME OPTIONS
21 #
22 # where available options are:
23 #
24 # -description TITLE (default "")
25 # -initialize SCRIPT (default "")
26 # -shutdown SCRIPT (default "")
27 # -presql SQL (default "")
28 # -files LIST-OF-FILES (default $::ALLTESTS)
29 # -prefix NAME (default "$::NAME.")
30 # -dbconfig SCRIPT (default "")
31 #
32 proc test_suite {name args} {
33
34 set default(-shutdown) ""
35 set default(-initialize) ""
36 set default(-presql) ""
37 set default(-description) "no description supplied (fixme)"
38 set default(-files) ""
39 set default(-prefix) "${name}."
40 set default(-dbconfig) ""
41
42 array set options [array get default]
43 if {[llength $args]%2} {
44 error "uneven number of options/switches passed to test_suite"
45 }
46 foreach {k v} $args {
47 set o [array names options ${k}*]
48 if {[llength $o]>1} { error "ambiguous option: $k" }
49 if {[llength $o]==0} { error "unknown option: $k" }
50 set options([lindex $o 0]) $v
51 }
52
53 set ::testspec($name) [array get options]
54 lappend ::testsuitelist $name
55 }
56
57 #-------------------------------------------------------------------------
58 # test_set ARGS...
59 #
60 proc test_set {args} {
61 set isExclude 0
62 foreach a $args {
63 if {[string match -* $a]} {
64 switch -- $a {
65 -include { set isExclude 0 }
66 -exclude { set isExclude 1 }
67 default {
68 error "Unknown switch: $a"
69 }
70 }
71 } elseif {$isExclude == 0} {
72 foreach f $a { set t($f) 1 }
73 } else {
74 foreach f $a { array unset t $f }
75 foreach f $a { array unset t */$f }
76 }
77 }
78
79 return [array names t]
80 }
81
82 #-------------------------------------------------------------------------
83 # Set up the following global list variables containing the names of
84 # various test scripts:
85 #
86 # $alltests
87 # $allquicktests
88 #
89 set alltests [list]
90 foreach f [glob $testdir/*.test] { lappend alltests [file tail $f] }
91 foreach f [glob -nocomplain \
92 $testdir/../ext/rtree/*.test \
93 $testdir/../ext/fts5/test/*.test \
94 $testdir/../ext/expert/*.test \
95 $testdir/../ext/lsm1/test/*.test \
96 $testdir/../ext/recover/*.test \
97 $testdir/../ext/rbu/*.test \
98 $testdir/../ext/intck/*.test \
99 ] {
100 lappend alltests $f
101 }
102 foreach f [glob -nocomplain $testdir/../ext/session/*.test] {
103 lappend alltests $f
104 }
105 unset f
106
107 if {$::tcl_platform(platform) ne "unix"} {
108 set alltests [test_set $alltests -exclude crash.test crash2.test]
109 }
110 set alltests [test_set $alltests -exclude {
111 all.test quick.test veryquick.test
112 memleak.test permutations.test soak.test fts3.test
113 mallocAll.test rtree.test full.test extraquick.test
114 session.test rbu.test
115 }]
116
117 set allquicktests [test_set $alltests -exclude {
118 backup_ioerr.test corrupt.test
119 corruptC.test crash.test crash2.test crash3.test crash4.test crash5.test
120 crash6.test crash7.test delete3.test e_fts3.test fts3rnd.test
121 fkey_malloc.test fuzz.test fuzz3.test fuzz_malloc.test in2.test loadext.test
122 misc7.test mutex2.test onefile.test pagerfault2.test
123 savepoint4.test savepoint6.test select9.test
124 speed1.test speed1p.test speed2.test speed3.test speed4.test
125 speed4p.test sqllimits1.test tkt2686.test thread001.test thread002.test
126 thread003.test thread004.test thread005.test trans2.test vacuum3.test
127 incrvacuum_ioerr.test autovacuum_crash.test btree8.test shared_err.test
128 vtab_err.test walslow.test walcrash.test walcrash3.test
129 walthread.test rtree3.test indexfault.test securedel2.test
130 sort3.test sort4.test fts4growth.test fts4growth2.test
131 bigsort.test walprotocol.test mmap4.test fuzzer2.test
132 walcrash2.test e_fkey.test backup.test
133
134 fts4merge.test fts4merge2.test fts4merge4.test fts4check.test
135 fts4merge5.test
136 fts3cov.test fts3snippet.test fts3corrupt2.test fts3an.test
137 fts3defer.test fts4langid.test fts3sort.test fts5unicode.test
138 recovercorrupt.test
139
140 rtree4.test
141 sessionbig.test
142
143 writecrash.test view3.test
144 fts5dlidx.test fts5ac.test fts4merge3.test fts5prefix.test
145 sessionB.test
146 }]
147 if {[info exists ::env(QUICKTEST_INCLUDE)]} {
148 set allquicktests [concat $allquicktests $::env(QUICKTEST_INCLUDE)]
149 }
150 if {[info exists ::env(QUICKTEST_OMIT)]} {
151 # If environment variable QUICKTEST_OMIT is set, it is a comma-separated
152 # list of regular expressions to match against test file names in
153 # the "allquicktests" set. Any matches are excluded. Only the filename
154 # is matched, not any directory component of the path.
155 set all [list]
156 foreach a $allquicktests {
157 set bIn 1
158 foreach x [split $::env(QUICKTEST_OMIT) ,] {
159 if {[regexp $x [file tail $a]]} {
160 set bIn 0
161 break
162 }
163 }
164 if {$bIn} {
165 lappend all $a
166 }
167 }
168 set allquicktests $all
169 }
170
171 # If the TEST_FAILURE environment variable is set, it means that we what to
172 # deliberately provoke test failures in order to test the test infrastructure.
173 # Only the main.test module is needed for this.
174 #
175 if {[info exists ::env(TEST_FAILURE)]} {
176 set allquicktests main.test
177 }
178
179 #############################################################################
180 # Start of tests
181 #
182
183 #-------------------------------------------------------------------------
184 # Define the generic test suites:
185 #
186 # veryquick
187 # quick
188 # full
189 #
190 lappend ::testsuitelist xxx
191
192 test_suite "veryquick" -prefix "" -description {
193 "Very" quick test suite. Runs in minutes on a workstation.
194 This test suite is the same as the "quick" tests, except that some files
195 that test malloc and IO errors are omitted.
196 } -files [
197 test_set $allquicktests -exclude *malloc* *ioerr* *fault* *bigfile* *_err* \
198 *fts5corrupt* *fts5big* *fts5aj* *rbucrash*
199 ]
200
201 test_suite "shell" -prefix "" -description {
202 Run tests of the command-line shell
203 } -files [
204 test_set [glob $testdir/shell*.test]
205 ]
206
207 test_suite "extraquick" -prefix "" -description {
208 "Extra" quick test suite. Runs in a few minutes on a workstation.
209 This test suite is the same as the "veryquick" tests, except that
210 slower tests are omitted.
211 } -files [
212 test_set $allquicktests -exclude *malloc* *ioerr* *fault* *bigfile* *_err* \
213 wal3.test fts4merge* sort2.test mmap1.test walcrash* \
214 percentile.test where8m.test walcksum.test savepoint3.test \
215 fuzzer1.test fuzzer3.test fts3expr3.test
216 ]
217
218 test_suite "mmap" -prefix "mm-" -description {
219 Similar to veryquick. Except with memory mapping enabled.
220 } -presql {
221 pragma mmap_size = 268435456;
222 } -files [
223 test_set $allquicktests -exclude *malloc* *ioerr* *fault* -include malloc.test
224 ]
225
226 test_suite "valgrind" -prefix "" -description {
227 Run the "veryquick" test suite with a couple of multi-process tests (that
228 fail under valgrind) omitted.
229 } -files [
230 test_set $allquicktests -exclude *malloc* *ioerr* *fault* *_err* wal.test \
231 shell2.test shell6.test shell7.test \
232 crash8.test atof1.test selectG.test \
233 tkt-fc62af4523.test numindex1.test corruptK.test
234 ] -initialize {
235 set ::G(valgrind) 1
236 } -shutdown {
237 unset -nocomplain ::G(valgrind)
238 }
239
240 test_suite "valgrind-nolookaside" -prefix "" -description {
241 Run the "veryquick" test suite with a couple of multi-process tests (that
242 fail under valgrind) omitted.
243 } -files [
244 test_set $allquicktests -exclude *malloc* *ioerr* *fault* *_err* \
245 wal.test atof1.test
246 ] -initialize {
247 set ::G(valgrind) 1
248 catch {db close}
249 sqlite3_shutdown
250 sqlite3_config_lookaside 0 0
251 sqlite3_initialize
252 autoinstall_test_functions
253 } -shutdown {
254 catch {db close}
255 sqlite3_shutdown
256 sqlite3_config_lookaside 100 500
257 sqlite3_initialize
258 autoinstall_test_functions
259 unset -nocomplain ::G(valgrind)
260 }
261
262
263 test_suite "quick" -prefix "" -description {
264 Quick test suite. Runs in around 10 minutes on a workstation.
265 } -files [
266 test_set $allquicktests
267 ]
268
269 test_suite "full" -prefix "" -description {
270 Full test suite. Takes a long time.
271 } -files [
272 test_set $alltests
273 ] -initialize {
274 unset -nocomplain ::G(isquick)
275 }
276
277 test_suite "threads" -prefix "" -description {
278 All multi-threaded tests.
279 } -files {
280 notify2.test thread001.test thread002.test thread003.test
281 thread004.test thread005.test walthread.test
282 }
283
284 test_suite "fts3" -prefix "" -description {
285 All FTS3 tests except fts3rnd.test.
286 } -files {
287 fts3aa.test fts3ab.test fts3ac.test fts3ad.test
288 fts3ae.test fts3af.test fts3ag.test fts3ah.test
289 fts3ai.test fts3aj.test fts3ak.test fts3al.test
290 fts3am.test fts3an.test fts3ao.test fts3atoken.test
291 fts3auto.test fts3aux1.test fts3aux2.test fts3b.test
292 fts3comp1.test fts3conf.test fts3corrupt2.test fts3corrupt.test
293 fts3corrupt4.test
294 fts3cov.test fts3c.test fts3defer2.test fts3defer3.test
295 fts3defer.test fts3drop.test fts3d.test fts3e.test
296 fts3expr2.test fts3expr3.test fts3expr4.test fts3expr5.test
297 fts3expr.test fts3fault2.test fts3fault.test fts3first.test
298 fts3join.test fts3malloc.test fts3matchinfo.test fts3near.test
299 fts3offsets.test fts3prefix2.test fts3prefix.test fts3query.test
300 fts3shared.test fts3snippet.test fts3sort.test fts3tok1.test
301 fts3tok_err.test fts3varint.test fts4aa.test fts4check.test
302 fts4content.test fts4docid.test fts4growth2.test fts4growth.test
303 fts4incr.test fts4langid.test fts4lastrowid.test fts4merge2.test
304 fts4merge4.test fts4merge.test fts4noti.test fts4onepass.test
305 fts4opt.test fts4unicode.test
306 fts3corrupt3.test
307 fts3misc.test
308 }
309
310 test_suite "fts5" -prefix "" -description {
311 All FTS5 tests.
312 } -files [glob -nocomplain $::testdir/../ext/fts5/test/*.test]
313
314 test_suite "fts5-light" -prefix "" -description {
315 All FTS5 tests.
316 } -files [
317 test_set \
318 [glob -nocomplain $::testdir/../ext/fts5/test/*.test] \
319 -exclude *corrupt* *fault* *big* *fts5aj*
320 ]
321
322 test_suite "window" -prefix "" -description {
323 All window function related tests .
324 } -files [
325 test_set [glob -nocomplain $::testdir/window*.test]
326 ]
327
328 test_suite "lsm1" -prefix "" -description {
329 All LSM1 tests.
330 } -files [glob -nocomplain $::testdir/../ext/lsm1/test/*.test]
331
332 test_suite "nofaultsim" -prefix "" -description {
333 "Very" quick test suite. Runs in less than 5 minutes on a workstation.
334 This test suite is the same as the "quick" tests, except that some files
335 that test malloc and IO errors are omitted.
336 } -files [
337 test_set $allquicktests -exclude *malloc* *ioerr* *fault* *_err*
338 ] -initialize {
339 catch {db close}
340 sqlite3_shutdown
341 install_malloc_faultsim 0
342 sqlite3_initialize
343 autoinstall_test_functions
344 } -shutdown {
345 unset -nocomplain ::G(valgrind)
346 }
347
348 test_suite "queryplanner" -prefix "" -description {
349 Tests of the query planner and query optimizer
350 } -files {
351 alter2.test alter3.test alter4.test alter.test analyze3.test
352 analyze4.test analyze5.test analyze6.test analyze7.test analyze8.test
353 analyze.test attach2.test attach3.test attach4.test
354 attach.test autoinc.test autoindex1.test between.test cast.test
355 check.test closure01.test coalesce.test collate1.test collate2.test
356 collate3.test collate4.test collate5.test collate6.test collate7.test
357 collate8.test collate9.test collateA.test colmeta.test colname.test
358 conflict.test count.test coveridxscan.test createtab.test cse.test
359 date.test dbstatus2.test dbstatus.test default.test delete2.test
360 delete3.test delete.test descidx1.test descidx2.test descidx3.test
361 distinctagg.test distinct.test e_createtable.test e_delete.test
362 e_droptrigger.test e_dropview.test e_expr.test e_insert.test
363 eqp.test e_reindex.test e_resolve.test e_select2.test e_select.test
364 e_update.test exists.test expr.test fkey1.test fkey2.test fkey3.test
365 fkey4.test fkey5.test func2.test func3.test func.test
366 in3.test in4.test in5.test index2.test index3.test
367 index4.test index5.test indexedby.test index.test
368 insert2.test insert3.test insert4.test insert5.test insert.test
369 instr.test in.test intpkey.test join2.test join3.test join4.test
370 join5.test join6.test join.test like2.test like.test limit.test
371 minmax2.test minmax3.test minmax4.test minmax.test misc1.test misc2.test
372 misc3.test misc4.test misc5.test misc6.test misc7.test orderby1.test
373 orderby2.test orderby3.test orderby4.test randexpr1.test regexp1.test
374 reindex.test rowhash.test rowid.test schema2.test schema3.test
375 schema4.test schema5.test schema.test
376 select1.test select2.test select3.test select4.test select5.test
377 select6.test select7.test select8.test select9.test selectA.test
378 selectB.test selectC.test selectD.test selectE.test sidedelete.test
379 sort.test spellfix.test subquery2.test subquery.test subselect.test
380 substr.test tkt-02a8e81d44.test tkt1435.test tkt1443.test tkt1444.test
381 tkt1449.test tkt1473.test tkt1501.test tkt1512.test tkt1514.test
382 tkt1536.test tkt1537.test tkt1567.test tkt1644.test tkt1667.test
383 tkt1873.test tkt2141.test tkt2192.test tkt2213.test tkt2251.test
384 tkt2285.test tkt2332.test tkt2339.test tkt2391.test tkt2409.test
385 tkt2450.test tkt2565.test tkt2640.test tkt2643.test tkt2686.test
386 tkt-26ff0c2d1e.test tkt2767.test tkt2817.test tkt2820.test tkt2822.test
387 tkt2832.test tkt2854.test tkt2920.test tkt2927.test tkt2942.test
388 tkt-2a5629202f.test tkt-2d1a5c67d.test tkt-2ea2425d34.test tkt3080.test
389 tkt3093.test tkt3121.test tkt-31338dca7e.test tkt-313723c356.test
390 tkt3201.test tkt3292.test tkt3298.test tkt3334.test tkt3346.test
391 tkt3357.test tkt3419.test tkt3424.test tkt3442.test tkt3457.test
392 tkt3461.test tkt3493.test tkt3508.test tkt3522.test tkt3527.test
393 tkt3541.test tkt3554.test tkt3581.test tkt35xx.test tkt3630.test
394 tkt3718.test tkt3731.test tkt3757.test tkt3761.test tkt3762.test
395 tkt3773.test tkt3791.test tkt3793.test tkt3810.test tkt3824.test
396 tkt3832.test tkt3838.test tkt3841.test tkt-385a5b56b9.test tkt3871.test
397 tkt3879.test tkt-38cb5df375.test tkt3911.test tkt3918.test tkt3922.test
398 tkt3929.test tkt3935.test tkt3992.test tkt3997.test tkt-3998683a16.test
399 tkt-3a77c9714e.test tkt-3fe897352e.test tkt4018.test tkt-4a03edc4c8.test
400 tkt-4dd95f6943.test tkt-54844eea3f.test tkt-5d863f876e.test
401 tkt-5e10420e8d.test tkt-5ee23731f.test tkt-6bfb98dfc0.test
402 tkt-752e1646fc.test tkt-78e04e52ea.test tkt-7a31705a7e6.test
403 tkt-7bbfb7d442.test tkt-80ba201079.test tkt-80e031a00f.test
404 tkt-8454a207b9.test tkt-91e2e8ba6f.test tkt-94c04eaadb.test
405 tkt-9d68c883.test tkt-a7b7803e.test tkt-b1d3a2e531.test
406 tkt-b351d95f9.test tkt-b72787b1.test tkt-bd484a090c.test
407 tkt-bdc6bbbb38.test tkt-c48d99d690.test tkt-cbd054fa6b.test
408 tkt-d11f09d36e.test tkt-d635236375.test tkt-d82e3f3721.test
409 tkt-f3e5abed55.test tkt-f777251dc7a.test tkt-f7b4edec.test
410 tkt-f973c7ac31.test tkt-fa7bf5ec.test tkt-fc62af4523.test
411 tkt-fc7bd6358f.test trigger1.test trigger2.test trigger3.test
412 trigger4.test trigger5.test trigger6.test trigger7.test trigger8.test
413 trigger9.test triggerA.test triggerB.test triggerC.test triggerD.test
414 types2.test types3.test types.test unique.test unordered.test
415 update.test view.test vtab1.test vtab2.test vtab3.test vtab4.test
416 vtab5.test vtab6.test vtab7.test vtab8.test vtab9.test vtab_alter.test
417 vtabA.test vtabB.test vtabC.test vtabD.test vtabE.test
418 vtabF.test where2.test where3.test where4.test where5.test where6.test
419 where7.test where8m.test where8.test where9.test whereA.test whereB.test
420 whereC.test whereD.test whereE.test whereF.test wherelimit.test
421 where.test
422 }
423
424 test_suite "vfslog" -prefix "" -description {
425 "Vfslog" quick test suite. Like "veryquick" except does not omits
426 a few tests that do not work with a version 1 VFS. And the quota* tests,
427 which do not work with a VFS that uses the pVfs argument passed to
428 sqlite3_vfs methods.
429 } -files [
430 test_set $allquicktests -exclude *malloc* *ioerr* *fault* oserror.test \
431 pager1.test syscall.test sysfault.test tkt3457.test quota* superlock* \
432 wal* mmap*
433 ]
434
435 test_suite "atomic-batch-write" -prefix "" -description {
436 Like veryquick.test, but must be run on a file-system that supports
437 atomic-batch-writes. Tests that depend on the journal file being present
438 are omitted.
439 } -files [
440 test_set $allquicktests -exclude *malloc* *ioerr* *fault* *bigfile* *_err* \
441 *fts5corrupt* *fts5big* *fts5aj* \
442 crash8.test delete_db.test \
443 exclusive.test journal3.test \
444 journal1.test \
445 jrnlmode.test jrnlmode2.test \
446 lock4.test pager1.test \
447 pager3.test sharedA.test \
448 symlink.test stmt.test \
449 sync.test sync2.test \
450 tempdb.test tkt3457.test \
451 vacuum5.test wal2.test \
452 walmode.test zerodamage.test
453 ] -initialize {
454 if {[atomic_batch_write test.db]==0} {
455 error "File system does NOT support atomic-batch-write"
456 }
457 }
458
459 lappend ::testsuitelist xxx
460 #-------------------------------------------------------------------------
461 # Define the coverage related test suites:
462 #
463 # coverage-wal
464 #
465 test_suite "coverage-wal" -description {
466 Coverage tests for file wal.c.
467 } -files {
468 wal.test wal2.test wal3.test wal4.test wal5.test
469 wal64k.test wal6.test wal7.test wal8.test wal9.test
470 walbak.test walbig.test walblock.test walcksum.test walcrash2.test
471 walcrash3.test walcrash4.test walcrash.test walfault.test walhook.test
472 walmode.test walnoshm.test waloverwrite.test walpersist.test
473 walprotocol2.test walprotocol.test walro2.test walrofault.test
474 walro.test walshared.test walslow.test walvfs.test
475 walfault2.test
476 nockpt.test
477
478 snapshot2.test snapshot3.test snapshot4.test
479 snapshot_fault.test snapshot.test snapshot_up.test
480 }
481
482 test_suite "coverage-pager" -description {
483 Coverage tests for file pager.c.
484 } -files {
485 pager1.test pager2.test pagerfault.test pagerfault2.test
486 walfault.test walbak.test journal2.test tkt-9d68c883.test
487 }
488
489 test_suite "coverage-analyze" -description {
490 Coverage tests for file analyze.c.
491 } -files {
492 analyze3.test analyze4.test analyze5.test analyze6.test
493 analyze7.test analyze8.test analyze9.test
494 analyze.test mallocA.test
495 }
496
497 test_suite "coverage-sorter" -description {
498 Coverage tests for file vdbesort.c.
499 } -files {
500 sort.test sortfault.test
501 }
502
503
504 lappend ::testsuitelist xxx
505 #-------------------------------------------------------------------------
506 # Define the permutation test suites:
507 #
508
509 # Run some tests using pre-allocated page blocks.
510 #
511 # mmap1.test is excluded because a good number of its tests depend on
512 # the page-cache being larger than the database. But this permutation
513 # causes the effective limit on the page-cache to be just 24 pages.
514 #
515 test_suite "memsubsys1" -description {
516 Tests using pre-allocated page blocks
517 } -files [
518 test_set $::allquicktests -exclude ioerr5.test malloc5.test mmap1.test
519 ] -initialize {
520 test_set_config_pagecache 4096 24
521 catch {db close}
522 sqlite3_shutdown
523 sqlite3_initialize
524 autoinstall_test_functions
525 } -shutdown {
526 test_restore_config_pagecache
527 catch {db close}
528 sqlite3_shutdown
529 sqlite3_initialize
530 autoinstall_test_functions
531 }
532
533 # Run some tests using pre-allocated page blocks. This time
534 # the allocations are too small to use in most cases.
535 #
536 # Both ioerr5.test and malloc5.test are excluded because they test the
537 # sqlite3_soft_heap_limit() and sqlite3_release_memory() functionality.
538 # This functionality is disabled if a pre-allocated page block is provided.
539 #
540 test_suite "memsubsys2" -description {
541 Tests using small pre-allocated page blocks
542 } -files [
543 test_set $::allquicktests -exclude ioerr5.test malloc5.test
544 ] -initialize {
545 test_set_config_pagecache 512 5
546 catch {db close}
547 sqlite3_shutdown
548 sqlite3_initialize
549 autoinstall_test_functions
550 } -shutdown {
551 test_restore_config_pagecache
552 catch {db close}
553 sqlite3_shutdown
554 sqlite3_initialize
555 autoinstall_test_functions
556 }
557
558 # Run all tests with the lookaside allocator disabled.
559 #
560 test_suite "nolookaside" -description {
561 OOM tests with lookaside disabled
562 } -initialize {
563 catch {db close}
564 sqlite3_shutdown
565 sqlite3_config_lookaside 0 0
566 sqlite3_initialize
567 autoinstall_test_functions
568 } -shutdown {
569 catch {db close}
570 sqlite3_shutdown
571 sqlite3_config_lookaside 100 500
572 sqlite3_initialize
573 autoinstall_test_functions
574 } -files $::allquicktests
575
576 # Run some tests in SQLITE_CONFIG_SINGLETHREAD mode.
577 #
578 test_suite "singlethread" -description {
579 Tests run in SQLITE_CONFIG_SINGLETHREAD mode
580 } -initialize {
581 catch {db close}
582 sqlite3_shutdown
583 catch {sqlite3_config singlethread}
584 sqlite3_initialize
585 autoinstall_test_functions
586 } -files {
587 delete.test delete2.test insert.test rollback.test select1.test
588 select2.test trans.test update.test vacuum.test types.test
589 types2.test types3.test
590 } -shutdown {
591 catch {db close}
592 sqlite3_shutdown
593 catch {sqlite3_config serialized}
594 sqlite3_initialize
595 autoinstall_test_functions
596 }
597
598 test_suite "nomutex" -description {
599 Tests run with the SQLITE_OPEN_MULTITHREADED flag passed to sqlite3_open().
600 } -initialize {
601 set ::G(perm:sqlite3_args) [list -fullmutex 0 -nomutex 1]
602 } -files {
603 delete.test delete2.test insert.test rollback.test select1.test
604 select2.test trans.test update.test vacuum.test types.test
605 types2.test types3.test
606 }
607
608 # Run some tests in SQLITE_CONFIG_MULTITHREAD mode.
609 #
610 test_suite "multithread" -description {
611 Tests run in SQLITE_CONFIG_MULTITHREAD mode
612 } -initialize {
613 catch {db close}
614 sqlite3_shutdown
615 catch {sqlite3_config multithread}
616 sqlite3_initialize
617 autoinstall_test_functions
618 } -files {
619 delete.test delete2.test insert.test rollback.test select1.test
620 select2.test trans.test update.test vacuum.test types.test
621 types2.test types3.test sort4.test
622 } -shutdown {
623 catch {db close}
624 sqlite3_shutdown
625 catch {sqlite3_config serialized}
626 sqlite3_initialize
627 autoinstall_test_functions
628 }
629
630 # Run some tests in SQLITE_OPEN_FULLMUTEX mode.
631 #
632 test_suite "fullmutex" -description {
633 Tests run in SQLITE_OPEN_FULLMUTEX mode
634 } -initialize {
635 set ::G(perm:sqlite3_args) [list -nomutex 0 -fullmutex 1]
636 } -files {
637 delete.test delete2.test insert.test rollback.test select1.test
638 select2.test trans.test update.test vacuum.test types.test
639 types2.test types3.test
640 }
641
642 # Run some tests using the "onefile" demo.
643 #
644 test_suite "onefile" -description {
645 Run some tests using the "test_onefile.c" demo
646 } -initialize {
647 set ::G(perm:sqlite3_args) [list -vfs fs]
648 } -files {
649 conflict.test insert.test insert2.test insert3.test
650 rollback.test select1.test select2.test select3.test
651 }
652
653 # Run some tests using UTF-16 databases.
654 #
655 test_suite "utf16" -description {
656 Run tests using UTF-16 databases
657 } -presql {
658 pragma encoding = 'UTF-16'
659 } -files {
660 alter.test alter3.test
661 analyze.test analyze3.test analyze4.test analyze5.test analyze6.test
662 analyze7.test analyze8.test analyze9.test
663 auth.test bind.test blob.test capi2.test capi3.test collate1.test
664 collate2.test collate3.test collate4.test collate5.test collate6.test
665 conflict.test date.test delete.test expr.test fkey1.test func.test
666 hook.test index.test insert2.test insert.test interrupt.test in.test
667 intpkey.test ioerr.test join2.test join.test lastinsert.test
668 laststmtchanges.test limit.test lock2.test lock.test main.test
669 memdb.test minmax.test misc1.test misc2.test misc3.test notnull.test
670 null.test progress.test quote.test rowid.test select1.test select2.test
671 select3.test select4.test select5.test select6.test sort.test
672 subselect.test tableapi.test table.test temptable.test
673 trace.test trigger1.test trigger2.test trigger3.test
674 trigger4.test types2.test types.test unique.test update.test
675 vacuum.test view.test where.test
676 bestindex1.test
677 }
678
679 # Run some tests in exclusive locking mode.
680 #
681 test_suite "exclusive" -description {
682 Run tests in exclusive locking mode.
683 } -presql {
684 pragma locking_mode = 'exclusive'
685 } -files {
686 rollback.test select1.test select2.test
687 malloc.test ioerr.test
688 }
689
690 # Run some tests in exclusive locking mode with truncated journals.
691 #
692 test_suite "exclusive-truncate" -description {
693 Run tests in exclusive locking mode and truncate journal mode.
694 } -presql {
695 pragma locking_mode = 'exclusive';
696 pragma journal_mode = TRUNCATE;
697 } -files {
698 delete.test delete2.test insert.test rollback.test select1.test
699 select2.test update.test malloc.test ioerr.test
700 }
701
702 # Run some tests in persistent journal mode.
703 #
704 test_suite "persistent_journal" -description {
705 Run tests in persistent-journal mode.
706 } -presql {
707 pragma journal_mode = persist
708 } -files {
709 delete.test delete2.test insert.test rollback.test select1.test
710 select2.test trans.test update.test vacuum.test
711 }
712
713 # Run some tests in truncating journal mode.
714 #
715 test_suite "truncate_journal" -description {
716 Run tests in persistent-journal mode.
717 } -presql {
718 pragma journal_mode = truncate
719 } -files {
720 delete.test delete2.test insert.test rollback.test select1.test
721 select2.test trans.test update.test vacuum.test
722 malloc.test ioerr.test
723 }
724
725 # Run some error tests in persistent journal mode.
726 #
727 test_suite "persistent_journal_error" -description {
728 Run malloc.test and ioerr.test in persistent-journal mode.
729 } -presql {
730 pragma journal_mode = persist
731 } -files {
732 malloc.test ioerr.test
733 }
734
735 # Run some tests in no journal mode.
736 #
737 test_suite "no_journal" -description {
738 Run tests in no-journal mode.
739 } -presql {
740 pragma journal_mode = persist
741 } -files {
742 delete.test delete2.test insert.test rollback.test select1.test
743 select2.test trans.test update.test vacuum.test
744 }
745
746 # Run some error tests in no journal mode.
747 #
748 test_suite "no_journal_error" -description {
749 Run malloc.test and ioerr.test in no-journal mode.
750 } -presql {
751 pragma journal_mode = persist
752 } -files {
753 malloc.test ioerr.test
754 }
755
756 # Run some crash-tests in autovacuum mode.
757 #
758 test_suite "autovacuum_crash" -description {
759 Run crash.test in autovacuum mode.
760 } -presql {
761 pragma auto_vacuum = 1
762 } -files crash.test
763
764 # Run some ioerr-tests in autovacuum mode.
765 #
766 test_suite "autovacuum_ioerr" -description {
767 Run ioerr.test in autovacuum mode.
768 } -presql {
769 pragma auto_vacuum = 1
770 } -files ioerr.test
771
772 # Run tests with an in-memory journal.
773 #
774 test_suite "inmemory_journal" -description {
775 Run tests with an in-memory journal file.
776 } -presql {
777 pragma journal_mode = 'memory'
778 } -files [test_set $::allquicktests -exclude {
779 # Exclude all tests that simulate IO errors.
780 autovacuum_ioerr2.test cffault.test incrvacuum_ioerr.test ioerr.test
781 ioerr.test ioerr2.test ioerr3.test ioerr4.test ioerr5.test
782 vacuum3.test incrblob_err.test diskfull.test backup_ioerr.test
783 e_fts3.test fts3cov.test fts3malloc.test fts3rnd.test
784 fts3snippet.test mmapfault.test sessionfault.test sessionfault2.test
785
786 # Exclude test scripts that use tcl IO to access journal files or count
787 # the number of fsync() calls.
788 pager.test exclusive.test jrnlmode.test sync.test misc1.test
789 journal1.test conflict.test crash8.test tkt3457.test io.test
790 journal3.test 8_3_names.test shmlock.test
791 pendingrace.test
792
793 pager1.test corrupt.test filefmt.test pager2.test
794 corrupt5.test corruptA.test pageropt.test
795
796 # Exclude stmt.test, which expects sub-journals to use temporary files.
797 stmt.test symlink.test
798
799 zerodamage.test
800
801 # WAL mode is different.
802 wal* tkt-2d1a5c67d.test backcompat.test e_wal* rowallock.test
803
804 # This test does not work as the "PRAGMA journal_mode = memory"
805 # statement switches the database out of wal mode at inopportune
806 # times.
807 snapshot_fault.test
808
809 # This test assumes a journal file is created on disk.
810 delete_db.test
811
812 # This test depends on a successful recovery from the pager error
813 # state. Which is not possible with an in-memory journal
814 fts5fault1.test
815
816 recoverpgsz.test
817 }]
818
819 test_suite "memsys3" -description {
820 Run tests using the allocator in mem3.c.
821 } -files [test_set $::allquicktests -exclude {
822 autovacuum.test delete3.test manydb.test
823 bigrow.test incrblob2.test memdb.test
824 bitvec.test index2.test memsubsys1.test
825 capi3c.test ioerr.test memsubsys2.test
826 capi3.test join3.test pagesize.test
827 collate5.test limit.test backup_ioerr.test
828 backup_malloc.test
829 }] -initialize {
830 catch {db close}
831 sqlite3_reset_auto_extension
832 sqlite3_shutdown
833 sqlite3_config_heap 25000000 0
834 sqlite3_config_lookaside 0 0
835 ifcapable mem5 {
836 # If both memsys3 and memsys5 are enabled in the build, the call to
837 # [sqlite3_config_heap] will initialize the system to use memsys5.
838 # The following overrides this preference and installs the memsys3
839 # allocator.
840 sqlite3_install_memsys3
841 }
842 install_malloc_faultsim 1
843 sqlite3_initialize
844 autoinstall_test_functions
845 } -shutdown {
846 catch {db close}
847 sqlite3_shutdown
848 sqlite3_config_heap 0 0
849 sqlite3_config_lookaside 100 500
850 install_malloc_faultsim 1
851 sqlite3_initialize
852 autoinstall_test_functions
853 }
854
855 test_suite "memsys5" -description {
856 Run tests using the allocator in mem5.c.
857 } -files [test_set $::allquicktests -exclude {
858 autovacuum.test delete3.test manydb.test
859 bigrow.test incrblob2.test memdb.test
860 bitvec.test index2.test memsubsys1.test
861 capi3c.test ioerr.test memsubsys2.test
862 capi3.test join3.test pagesize.test
863 collate5.test limit.test zeroblob.test
864 }] -initialize {
865 catch {db close}
866 sqlite3_shutdown
867 sqlite3_config_heap 25000000 64
868 sqlite3_config_lookaside 0 0
869 install_malloc_faultsim 1
870 sqlite3_initialize
871 autoinstall_test_functions
872 } -shutdown {
873 catch {db close}
874 sqlite3_shutdown
875 sqlite3_config_heap 0 0
876 sqlite3_config_lookaside 100 500
877 install_malloc_faultsim 1
878 sqlite3_initialize
879 autoinstall_test_functions
880 }
881
882 test_suite "memsys5-2" -description {
883 Run tests using the allocator in mem5.c in a different configuration.
884 } -files {
885 select1.test
886 } -initialize {
887 catch {db close}
888 sqlite3_shutdown
889 sqlite3_config_memstatus 0
890 sqlite3_config_heap 40000000 16
891 sqlite3_config_lookaside 0 0
892 install_malloc_faultsim 1
893 sqlite3_initialize
894 autoinstall_test_functions
895 } -shutdown {
896 catch {db close}
897 sqlite3_shutdown
898 sqlite3_config_heap 0 0
899 sqlite3_config_lookaside 100 500
900 install_malloc_faultsim 1
901 sqlite3_initialize
902 autoinstall_test_functions
903 }
904
905 test_suite "no_mutex_try" -description {
906 The sqlite3_mutex_try() interface always fails
907 } -files [
908 test_set $::allquicktests -exclude mutex1.test mutex2.test
909 ] -initialize {
910 catch {db close}
911 sqlite3_shutdown
912 install_mutex_counters 1
913 set ::disable_mutex_try 1
914 sqlite3_initialize
915 autoinstall_test_functions
916 } -shutdown {
917 catch {db close}
918 catch {db2 close}
919 catch {db3 close}
920 sqlite3_shutdown
921 install_mutex_counters 0
922 sqlite3_initialize
923 autoinstall_test_functions
924 }
925
926 # run_tests "crash_safe_append" -description {
927 # Run crash.test with persistent journals on a SAFE_APPEND file-system.
928 # } -initialize {
929 # rename crashsql sa_crashsql
930 # proc crashsql {args} {
931 # set options [lrange $args 0 [expr {[llength $args]-2}]]
932 # lappend options -char safe_append
933 # set sql [lindex $args end]
934 # lappend options "
935 # PRAGMA journal_mode=persistent;
936 # $sql
937 # "
938 # set fd [open test.db-journal w]
939 # puts $fd [string repeat 1234567890 100000]
940 # close $fd
941 # eval sa_crashsql $options
942 # }
943 # } -shutdown {
944 # rename crashsql {}
945 # rename sa_crashsql crashsql
946 # } -files crash.test
947
948 test_suite "safe_append" -description {
949 Run some tests on a SAFE_APPEND file-system.
950 } -initialize {
951 set ::G(perm:sqlite3_args) [list -vfs devsym]
952 sqlite3_simulate_device -char safe_append
953 } -files [
954 test_set $::allquicktests shared_err.test
955 ]
956
957 # The set of tests to run on the alternative-pcache
958 set perm-alt-pcache-testset {
959 attach.test
960 delete.test delete2.test
961 index.test
962 insert.test insert2.test
963 join.test join2.test
964 rollback.test
965 select1.test select2.test
966 trans.test
967 update.test
968 }
969
970 foreach discard_rate {0 10 50 90 100} {
971 test_suite "pcache${discard_rate}" -description "
972 Alternative pcache implementation with ${discard_rate}% random discard
973 " -initialize "
974 catch {db close}
975 sqlite3_shutdown
976 sqlite3_config_alt_pcache 1 $discard_rate 1
977 sqlite3_initialize
978 autoinstall_test_functions
979 " -shutdown {
980 catch {db close}
981 sqlite3_shutdown
982 sqlite3_config_alt_pcache 0 0 0
983 sqlite3_config_lookaside 100 500
984 install_malloc_faultsim 1
985 sqlite3_initialize
986 autoinstall_test_functions
987 } -files ${perm-alt-pcache-testset}
988 }
989
990 test_suite "journaltest" -description {
991 Check that pages are synced before being written (test_journal.c).
992 } -initialize {
993 catch {db close}
994 register_jt_vfs -default ""
995 } -shutdown {
996 unregister_jt_vfs
997 } -files [test_set $::allquicktests -exclude {
998 wal* incrvacuum.test ioerr.test corrupt4.test io.test crash8.test
999 bigfile.test backcompat.test e_wal* fstat.test mmap2.test
1000 pager1.test syscall.test tkt3457.test *malloc* mmap* multiplex* nolock*
1001 pager2.test *fault* rowal* snapshot* superlock* symlink.test
1002 delete_db.test shmlock.test chunksize.test
1003 busy2.test avfs.test external_reader.test
1004 }]
1005
1006 if {[info commands register_demovfs] != ""} {
1007 test_suite "demovfs" -description {
1008 Check that the demovfs (code in test_demovfs.c) more or less works.
1009 } -initialize {
1010 register_demovfs
1011 } -shutdown {
1012 unregister_demovfs
1013 } -files {
1014 insert.test insert2.test insert3.test rollback.test
1015 select1.test select2.test select3.test
1016 }
1017 }
1018
1019 test_suite "wal" -description {
1020 Run tests with journal_mode=WAL
1021 } -initialize {
1022 set ::G(savepoint6_iterations) 100
1023 } -shutdown {
1024 unset -nocomplain ::G(savepoint6_iterations)
1025 } -files {
1026 savepoint.test savepoint2.test savepoint6.test
1027 trans.test avtrans.test
1028
1029 fts3aa.test fts3ab.test fts3ac.test fts3ad.test
1030 fts3ae.test fts3af.test fts3ag.test fts3ah.test
1031 fts3ai.test fts3aj.test fts3ak.test fts3al.test
1032 fts3am.test fts3an.test fts3ao.test fts3b.test
1033 fts3c.test fts3d.test fts3e.test fts3query.test
1034 }
1035
1036 test_suite "rtree" -description {
1037 All R-tree related tests. Provides coverage of source file rtree.c.
1038 } -files [glob -nocomplain $::testdir/../ext/rtree/*.test]
1039
1040 test_suite "session" -description {
1041 All session module related tests.
1042 } -files [glob -nocomplain $::testdir/../ext/session/*.test]
1043
1044 test_suite "session_eec" -description {
1045 All session module related tests with sqlite3_extended_result_codes() set.
1046 } -files [
1047 glob -nocomplain $::testdir/../ext/session/*.test
1048 ] -dbconfig {
1049 sqlite3_extended_result_codes $::dbhandle 1
1050 }
1051
1052 test_suite "session_strm" -description {
1053 All session module related tests using the streaming APIs.
1054 } -files [
1055 glob -nocomplain $::testdir/../ext/session/*.test
1056 ] -dbconfig {
1057 set ::sqlite3session_streams 1
1058 }
1059
1060 test_suite "rbu" -description {
1061 RBU tests.
1062 } -files [
1063 test_set [glob -nocomplain $::testdir/../ext/rbu/*.test]
1064 ]
1065
1066 test_suite "no_optimization" -description {
1067 Run test scripts with optimizations disabled using the
1068 sqlite3_test_control(SQLITE_TESTCTRL_OPTIMIZATIONS) interface.
1069 } -files [
1070 test_set \
1071 [glob -nocomplain $::testdir/window*.test] \
1072 where.test where2.test where3.test where4.test where5.test \
1073 where6.test where7.test where8.test where9.test \
1074 whereA.test whereB.test wherelimit.test \
1075 select1.test select2.test select3.test select4.test select5.test \
1076 select7.test select8.test selectA.test selectC.test \
1077 -exclude windowpushd.test
1078 ] -dbconfig {
1079 optimization_control $::dbhandle all 0
1080 }
1081
1082 test_suite "prepare" -description {
1083 Run tests with the db connection using sqlite3_prepare() instead of _v2().
1084 } -dbconfig {
1085 $::dbhandle version -use-legacy-prepare 1
1086 #$::dbhandle cache size 0
1087 } -files [
1088 test_set $allquicktests -exclude *malloc* *ioerr* *fault* \
1089 stmtvtab1.test index9.test
1090 ]
1091
1092 test_suite "sorterref" -prefix "" -description {
1093 Run the "veryquick" test suite with SQLITE_CONFIG_SORTERREF_SIZE set
1094 to 0 so that sorter-references are used whenever possible.
1095 } -files [
1096 test_set $allquicktests -exclude *malloc* *ioerr* *fault* *bigfile* *_err* \
1097 *fts5corrupt* *fts5big* *fts5aj*
1098 ] -initialize {
1099 catch {db close}
1100 sqlite3_shutdown
1101 sqlite3_config_sorterref 0
1102 sqlite3_initialize
1103 autoinstall_test_functions
1104 } -shutdown {
1105 catch {db close}
1106 sqlite3_shutdown
1107 sqlite3_config_sorterref -1
1108 sqlite3_initialize
1109 autoinstall_test_functions
1110 }
1111
1112 test_suite "maindbname" -prefix "" -description {
1113 Run the "veryquick" test suite with SQLITE_DBCONFIG_MAINDBNAME used to
1114 set the name of database 0 to "icecube".
1115 } -files [
1116 test_set $allquicktests -exclude *malloc* *ioerr* *fault* *bigfile* *_err* \
1117 *fts5corrupt* *fts5big* *fts5aj*
1118 ] -dbconfig {
1119 dbconfig_maindbname_icecube $::dbhandle
1120 }
1121
1122 test_suite "win_unc_locking" -prefix "" -description {
1123 Run the "wal*" tests with UNC style single fd locking.
1124 } -files [
1125 test_set \
1126 {*}[glob [file join $testdir wal*]] \
1127 -exclude *fault* *malloc* *crash* *slow* walsetlk.test
1128 ] -initialize {
1129 set sqlite3_win_test_unc_locking 1
1130 } -shutdown {
1131 set sqlite3_win_test_unc_locking 0
1132 }
1133
1134 # End of tests
1135 #############################################################################
1136
1137 # run_tests NAME OPTIONS
1138 #
1139 # where available options are:
1140 #
1141 # -description TITLE
1142 # -initialize SCRIPT
1143 # -shutdown SCRIPT
1144 # -files LIST-OF-FILES
1145 # -prefix NAME
1146 # -dbconfig SCRIPT
1147 #
1148 proc run_tests {name args} {
1149 set options(-initialize) ""
1150 set options(-shutdown) ""
1151 set options(-prefix) ""
1152 set options(-dbconfig) ""
1153 set options(-presql) ""
1154
1155 array set options $args
1156
1157 set ::G(perm:name) $name
1158 set ::G(perm:prefix) $options(-prefix)
1159 set ::G(isquick) 1
1160 set ::G(perm:dbconfig) $options(-dbconfig)
1161 set ::G(perm:presql) $options(-presql)
1162
1163 set filelist [lsort $options(-files)]
1164 if {[info exists ::env(TCLTEST_PART)]} {
1165 regexp {^([0-9]*)/([0-9]*)$} $::env(TCLTEST_PART) -> A B
1166 set nFile [expr {([llength $filelist]+$B-1)/$B}]
1167 set filelist [lrange $filelist [expr ($A-1)*$nFile] [expr $A*$nFile-1]]
1168 }
1169
1170 foreach file $filelist {
1171 if {[file tail $file] == $file} { set file [file join $::testdir $file] }
1172
1173 if {[info exists ::env(SQLITE_TEST_PATTERN_LIST)]} {
1174 set ok 0
1175 foreach p $::env(SQLITE_TEST_PATTERN_LIST) {
1176 set p [string map {% *} $p]
1177 if {[string match $p [file tail $file]]} {set ok 1 ; break}
1178 }
1179 if {!$ok} continue
1180 }
1181
1182 uplevel $options(-initialize)
1183 slave_test_file $file
1184 uplevel $options(-shutdown)
1185 unset -nocomplain ::G(perm:sqlite3_args)
1186 }
1187
1188 unset ::G(perm:name)
1189 unset ::G(perm:prefix)
1190 unset ::G(perm:dbconfig)
1191 unset ::G(perm:presql)
1192 }
1193
1194 proc run_test_suite {name} {
1195 if {[info exists ::testspec($name)]==0} {
1196 error "No such test suite: $name"
1197 }
1198 uplevel run_tests $name $::testspec($name)
1199 }
1200
1201 proc help {} {
1202 puts "Usage: $::argv0 TESTSUITE ?TESTFILE?"
1203 puts ""
1204 puts "Available test-suites are:"
1205
1206 set iPos 0
1207 foreach k $::testsuitelist {
1208 if {[info exists ::testspec($k)]} {
1209 switch $iPos {
1210 0 {
1211 puts ""
1212 puts -nonewline " [format %-30s $k]"
1213 }
1214
1215 1 {
1216 puts -nonewline [format %-30s $k]
1217 }
1218
1219 2 {
1220 puts -nonewline $k
1221 }
1222 }
1223
1224 set iPos [expr (($iPos+1) % 3)]
1225 }
1226 }
1227 puts ""
1228 exit -1
1229 }
1230
1231 if {[file tail $argv0] == "permutations.test"} {
1232 proc main {argv} {
1233 if {[llength $argv]==0} {
1234 help
1235 } else {
1236
1237 # See if the first argument is a named test-suite.
1238 #
1239 set suite [file tail [lindex $argv 0]]
1240 if {[info exists ::testspec($suite)]} {
1241 set S $::testspec($suite)
1242 set i 1
1243 } else {
1244 set suite default
1245 set S [list]
1246 set i 0
1247 }
1248
1249 set extra ""
1250 if {$i < [llength $argv] && [string range [lindex $argv $i] 0 0]!="-" } {
1251 set files [list]
1252 for {} {$i < [llength $argv]} {incr i} {
1253 set pattern [string map {% *} [lindex $argv $i]]
1254 if {[string range $pattern 0 0]=="-"} break
1255 foreach f $::alltests {
1256 set tail [file tail $f]
1257 if {[lsearch $files $f]<0 && [string match $pattern $tail]} {
1258 lappend files $f
1259 }
1260 }
1261 }
1262 set extra [list -files $files]
1263 }
1264
1265 eval [list run_tests $suite] $S $extra
1266 }
1267 }
1268 main $argv
1269 set argv {}
1270 finish_test
1271 }