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