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