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