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