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