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