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