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