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