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 $testdir/../ext/rtree/*.test] { 90 lappend alltests $f 91} 92 93if {$::tcl_platform(platform)!="unix"} { 94 set alltests [test_set $alltests -exclude crash.test crash2.test] 95} 96set alltests [test_set $alltests -exclude { 97 all.test async.test quick.test veryquick.test 98 memleak.test permutations.test soak.test fts3.test 99 mallocAll.test rtree.test full.test 100}] 101 102set allquicktests [test_set $alltests -exclude { 103 async2.test async3.test backup_ioerr.test corrupt.test 104 corruptC.test crash.test crash2.test crash3.test crash4.test crash5.test 105 crash6.test crash7.test delete3.test e_fts3.test fts3rnd.test 106 fkey_malloc.test fuzz.test fuzz3.test fuzz_malloc.test in2.test loadext.test 107 misc7.test mutex2.test notify2.test onefile.test pagerfault2.test 108 savepoint4.test savepoint6.test select9.test 109 speed1.test speed1p.test speed2.test speed3.test speed4.test 110 speed4p.test sqllimits1.test tkt2686.test thread001.test thread002.test 111 thread003.test thread004.test thread005.test trans2.test vacuum3.test 112 incrvacuum_ioerr.test autovacuum_crash.test btree8.test shared_err.test 113 vtab_err.test walslow.test walcrash.test walcrash3.test 114 walthread.test rtree3.test indexfault.test securedel2.test 115}] 116if {[info exists ::env(QUICKTEST_INCLUDE)]} { 117 set allquicktests [concat $allquicktests $::env(QUICKTEST_INCLUDE)] 118} 119 120############################################################################# 121# Start of tests 122# 123 124#------------------------------------------------------------------------- 125# Define the generic test suites: 126# 127# veryquick 128# quick 129# full 130# 131lappend ::testsuitelist xxx 132 133test_suite "veryquick" -prefix "" -description { 134 "Very" quick test suite. Runs in less than 5 minutes on a workstation. 135 This test suite is the same as the "quick" tests, except that some files 136 that test malloc and IO errors are omitted. 137} -files [ 138 test_set $allquicktests -exclude *malloc* *ioerr* *fault* 139] 140 141test_suite "mmap" -prefix "mm-" -description { 142 Similar to veryquick. Except with memory mapping disabled. 143} -presql { 144 pragma mmap_size = 268435456; 145} -files [ 146 test_set $allquicktests -exclude *malloc* *ioerr* *fault* -include malloc.test 147] 148 149test_suite "valgrind" -prefix "" -description { 150 Run the "veryquick" test suite with a couple of multi-process tests (that 151 fail under valgrind) omitted. 152} -files [ 153 test_set $allquicktests -exclude *malloc* *ioerr* *fault* wal.test atof1.test 154] -initialize { 155 set ::G(valgrind) 1 156} -shutdown { 157 unset -nocomplain ::G(valgrind) 158} 159 160test_suite "quick" -prefix "" -description { 161 Quick test suite. Runs in around 10 minutes on a workstation. 162} -files [ 163 test_set $allquicktests 164] 165 166test_suite "full" -prefix "" -description { 167 Full test suite. Takes a long time. 168} -files [ 169 test_set $alltests 170] -initialize { 171 unset -nocomplain ::G(isquick) 172} 173 174test_suite "threads" -prefix "" -description { 175 All multi-threaded tests. 176} -files { 177 notify2.test thread001.test thread002.test thread003.test 178 thread004.test thread005.test walthread.test 179} 180 181test_suite "fts3" -prefix "" -description { 182 All FTS3 tests except fts3rnd.test. 183} -files { 184 fts3aa.test fts3ab.test fts3ac.test fts3ad.test fts3ae.test 185 fts3af.test fts3ag.test fts3ah.test fts3ai.test fts3aj.test 186 fts3ak.test fts3al.test fts3am.test fts3an.test fts3ao.test 187 fts3atoken.test fts3b.test fts3c.test fts3cov.test fts3d.test 188 fts3defer.test fts3defer2.test fts3e.test fts3expr.test fts3expr2.test 189 fts3near.test fts3query.test fts3shared.test fts3snippet.test 190 fts3sort.test 191 fts3fault.test fts3malloc.test fts3matchinfo.test 192 fts3aux1.test fts3comp1.test fts3auto.test 193 fts4aa.test fts4content.test 194 fts3conf.test fts3prefix.test fts3fault2.test fts3corrupt.test 195 fts3corrupt2.test fts3first.test fts4langid.test fts4merge.test 196 fts4check.test fts4unicode.test 197} 198 199test_suite "nofaultsim" -prefix "" -description { 200 "Very" quick test suite. Runs in less than 5 minutes on a workstation. 201 This test suite is the same as the "quick" tests, except that some files 202 that test malloc and IO errors are omitted. 203} -files [ 204 test_set $allquicktests -exclude *malloc* *ioerr* *fault* 205] -initialize { 206 catch {db close} 207 sqlite3_shutdown 208 install_malloc_faultsim 0 209 sqlite3_initialize 210 autoinstall_test_functions 211} -shutdown { 212 unset -nocomplain ::G(valgrind) 213} 214 215lappend ::testsuitelist xxx 216#------------------------------------------------------------------------- 217# Define the coverage related test suites: 218# 219# coverage-wal 220# 221test_suite "coverage-wal" -description { 222 Coverage tests for file wal.c. 223} -files { 224 wal.test wal2.test wal3.test walmode.test 225 walbak.test walhook.test walcrash2.test walcksum.test 226 walfault.test walbig.test walnoshm.test 227 wal5.test 228} 229 230test_suite "coverage-pager" -description { 231 Coverage tests for file pager.c. 232} -files { 233 pager1.test pager2.test pagerfault.test pagerfault2.test 234 walfault.test walbak.test journal2.test tkt-9d68c883.test 235} 236 237 238lappend ::testsuitelist xxx 239#------------------------------------------------------------------------- 240# Define the permutation test suites: 241# 242 243# Run some tests using pre-allocated page and scratch blocks. 244# 245test_suite "memsubsys1" -description { 246 Tests using pre-allocated page and scratch blocks 247} -files [ 248 test_set $::allquicktests -exclude ioerr5.test malloc5.test 249] -initialize { 250 catch {db close} 251 sqlite3_shutdown 252 sqlite3_config_pagecache 4096 24 253 sqlite3_config_scratch 25000 1 254 sqlite3_initialize 255 autoinstall_test_functions 256} -shutdown { 257 catch {db close} 258 sqlite3_shutdown 259 sqlite3_config_pagecache 0 0 260 sqlite3_config_scratch 0 0 261 sqlite3_initialize 262 autoinstall_test_functions 263} 264 265# Run some tests using pre-allocated page and scratch blocks. This time 266# the allocations are too small to use in most cases. 267# 268# Both ioerr5.test and malloc5.test are excluded because they test the 269# sqlite3_soft_heap_limit() and sqlite3_release_memory() functionality. 270# This functionality is disabled if a pre-allocated page block is provided. 271# 272test_suite "memsubsys2" -description { 273 Tests using small pre-allocated page and scratch blocks 274} -files [ 275 test_set $::allquicktests -exclude ioerr5.test malloc5.test 276] -initialize { 277 catch {db close} 278 sqlite3_shutdown 279 sqlite3_config_pagecache 512 5 280 sqlite3_config_scratch 1000 1 281 sqlite3_initialize 282 autoinstall_test_functions 283} -shutdown { 284 catch {db close} 285 sqlite3_shutdown 286 sqlite3_config_pagecache 0 0 287 sqlite3_config_scratch 0 0 288 sqlite3_initialize 289 autoinstall_test_functions 290} 291 292# Run all tests with the lookaside allocator disabled. 293# 294test_suite "nolookaside" -description { 295 OOM tests with lookaside disabled 296} -initialize { 297 catch {db close} 298 sqlite3_shutdown 299 sqlite3_config_lookaside 0 0 300 sqlite3_initialize 301 autoinstall_test_functions 302} -shutdown { 303 catch {db close} 304 sqlite3_shutdown 305 sqlite3_config_lookaside 100 500 306 sqlite3_initialize 307 autoinstall_test_functions 308} -files $::allquicktests 309 310# Run some tests in SQLITE_CONFIG_SINGLETHREAD mode. 311# 312test_suite "singlethread" -description { 313 Tests run in SQLITE_CONFIG_SINGLETHREAD mode 314} -initialize { 315 catch {db close} 316 sqlite3_shutdown 317 catch {sqlite3_config singlethread} 318 sqlite3_initialize 319 autoinstall_test_functions 320} -files { 321 delete.test delete2.test insert.test rollback.test select1.test 322 select2.test trans.test update.test vacuum.test types.test 323 types2.test types3.test 324} -shutdown { 325 catch {db close} 326 sqlite3_shutdown 327 catch {sqlite3_config serialized} 328 sqlite3_initialize 329 autoinstall_test_functions 330} 331 332test_suite "nomutex" -description { 333 Tests run with the SQLITE_OPEN_MULTITHREADED flag passed to sqlite3_open(). 334} -initialize { 335 rename sqlite3 sqlite3_nomutex 336 proc sqlite3 {args} { 337 if {[string range [lindex $args 0] 0 0] ne "-"} { 338 lappend args -fullmutex 0 -nomutex 1 339 } 340 uplevel [concat sqlite3_nomutex $args] 341 } 342} -files { 343 delete.test delete2.test insert.test rollback.test select1.test 344 select2.test trans.test update.test vacuum.test types.test 345 types2.test types3.test 346} -shutdown { 347 rename sqlite3 {} 348 rename sqlite3_nomutex sqlite3 349} 350 351# Run some tests in SQLITE_CONFIG_MULTITHREAD mode. 352# 353test_suite "multithread" -description { 354 Tests run in SQLITE_CONFIG_MULTITHREAD mode 355} -initialize { 356 catch {db close} 357 sqlite3_shutdown 358 catch {sqlite3_config multithread} 359 sqlite3_initialize 360 autoinstall_test_functions 361} -files { 362 delete.test delete2.test insert.test rollback.test select1.test 363 select2.test trans.test update.test vacuum.test types.test 364 types2.test types3.test 365} -shutdown { 366 catch {db close} 367 sqlite3_shutdown 368 catch {sqlite3_config serialized} 369 sqlite3_initialize 370 autoinstall_test_functions 371} 372 373# Run some tests in SQLITE_OPEN_FULLMUTEX mode. 374# 375test_suite "fullmutex" -description { 376 Tests run in SQLITE_OPEN_FULLMUTEX mode 377} -initialize { 378 rename sqlite3 sqlite3_fullmutex 379 proc sqlite3 {args} { 380 if {[string range [lindex $args 0] 0 0] ne "-"} { 381 lappend args -nomutex 0 -fullmutex 1 382 } 383 uplevel [concat sqlite3_fullmutex $args] 384 } 385} -files { 386 delete.test delete2.test insert.test rollback.test select1.test 387 select2.test trans.test update.test vacuum.test types.test 388 types2.test types3.test 389} -shutdown { 390 rename sqlite3 {} 391 rename sqlite3_fullmutex sqlite3 392} 393 394# Run some tests using the "onefile" demo. 395# 396test_suite "onefile" -description { 397 Run some tests using the "test_onefile.c" demo 398} -initialize { 399 rename sqlite3 sqlite3_onefile 400 proc sqlite3 {args} { 401 if {[string range [lindex $args 0] 0 0] ne "-"} { 402 lappend args -vfs fs 403 } 404 uplevel [concat sqlite3_onefile $args] 405 } 406} -files { 407 conflict.test insert.test insert2.test insert3.test 408 rollback.test select1.test select2.test select3.test 409} -shutdown { 410 rename sqlite3 {} 411 rename sqlite3_onefile sqlite3 412} 413 414# Run some tests using UTF-16 databases. 415# 416test_suite "utf16" -description { 417 Run tests using UTF-16 databases 418} -presql { 419 pragma encoding = 'UTF-16' 420} -files { 421 alter.test alter3.test 422 auth.test bind.test blob.test capi2.test capi3.test collate1.test 423 collate2.test collate3.test collate4.test collate5.test collate6.test 424 conflict.test date.test delete.test expr.test fkey1.test func.test 425 hook.test index.test insert2.test insert.test interrupt.test in.test 426 intpkey.test ioerr.test join2.test join.test lastinsert.test 427 laststmtchanges.test limit.test lock2.test lock.test main.test 428 memdb.test minmax.test misc1.test misc2.test misc3.test notnull.test 429 null.test progress.test quote.test rowid.test select1.test select2.test 430 select3.test select4.test select5.test select6.test sort.test 431 subselect.test tableapi.test table.test temptable.test 432 trace.test trigger1.test trigger2.test trigger3.test 433 trigger4.test types2.test types.test unique.test update.test 434 vacuum.test view.test where.test 435} 436 437# Run some tests in exclusive locking mode. 438# 439test_suite "exclusive" -description { 440 Run tests in exclusive locking mode. 441} -presql { 442 pragma locking_mode = 'exclusive' 443} -files { 444 rollback.test select1.test select2.test 445 malloc.test ioerr.test 446} 447 448# Run some tests in exclusive locking mode with truncated journals. 449# 450test_suite "exclusive-truncate" -description { 451 Run tests in exclusive locking mode and truncate journal mode. 452} -presql { 453 pragma locking_mode = 'exclusive'; 454 pragma journal_mode = TRUNCATE; 455} -files { 456 delete.test delete2.test insert.test rollback.test select1.test 457 select2.test update.test malloc.test ioerr.test 458} 459 460# Run some tests in persistent journal mode. 461# 462test_suite "persistent_journal" -description { 463 Run tests in persistent-journal mode. 464} -presql { 465 pragma journal_mode = persist 466} -files { 467 delete.test delete2.test insert.test rollback.test select1.test 468 select2.test trans.test update.test vacuum.test 469} 470 471# Run some tests in truncating journal mode. 472# 473test_suite "truncate_journal" -description { 474 Run tests in persistent-journal mode. 475} -presql { 476 pragma journal_mode = truncate 477} -files { 478 delete.test delete2.test insert.test rollback.test select1.test 479 select2.test trans.test update.test vacuum.test 480 malloc.test ioerr.test 481} 482 483# Run some error tests in persistent journal mode. 484# 485test_suite "persistent_journal_error" -description { 486 Run malloc.test and ioerr.test in persistent-journal mode. 487} -presql { 488 pragma journal_mode = persist 489} -files { 490 malloc.test ioerr.test 491} 492 493# Run some tests in no journal mode. 494# 495test_suite "no_journal" -description { 496 Run tests in no-journal mode. 497} -presql { 498 pragma journal_mode = persist 499} -files { 500 delete.test delete2.test insert.test rollback.test select1.test 501 select2.test trans.test update.test vacuum.test 502} 503 504# Run some error tests in no journal mode. 505# 506test_suite "no_journal_error" -description { 507 Run malloc.test and ioerr.test in no-journal mode. 508} -presql { 509 pragma journal_mode = persist 510} -files { 511 malloc.test ioerr.test 512} 513 514# Run some crash-tests in autovacuum mode. 515# 516test_suite "autovacuum_crash" -description { 517 Run crash.test in autovacuum mode. 518} -presql { 519 pragma auto_vacuum = 1 520} -files crash.test 521 522# Run some ioerr-tests in autovacuum mode. 523# 524test_suite "autovacuum_ioerr" -description { 525 Run ioerr.test in autovacuum mode. 526} -presql { 527 pragma auto_vacuum = 1 528} -files ioerr.test 529 530# Run tests with an in-memory journal. 531# 532test_suite "inmemory_journal" -description { 533 Run tests with an in-memory journal file. 534} -presql { 535 pragma journal_mode = 'memory' 536} -files [test_set $::allquicktests -exclude { 537 # Exclude all tests that simulate IO errors. 538 autovacuum_ioerr2.test incrvacuum_ioerr.test ioerr.test 539 ioerr.test ioerr2.test ioerr3.test ioerr4.test ioerr5.test 540 vacuum3.test incrblob_err.test diskfull.test backup_ioerr.test 541 e_fts3.test fts3cov.test fts3malloc.test fts3rnd.test 542 fts3snippet.test 543 544 # Exclude test scripts that use tcl IO to access journal files or count 545 # the number of fsync() calls. 546 pager.test exclusive.test jrnlmode.test sync.test misc1.test 547 journal1.test conflict.test crash8.test tkt3457.test io.test 548 journal3.test 8_3_names.test 549 550 pager1.test async4.test corrupt.test filefmt.test pager2.test 551 corrupt5.test corruptA.test pageropt.test 552 553 # Exclude stmt.test, which expects sub-journals to use temporary files. 554 stmt.test 555 556 zerodamage.test 557 558 # WAL mode is different. 559 wal* tkt-2d1a5c67d.test backcompat.test 560}] 561 562ifcapable mem3 { 563 test_suite "memsys3" -description { 564 Run tests using the allocator in mem3.c. 565 } -files [test_set $::allquicktests -exclude { 566 autovacuum.test delete3.test manydb.test 567 bigrow.test incrblob2.test memdb.test 568 bitvec.test index2.test memsubsys1.test 569 capi3c.test ioerr.test memsubsys2.test 570 capi3.test join3.test pagesize.test 571 collate5.test limit.test backup_ioerr.test 572 backup_malloc.test 573 }] -initialize { 574 catch {db close} 575 sqlite3_reset_auto_extension 576 sqlite3_shutdown 577 sqlite3_config_heap 25000000 0 578 sqlite3_config_lookaside 0 0 579 ifcapable mem5 { 580 # If both memsys3 and memsys5 are enabled in the build, the call to 581 # [sqlite3_config_heap] will initialize the system to use memsys5. 582 # The following overrides this preference and installs the memsys3 583 # allocator. 584 sqlite3_install_memsys3 585 } 586 install_malloc_faultsim 1 587 sqlite3_initialize 588 autoinstall_test_functions 589 } -shutdown { 590 catch {db close} 591 sqlite3_shutdown 592 sqlite3_config_heap 0 0 593 sqlite3_config_lookaside 100 500 594 install_malloc_faultsim 1 595 sqlite3_initialize 596 autoinstall_test_functions 597 } 598} 599 600ifcapable mem5 { 601 test_suite "memsys5" -description { 602 Run tests using the allocator in mem5.c. 603 } -files [test_set $::allquicktests -exclude { 604 autovacuum.test delete3.test manydb.test 605 bigrow.test incrblob2.test memdb.test 606 bitvec.test index2.test memsubsys1.test 607 capi3c.test ioerr.test memsubsys2.test 608 capi3.test join3.test pagesize.test 609 collate5.test limit.test zeroblob.test 610 }] -initialize { 611 catch {db close} 612 sqlite3_shutdown 613 sqlite3_config_heap 25000000 64 614 sqlite3_config_lookaside 0 0 615 install_malloc_faultsim 1 616 sqlite3_initialize 617 autoinstall_test_functions 618 } -shutdown { 619 catch {db close} 620 sqlite3_shutdown 621 sqlite3_config_heap 0 0 622 sqlite3_config_lookaside 100 500 623 install_malloc_faultsim 1 624 sqlite3_initialize 625 autoinstall_test_functions 626 } 627 628 test_suite "memsys5-2" -description { 629 Run tests using the allocator in mem5.c in a different configuration. 630 } -files { 631 select1.test 632 } -initialize { 633 catch {db close} 634 sqlite3_shutdown 635 sqlite3_config_memstatus 0 636 sqlite3_config_heap 40000000 16 637 sqlite3_config_lookaside 0 0 638 install_malloc_faultsim 1 639 sqlite3_initialize 640 autoinstall_test_functions 641 } -shutdown { 642 catch {db close} 643 sqlite3_shutdown 644 sqlite3_config_heap 0 0 645 sqlite3_config_lookaside 100 500 646 install_malloc_faultsim 1 647 sqlite3_initialize 648 autoinstall_test_functions 649 } 650} 651 652ifcapable threadsafe { 653 test_suite "no_mutex_try" -description { 654 The sqlite3_mutex_try() interface always fails 655 } -files [ 656 test_set $::allquicktests -exclude mutex1.test mutex2.test 657 ] -initialize { 658 catch {db close} 659 sqlite3_shutdown 660 install_mutex_counters 1 661 set ::disable_mutex_try 1 662 sqlite3_initialize 663 autoinstall_test_functions 664 } -shutdown { 665 catch {db close} 666 sqlite3_shutdown 667 install_mutex_counters 0 668 sqlite3_initialize 669 autoinstall_test_functions 670 } 671} 672 673# run_tests "crash_safe_append" -description { 674# Run crash.test with persistent journals on a SAFE_APPEND file-system. 675# } -initialize { 676# rename crashsql sa_crashsql 677# proc crashsql {args} { 678# set options [lrange $args 0 [expr {[llength $args]-2}]] 679# lappend options -char safe_append 680# set sql [lindex $args end] 681# lappend options " 682# PRAGMA journal_mode=persistent; 683# $sql 684# " 685# set fd [open test.db-journal w] 686# puts $fd [string repeat 1234567890 100000] 687# close $fd 688# eval sa_crashsql $options 689# } 690# } -shutdown { 691# rename crashsql {} 692# rename sa_crashsql crashsql 693# } -files crash.test 694 695test_suite "safe_append" -description { 696 Run some tests on a SAFE_APPEND file-system. 697} -initialize { 698 rename sqlite3 sqlite3_safeappend 699 proc sqlite3 {args} { 700 if {[string range [lindex $args 0] 0 0] ne "-"} { 701 lappend args -vfs devsym 702 } 703 uplevel [concat sqlite3_safeappend $args] 704 } 705 sqlite3_simulate_device -char safe_append 706} -shutdown { 707 rename sqlite3 {} 708 rename sqlite3_shutdown sqlite3 709} -files [ 710 test_set $::allquicktests shared_err.test -exclude async3.test 711] 712 713# The set of tests to run on the alternative-pcache 714set perm-alt-pcache-testset { 715 async.test 716 attach.test 717 delete.test delete2.test 718 index.test 719 insert.test insert2.test 720 join.test join2.test 721 rollback.test 722 select1.test select2.test 723 trans.test 724 update.test 725} 726 727foreach discard_rate {0 10 50 90 100} { 728 test_suite "pcache${discard_rate}" -description " 729 Alternative pcache implementation with ${discard_rate}% random discard 730 " -initialize " 731 catch {db close} 732 sqlite3_shutdown 733 sqlite3_config_alt_pcache 1 $discard_rate 1 734 sqlite3_initialize 735 autoinstall_test_functions 736 " -shutdown { 737 catch {db close} 738 sqlite3_shutdown 739 sqlite3_config_alt_pcache 0 0 0 740 sqlite3_config_lookaside 100 500 741 install_malloc_faultsim 1 742 sqlite3_initialize 743 autoinstall_test_functions 744 } -files ${perm-alt-pcache-testset} 745} 746 747test_suite "journaltest" -description { 748 Check that pages are synced before being written (test_journal.c). 749} -initialize { 750 catch {db close} 751 register_jt_vfs -default "" 752} -shutdown { 753 unregister_jt_vfs 754} -files [test_set $::allquicktests -exclude { 755 wal* incrvacuum.test ioerr.test corrupt4.test io.test crash8.test 756 async4.test bigfile.test backcompat.test 757}] 758 759if {[info commands register_demovfs] != ""} { 760 test_suite "demovfs" -description { 761 Check that the demovfs (code in test_demovfs.c) more or less works. 762 } -initialize { 763 register_demovfs 764 } -shutdown { 765 unregister_demovfs 766 } -files { 767 insert.test insert2.test insert3.test rollback.test 768 select1.test select2.test select3.test 769 } 770} 771 772test_suite "wal" -description { 773 Run tests with journal_mode=WAL 774} -initialize { 775 set ::G(savepoint6_iterations) 100 776} -shutdown { 777 unset -nocomplain ::G(savepoint6_iterations) 778} -files { 779 savepoint.test savepoint2.test savepoint6.test 780 trans.test avtrans.test 781 782 fts3aa.test fts3ab.test fts3ac.test fts3ad.test 783 fts3ae.test fts3af.test fts3ag.test fts3ah.test 784 fts3ai.test fts3aj.test fts3ak.test fts3al.test 785 fts3am.test fts3an.test fts3ao.test fts3b.test 786 fts3c.test fts3d.test fts3e.test fts3query.test 787} 788 789test_suite "rtree" -description { 790 All R-tree related tests. Provides coverage of source file rtree.c. 791} -files [glob -nocomplain $::testdir/../ext/rtree/*.test] 792 793test_suite "no_optimization" -description { 794 Run test scripts with optimizations disabled using the 795 sqlite3_test_control(SQLITE_TESTCTRL_OPTIMIZATIONS) interface. 796} -files { 797 where.test where2.test where3.test where4.test where5.test 798 where6.test where7.test where8.test where9.test 799 whereA.test whereB.test wherelimit.test 800 select1.test select2.test select3.test select4.test select5.test 801 select7.test select8.test selectA.test selectC.test 802} -dbconfig { 803 optimization_control $::dbhandle all 0 804} 805 806test_suite "prepare" -description { 807 Run tests with the db connection using sqlite3_prepare() instead of _v2(). 808} -dbconfig { 809 db_use_legacy_prepare $::dbhandle 1 810 #$::dbhandle cache size 0 811} -files [ 812 test_set $allquicktests -exclude *malloc* *ioerr* *fault* 813] 814 815# End of tests 816############################################################################# 817 818# run_tests NAME OPTIONS 819# 820# where available options are: 821# 822# -description TITLE 823# -initialize SCRIPT 824# -shutdown SCRIPT 825# -presql SQL 826# -files LIST-OF-FILES 827# -prefix NAME 828# 829proc run_tests {name args} { 830 array set options $args 831 832 set ::G(perm:name) $name 833 set ::G(perm:prefix) $options(-prefix) 834 set ::G(perm:presql) $options(-presql) 835 set ::G(isquick) 1 836 set ::G(perm:dbconfig) $options(-dbconfig) 837 838 uplevel $options(-initialize) 839 840 foreach file [lsort $options(-files)] { 841 if {[file tail $file] == $file} { set file [file join $::testdir $file] } 842 slave_test_file $file 843 } 844 845 uplevel $options(-shutdown) 846 847 unset ::G(perm:name) 848 unset ::G(perm:prefix) 849 unset ::G(perm:presql) 850 unset ::G(perm:dbconfig) 851} 852 853proc run_test_suite {name} { 854 if {[info exists ::testspec($name)]==0} { 855 error "No such test suite: $name" 856 } 857 uplevel run_tests $name $::testspec($name) 858} 859 860proc help {} { 861 puts "Usage: $::argv0 TESTSUITE ?TESTFILE?" 862 puts "" 863 puts "Available test-suites are:" 864 foreach k $::testsuitelist { 865 if {[info exists ::testspec($k)]==0} { 866 puts " ----------------------------------------" 867 puts "" 868 } else { 869 array set o $::testspec($k) 870 puts "Test suite: \"$k\"" 871 set d [string trim $o(-description)] 872 set d [regsub {\n *} $d "\n "] 873 puts " $d" 874 puts "" 875 } 876 } 877 exit -1 878} 879 880if {[info script] == $argv0} { 881 proc main {argv} { 882 if {[llength $argv]==0} { 883 help 884 } else { 885 set suite [lindex $argv 0] 886 if {[info exists ::testspec($suite)]==0} help 887 set extra "" 888 if {[llength $argv]>1} { set extra [list -files [lrange $argv 1 end]] } 889 eval run_tests $suite $::testspec($suite) $extra 890 } 891 } 892 main $argv 893 finish_test 894} 895