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