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