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