permutations.test 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996
  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. set testdir [file dirname $argv0]
  13. source $testdir/tester.tcl
  14. db close
  15. #-------------------------------------------------------------------------
  16. # test_suite NAME OPTIONS
  17. #
  18. # where available options are:
  19. #
  20. # -description TITLE (default "")
  21. # -initialize SCRIPT (default "")
  22. # -shutdown SCRIPT (default "")
  23. # -presql SQL (default "")
  24. # -files LIST-OF-FILES (default $::ALLTESTS)
  25. # -prefix NAME (default "$::NAME.")
  26. # -dbconfig SCRIPT (default "")
  27. #
  28. proc test_suite {name args} {
  29. set default(-shutdown) ""
  30. set default(-initialize) ""
  31. set default(-presql) ""
  32. set default(-description) "no description supplied (fixme)"
  33. set default(-files) ""
  34. set default(-prefix) "${name}."
  35. set default(-dbconfig) ""
  36. array set options [array get default]
  37. if {[llength $args]%2} {
  38. error "uneven number of options/switches passed to test_suite"
  39. }
  40. foreach {k v} $args {
  41. set o [array names options ${k}*]
  42. if {[llength $o]>1} { error "ambiguous option: $k" }
  43. if {[llength $o]==0} { error "unknown option: $k" }
  44. set options([lindex $o 0]) $v
  45. }
  46. set ::testspec($name) [array get options]
  47. lappend ::testsuitelist $name
  48. }
  49. #-------------------------------------------------------------------------
  50. # test_set ARGS...
  51. #
  52. proc test_set {args} {
  53. set isExclude 0
  54. foreach a $args {
  55. if {[string match -* $a]} {
  56. switch -- $a {
  57. -include { set isExclude 0 }
  58. -exclude { set isExclude 1 }
  59. default {
  60. error "Unknown switch: $a"
  61. }
  62. }
  63. } elseif {$isExclude == 0} {
  64. foreach f $a { set t($f) 1 }
  65. } else {
  66. foreach f $a { array unset t $f }
  67. foreach f $a { array unset t */$f }
  68. }
  69. }
  70. return [array names t]
  71. }
  72. #-------------------------------------------------------------------------
  73. # Set up the following global list variables containing the names of
  74. # various test scripts:
  75. #
  76. # $alltests
  77. # $allquicktests
  78. #
  79. set alltests [list]
  80. foreach f [glob $testdir/*.test] { lappend alltests [file tail $f] }
  81. foreach f [glob -nocomplain $testdir/../ext/rtree/*.test] {
  82. lappend alltests $f
  83. }
  84. if {$::tcl_platform(platform)!="unix"} {
  85. set alltests [test_set $alltests -exclude crash.test crash2.test]
  86. }
  87. set alltests [test_set $alltests -exclude {
  88. all.test async.test quick.test veryquick.test
  89. memleak.test permutations.test soak.test fts3.test
  90. mallocAll.test rtree.test full.test
  91. }]
  92. set allquicktests [test_set $alltests -exclude {
  93. async2.test async3.test backup_ioerr.test corrupt.test
  94. corruptC.test crash.test crash2.test crash3.test crash4.test crash5.test
  95. crash6.test crash7.test delete3.test e_fts3.test fts3rnd.test
  96. fkey_malloc.test fuzz.test fuzz3.test fuzz_malloc.test in2.test loadext.test
  97. misc7.test mutex2.test notify2.test onefile.test pagerfault2.test
  98. savepoint4.test savepoint6.test select9.test
  99. speed1.test speed1p.test speed2.test speed3.test speed4.test
  100. speed4p.test sqllimits1.test tkt2686.test thread001.test thread002.test
  101. thread003.test thread004.test thread005.test trans2.test vacuum3.test
  102. incrvacuum_ioerr.test autovacuum_crash.test btree8.test shared_err.test
  103. vtab_err.test walslow.test walcrash.test walcrash3.test
  104. walthread.test rtree3.test indexfault.test securedel2.test
  105. }]
  106. if {[info exists ::env(QUICKTEST_INCLUDE)]} {
  107. set allquicktests [concat $allquicktests $::env(QUICKTEST_INCLUDE)]
  108. }
  109. #############################################################################
  110. # Start of tests
  111. #
  112. #-------------------------------------------------------------------------
  113. # Define the generic test suites:
  114. #
  115. # veryquick
  116. # quick
  117. # full
  118. #
  119. lappend ::testsuitelist xxx
  120. test_suite "veryquick" -prefix "" -description {
  121. "Very" quick test suite. Runs in less than 5 minutes on a workstation.
  122. This test suite is the same as the "quick" tests, except that some files
  123. that test malloc and IO errors are omitted.
  124. } -files [
  125. test_set $allquicktests -exclude *malloc* *ioerr* *fault*
  126. ]
  127. test_suite "mmap" -prefix "mm-" -description {
  128. Similar to veryquick. Except with memory mapping disabled.
  129. } -presql {
  130. pragma mmap_size = 268435456;
  131. } -files [
  132. test_set $allquicktests -exclude *malloc* *ioerr* *fault* -include malloc.test
  133. ]
  134. test_suite "valgrind" -prefix "" -description {
  135. Run the "veryquick" test suite with a couple of multi-process tests (that
  136. fail under valgrind) omitted.
  137. } -files [
  138. test_set $allquicktests -exclude *malloc* *ioerr* *fault* wal.test atof1.test
  139. ] -initialize {
  140. set ::G(valgrind) 1
  141. } -shutdown {
  142. unset -nocomplain ::G(valgrind)
  143. }
  144. test_suite "quick" -prefix "" -description {
  145. Quick test suite. Runs in around 10 minutes on a workstation.
  146. } -files [
  147. test_set $allquicktests
  148. ]
  149. test_suite "full" -prefix "" -description {
  150. Full test suite. Takes a long time.
  151. } -files [
  152. test_set $alltests
  153. ] -initialize {
  154. unset -nocomplain ::G(isquick)
  155. }
  156. test_suite "threads" -prefix "" -description {
  157. All multi-threaded tests.
  158. } -files {
  159. notify2.test thread001.test thread002.test thread003.test
  160. thread004.test thread005.test walthread.test
  161. }
  162. test_suite "fts3" -prefix "" -description {
  163. All FTS3 tests except fts3rnd.test.
  164. } -files {
  165. fts3aa.test fts3ab.test fts3ac.test fts3ad.test fts3ae.test
  166. fts3af.test fts3ag.test fts3ah.test fts3ai.test fts3aj.test
  167. fts3ak.test fts3al.test fts3am.test fts3an.test fts3ao.test
  168. fts3atoken.test fts3b.test fts3c.test fts3cov.test fts3d.test
  169. fts3defer.test fts3defer2.test fts3e.test fts3expr.test fts3expr2.test
  170. fts3expr3.test
  171. fts3near.test fts3query.test fts3shared.test fts3snippet.test
  172. fts3sort.test
  173. fts3fault.test fts3malloc.test fts3matchinfo.test
  174. fts3aux1.test fts3comp1.test fts3auto.test
  175. fts4aa.test fts4content.test
  176. fts3conf.test fts3prefix.test fts3fault2.test fts3corrupt.test
  177. fts3corrupt2.test fts3first.test fts4langid.test fts4merge.test
  178. fts4check.test fts4unicode.test fts4noti.test
  179. }
  180. test_suite "nofaultsim" -prefix "" -description {
  181. "Very" quick test suite. Runs in less than 5 minutes on a workstation.
  182. This test suite is the same as the "quick" tests, except that some files
  183. that test malloc and IO errors are omitted.
  184. } -files [
  185. test_set $allquicktests -exclude *malloc* *ioerr* *fault*
  186. ] -initialize {
  187. catch {db close}
  188. sqlite3_shutdown
  189. install_malloc_faultsim 0
  190. sqlite3_initialize
  191. autoinstall_test_functions
  192. } -shutdown {
  193. unset -nocomplain ::G(valgrind)
  194. }
  195. test_suite "queryplanner" -prefix "" -description {
  196. Tests of the query planner and query optimizer
  197. } -files {
  198. alter2.test alter3.test alter4.test alter.test analyze3.test
  199. analyze4.test analyze5.test analyze6.test analyze7.test analyze8.test
  200. analyze.test attach2.test attach3.test attach4.test
  201. attach.test autoinc.test autoindex1.test between.test cast.test
  202. check.test closure01.test coalesce.test collate1.test collate2.test
  203. collate3.test collate4.test collate5.test collate6.test collate7.test
  204. collate8.test collate9.test collateA.test colmeta.test colname.test
  205. conflict.test count.test coveridxscan.test createtab.test cse.test
  206. date.test dbstatus2.test dbstatus.test default.test delete2.test
  207. delete3.test delete.test descidx1.test descidx2.test descidx3.test
  208. distinctagg.test distinct.test e_createtable.test e_delete.test
  209. e_droptrigger.test e_dropview.test e_expr.test e_insert.test
  210. eqp.test e_reindex.test e_resolve.test e_select2.test e_select.test
  211. e_update.test exists.test expr.test fkey1.test fkey2.test fkey3.test
  212. fkey4.test fkey5.test func2.test func3.test func.test
  213. in3.test in4.test in5.test index2.test index3.test
  214. index4.test index5.test indexedby.test index.test
  215. insert2.test insert3.test insert4.test insert5.test insert.test
  216. instr.test in.test intpkey.test join2.test join3.test join4.test
  217. join5.test join6.test join.test like2.test like.test limit.test
  218. minmax2.test minmax3.test minmax4.test minmax.test misc1.test misc2.test
  219. misc3.test misc4.test misc5.test misc6.test misc7.test orderby1.test
  220. orderby2.test orderby3.test orderby4.test randexpr1.test regexp1.test
  221. reindex.test rowhash.test rowid.test schema2.test schema3.test
  222. schema4.test schema5.test schema.test
  223. select1.test select2.test select3.test select4.test select5.test
  224. select6.test select7.test select8.test select9.test selectA.test
  225. selectB.test selectC.test selectD.test selectE.test sidedelete.test
  226. sort.test spellfix.test subquery2.test subquery.test subselect.test
  227. substr.test tkt-02a8e81d44.test tkt1435.test tkt1443.test tkt1444.test
  228. tkt1449.test tkt1473.test tkt1501.test tkt1512.test tkt1514.test
  229. tkt1536.test tkt1537.test tkt1567.test tkt1644.test tkt1667.test
  230. tkt1873.test tkt2141.test tkt2192.test tkt2213.test tkt2251.test
  231. tkt2285.test tkt2332.test tkt2339.test tkt2391.test tkt2409.test
  232. tkt2450.test tkt2565.test tkt2640.test tkt2643.test tkt2686.test
  233. tkt-26ff0c2d1e.test tkt2767.test tkt2817.test tkt2820.test tkt2822.test
  234. tkt2832.test tkt2854.test tkt2920.test tkt2927.test tkt2942.test
  235. tkt-2a5629202f.test tkt-2d1a5c67d.test tkt-2ea2425d34.test tkt3080.test
  236. tkt3093.test tkt3121.test tkt-31338dca7e.test tkt-313723c356.test
  237. tkt3201.test tkt3292.test tkt3298.test tkt3334.test tkt3346.test
  238. tkt3357.test tkt3419.test tkt3424.test tkt3442.test tkt3457.test
  239. tkt3461.test tkt3493.test tkt3508.test tkt3522.test tkt3527.test
  240. tkt3541.test tkt3554.test tkt3581.test tkt35xx.test tkt3630.test
  241. tkt3718.test tkt3731.test tkt3757.test tkt3761.test tkt3762.test
  242. tkt3773.test tkt3791.test tkt3793.test tkt3810.test tkt3824.test
  243. tkt3832.test tkt3838.test tkt3841.test tkt-385a5b56b9.test tkt3871.test
  244. tkt3879.test tkt-38cb5df375.test tkt3911.test tkt3918.test tkt3922.test
  245. tkt3929.test tkt3935.test tkt3992.test tkt3997.test tkt-3998683a16.test
  246. tkt-3a77c9714e.test tkt-3fe897352e.test tkt4018.test tkt-4a03edc4c8.test
  247. tkt-4dd95f6943.test tkt-54844eea3f.test tkt-5d863f876e.test
  248. tkt-5e10420e8d.test tkt-5ee23731f.test tkt-6bfb98dfc0.test
  249. tkt-752e1646fc.test tkt-78e04e52ea.test tkt-7a31705a7e6.test
  250. tkt-7bbfb7d442.test tkt-80ba201079.test tkt-80e031a00f.test
  251. tkt-8454a207b9.test tkt-91e2e8ba6f.test tkt-94c04eaadb.test
  252. tkt-9d68c883.test tkt-a7b7803e.test tkt-b1d3a2e531.test
  253. tkt-b351d95f9.test tkt-b72787b1.test tkt-bd484a090c.test
  254. tkt-bdc6bbbb38.test tkt-c48d99d690.test tkt-cbd054fa6b.test
  255. tkt-d11f09d36e.test tkt-d635236375.test tkt-d82e3f3721.test
  256. tkt-f3e5abed55.test tkt-f777251dc7a.test tkt-f7b4edec.test
  257. tkt-f973c7ac31.test tkt-fa7bf5ec.test tkt-fc62af4523.test
  258. tkt-fc7bd6358f.test trigger1.test trigger2.test trigger3.test
  259. trigger4.test trigger5.test trigger6.test trigger7.test trigger8.test
  260. trigger9.test triggerA.test triggerB.test triggerC.test triggerD.test
  261. types2.test types3.test types.test unique.test unordered.test
  262. update.test view.test vtab1.test vtab2.test vtab3.test vtab4.test
  263. vtab5.test vtab6.test vtab7.test vtab8.test vtab9.test vtab_alter.test
  264. vtabA.test vtabB.test vtabC.test vtabD.test vtabE.test
  265. vtabF.test where2.test where3.test where4.test where5.test where6.test
  266. where7.test where8m.test where8.test where9.test whereA.test whereB.test
  267. whereC.test whereD.test whereE.test whereF.test wherelimit.test
  268. where.test
  269. }
  270. test_suite "vfslog" -prefix "" -description {
  271. "Vfslog" quick test suite. Like "veryquick" except does not omits
  272. a few tests that do not work with a version 1 VFS. And the quota* tests,
  273. which do not work with a VFS that uses the pVfs argument passed to
  274. sqlite3_vfs methods.
  275. } -files [
  276. test_set $allquicktests -exclude *malloc* *ioerr* *fault* oserror.test \
  277. pager1.test syscall.test sysfault.test tkt3457.test quota* superlock* \
  278. wal* mmap*
  279. ]
  280. lappend ::testsuitelist xxx
  281. #-------------------------------------------------------------------------
  282. # Define the coverage related test suites:
  283. #
  284. # coverage-wal
  285. #
  286. test_suite "coverage-wal" -description {
  287. Coverage tests for file wal.c.
  288. } -files {
  289. wal.test wal2.test wal3.test walmode.test
  290. walbak.test walhook.test walcrash2.test walcksum.test
  291. walfault.test walbig.test walnoshm.test
  292. wal5.test
  293. }
  294. test_suite "coverage-pager" -description {
  295. Coverage tests for file pager.c.
  296. } -files {
  297. pager1.test pager2.test pagerfault.test pagerfault2.test
  298. walfault.test walbak.test journal2.test tkt-9d68c883.test
  299. }
  300. test_suite "coverage-analyze" -description {
  301. Coverage tests for file analyze.c.
  302. } -files {
  303. analyze3.test analyze4.test analyze5.test analyze6.test
  304. analyze7.test analyze8.test analyze9.test analyzeA.test
  305. analyze.test analyzeB.test mallocA.test
  306. }
  307. lappend ::testsuitelist xxx
  308. #-------------------------------------------------------------------------
  309. # Define the permutation test suites:
  310. #
  311. # Run some tests using pre-allocated page and scratch blocks.
  312. #
  313. # mmap1.test is excluded because a good number of its tests depend on
  314. # the page-cache being larger than the database. But this permutation
  315. # causes the effective limit on the page-cache to be just 24 pages.
  316. #
  317. test_suite "memsubsys1" -description {
  318. Tests using pre-allocated page and scratch blocks
  319. } -files [
  320. test_set $::allquicktests -exclude ioerr5.test malloc5.test mmap1.test
  321. ] -initialize {
  322. catch {db close}
  323. sqlite3_shutdown
  324. sqlite3_config_pagecache 4096 24
  325. sqlite3_config_scratch 25000 1
  326. sqlite3_initialize
  327. autoinstall_test_functions
  328. } -shutdown {
  329. catch {db close}
  330. sqlite3_shutdown
  331. sqlite3_config_pagecache 0 0
  332. sqlite3_config_scratch 0 0
  333. sqlite3_initialize
  334. autoinstall_test_functions
  335. }
  336. # Run some tests using pre-allocated page and scratch blocks. This time
  337. # the allocations are too small to use in most cases.
  338. #
  339. # Both ioerr5.test and malloc5.test are excluded because they test the
  340. # sqlite3_soft_heap_limit() and sqlite3_release_memory() functionality.
  341. # This functionality is disabled if a pre-allocated page block is provided.
  342. #
  343. test_suite "memsubsys2" -description {
  344. Tests using small pre-allocated page and scratch blocks
  345. } -files [
  346. test_set $::allquicktests -exclude ioerr5.test malloc5.test
  347. ] -initialize {
  348. catch {db close}
  349. sqlite3_shutdown
  350. sqlite3_config_pagecache 512 5
  351. sqlite3_config_scratch 1000 1
  352. sqlite3_initialize
  353. autoinstall_test_functions
  354. } -shutdown {
  355. catch {db close}
  356. sqlite3_shutdown
  357. sqlite3_config_pagecache 0 0
  358. sqlite3_config_scratch 0 0
  359. sqlite3_initialize
  360. autoinstall_test_functions
  361. }
  362. # Run all tests with the lookaside allocator disabled.
  363. #
  364. test_suite "nolookaside" -description {
  365. OOM tests with lookaside disabled
  366. } -initialize {
  367. catch {db close}
  368. sqlite3_shutdown
  369. sqlite3_config_lookaside 0 0
  370. sqlite3_initialize
  371. autoinstall_test_functions
  372. } -shutdown {
  373. catch {db close}
  374. sqlite3_shutdown
  375. sqlite3_config_lookaside 100 500
  376. sqlite3_initialize
  377. autoinstall_test_functions
  378. } -files $::allquicktests
  379. # Run some tests in SQLITE_CONFIG_SINGLETHREAD mode.
  380. #
  381. test_suite "singlethread" -description {
  382. Tests run in SQLITE_CONFIG_SINGLETHREAD mode
  383. } -initialize {
  384. catch {db close}
  385. sqlite3_shutdown
  386. catch {sqlite3_config singlethread}
  387. sqlite3_initialize
  388. autoinstall_test_functions
  389. } -files {
  390. delete.test delete2.test insert.test rollback.test select1.test
  391. select2.test trans.test update.test vacuum.test types.test
  392. types2.test types3.test
  393. } -shutdown {
  394. catch {db close}
  395. sqlite3_shutdown
  396. catch {sqlite3_config serialized}
  397. sqlite3_initialize
  398. autoinstall_test_functions
  399. }
  400. test_suite "nomutex" -description {
  401. Tests run with the SQLITE_OPEN_MULTITHREADED flag passed to sqlite3_open().
  402. } -initialize {
  403. rename sqlite3 sqlite3_nomutex
  404. proc sqlite3 {args} {
  405. if {[string range [lindex $args 0] 0 0] ne "-"} {
  406. lappend args -fullmutex 0 -nomutex 1
  407. }
  408. uplevel [concat sqlite3_nomutex $args]
  409. }
  410. } -files {
  411. delete.test delete2.test insert.test rollback.test select1.test
  412. select2.test trans.test update.test vacuum.test types.test
  413. types2.test types3.test
  414. } -shutdown {
  415. rename sqlite3 {}
  416. rename sqlite3_nomutex sqlite3
  417. }
  418. # Run some tests in SQLITE_CONFIG_MULTITHREAD mode.
  419. #
  420. test_suite "multithread" -description {
  421. Tests run in SQLITE_CONFIG_MULTITHREAD mode
  422. } -initialize {
  423. catch {db close}
  424. sqlite3_shutdown
  425. catch {sqlite3_config multithread}
  426. sqlite3_initialize
  427. autoinstall_test_functions
  428. } -files {
  429. delete.test delete2.test insert.test rollback.test select1.test
  430. select2.test trans.test update.test vacuum.test types.test
  431. types2.test types3.test
  432. } -shutdown {
  433. catch {db close}
  434. sqlite3_shutdown
  435. catch {sqlite3_config serialized}
  436. sqlite3_initialize
  437. autoinstall_test_functions
  438. }
  439. # Run some tests in SQLITE_OPEN_FULLMUTEX mode.
  440. #
  441. test_suite "fullmutex" -description {
  442. Tests run in SQLITE_OPEN_FULLMUTEX mode
  443. } -initialize {
  444. rename sqlite3 sqlite3_fullmutex
  445. proc sqlite3 {args} {
  446. if {[string range [lindex $args 0] 0 0] ne "-"} {
  447. lappend args -nomutex 0 -fullmutex 1
  448. }
  449. uplevel [concat sqlite3_fullmutex $args]
  450. }
  451. } -files {
  452. delete.test delete2.test insert.test rollback.test select1.test
  453. select2.test trans.test update.test vacuum.test types.test
  454. types2.test types3.test
  455. } -shutdown {
  456. rename sqlite3 {}
  457. rename sqlite3_fullmutex sqlite3
  458. }
  459. # Run some tests using the "onefile" demo.
  460. #
  461. test_suite "onefile" -description {
  462. Run some tests using the "test_onefile.c" demo
  463. } -initialize {
  464. rename sqlite3 sqlite3_onefile
  465. proc sqlite3 {args} {
  466. if {[string range [lindex $args 0] 0 0] ne "-"} {
  467. lappend args -vfs fs
  468. }
  469. uplevel [concat sqlite3_onefile $args]
  470. }
  471. } -files {
  472. conflict.test insert.test insert2.test insert3.test
  473. rollback.test select1.test select2.test select3.test
  474. } -shutdown {
  475. rename sqlite3 {}
  476. rename sqlite3_onefile sqlite3
  477. }
  478. # Run some tests using UTF-16 databases.
  479. #
  480. test_suite "utf16" -description {
  481. Run tests using UTF-16 databases
  482. } -presql {
  483. pragma encoding = 'UTF-16'
  484. } -files {
  485. alter.test alter3.test
  486. analyze.test analyze3.test analyze4.test analyze5.test analyze6.test
  487. analyze7.test analyze8.test analyze9.test analyzeA.test analyzeB.test
  488. auth.test bind.test blob.test capi2.test capi3.test collate1.test
  489. collate2.test collate3.test collate4.test collate5.test collate6.test
  490. conflict.test date.test delete.test expr.test fkey1.test func.test
  491. hook.test index.test insert2.test insert.test interrupt.test in.test
  492. intpkey.test ioerr.test join2.test join.test lastinsert.test
  493. laststmtchanges.test limit.test lock2.test lock.test main.test
  494. memdb.test minmax.test misc1.test misc2.test misc3.test notnull.test
  495. null.test progress.test quote.test rowid.test select1.test select2.test
  496. select3.test select4.test select5.test select6.test sort.test
  497. subselect.test tableapi.test table.test temptable.test
  498. trace.test trigger1.test trigger2.test trigger3.test
  499. trigger4.test types2.test types.test unique.test update.test
  500. vacuum.test view.test where.test
  501. }
  502. # Run some tests in exclusive locking mode.
  503. #
  504. test_suite "exclusive" -description {
  505. Run tests in exclusive locking mode.
  506. } -presql {
  507. pragma locking_mode = 'exclusive'
  508. } -files {
  509. rollback.test select1.test select2.test
  510. malloc.test ioerr.test
  511. }
  512. # Run some tests in exclusive locking mode with truncated journals.
  513. #
  514. test_suite "exclusive-truncate" -description {
  515. Run tests in exclusive locking mode and truncate journal mode.
  516. } -presql {
  517. pragma locking_mode = 'exclusive';
  518. pragma journal_mode = TRUNCATE;
  519. } -files {
  520. delete.test delete2.test insert.test rollback.test select1.test
  521. select2.test update.test malloc.test ioerr.test
  522. }
  523. # Run some tests in persistent journal mode.
  524. #
  525. test_suite "persistent_journal" -description {
  526. Run tests in persistent-journal mode.
  527. } -presql {
  528. pragma journal_mode = persist
  529. } -files {
  530. delete.test delete2.test insert.test rollback.test select1.test
  531. select2.test trans.test update.test vacuum.test
  532. }
  533. # Run some tests in truncating journal mode.
  534. #
  535. test_suite "truncate_journal" -description {
  536. Run tests in persistent-journal mode.
  537. } -presql {
  538. pragma journal_mode = truncate
  539. } -files {
  540. delete.test delete2.test insert.test rollback.test select1.test
  541. select2.test trans.test update.test vacuum.test
  542. malloc.test ioerr.test
  543. }
  544. # Run some error tests in persistent journal mode.
  545. #
  546. test_suite "persistent_journal_error" -description {
  547. Run malloc.test and ioerr.test in persistent-journal mode.
  548. } -presql {
  549. pragma journal_mode = persist
  550. } -files {
  551. malloc.test ioerr.test
  552. }
  553. # Run some tests in no journal mode.
  554. #
  555. test_suite "no_journal" -description {
  556. Run tests in no-journal mode.
  557. } -presql {
  558. pragma journal_mode = persist
  559. } -files {
  560. delete.test delete2.test insert.test rollback.test select1.test
  561. select2.test trans.test update.test vacuum.test
  562. }
  563. # Run some error tests in no journal mode.
  564. #
  565. test_suite "no_journal_error" -description {
  566. Run malloc.test and ioerr.test in no-journal mode.
  567. } -presql {
  568. pragma journal_mode = persist
  569. } -files {
  570. malloc.test ioerr.test
  571. }
  572. # Run some crash-tests in autovacuum mode.
  573. #
  574. test_suite "autovacuum_crash" -description {
  575. Run crash.test in autovacuum mode.
  576. } -presql {
  577. pragma auto_vacuum = 1
  578. } -files crash.test
  579. # Run some ioerr-tests in autovacuum mode.
  580. #
  581. test_suite "autovacuum_ioerr" -description {
  582. Run ioerr.test in autovacuum mode.
  583. } -presql {
  584. pragma auto_vacuum = 1
  585. } -files ioerr.test
  586. # Run tests with an in-memory journal.
  587. #
  588. test_suite "inmemory_journal" -description {
  589. Run tests with an in-memory journal file.
  590. } -presql {
  591. pragma journal_mode = 'memory'
  592. } -files [test_set $::allquicktests -exclude {
  593. # Exclude all tests that simulate IO errors.
  594. autovacuum_ioerr2.test incrvacuum_ioerr.test ioerr.test
  595. ioerr.test ioerr2.test ioerr3.test ioerr4.test ioerr5.test
  596. vacuum3.test incrblob_err.test diskfull.test backup_ioerr.test
  597. e_fts3.test fts3cov.test fts3malloc.test fts3rnd.test
  598. fts3snippet.test
  599. # Exclude test scripts that use tcl IO to access journal files or count
  600. # the number of fsync() calls.
  601. pager.test exclusive.test jrnlmode.test sync.test misc1.test
  602. journal1.test conflict.test crash8.test tkt3457.test io.test
  603. journal3.test 8_3_names.test
  604. pager1.test async4.test corrupt.test filefmt.test pager2.test
  605. corrupt5.test corruptA.test pageropt.test
  606. # Exclude stmt.test, which expects sub-journals to use temporary files.
  607. stmt.test
  608. zerodamage.test
  609. # WAL mode is different.
  610. wal* tkt-2d1a5c67d.test backcompat.test
  611. }]
  612. ifcapable mem3 {
  613. test_suite "memsys3" -description {
  614. Run tests using the allocator in mem3.c.
  615. } -files [test_set $::allquicktests -exclude {
  616. autovacuum.test delete3.test manydb.test
  617. bigrow.test incrblob2.test memdb.test
  618. bitvec.test index2.test memsubsys1.test
  619. capi3c.test ioerr.test memsubsys2.test
  620. capi3.test join3.test pagesize.test
  621. collate5.test limit.test backup_ioerr.test
  622. backup_malloc.test
  623. }] -initialize {
  624. catch {db close}
  625. sqlite3_reset_auto_extension
  626. sqlite3_shutdown
  627. sqlite3_config_heap 25000000 0
  628. sqlite3_config_lookaside 0 0
  629. ifcapable mem5 {
  630. # If both memsys3 and memsys5 are enabled in the build, the call to
  631. # [sqlite3_config_heap] will initialize the system to use memsys5.
  632. # The following overrides this preference and installs the memsys3
  633. # allocator.
  634. sqlite3_install_memsys3
  635. }
  636. install_malloc_faultsim 1
  637. sqlite3_initialize
  638. autoinstall_test_functions
  639. } -shutdown {
  640. catch {db close}
  641. sqlite3_shutdown
  642. sqlite3_config_heap 0 0
  643. sqlite3_config_lookaside 100 500
  644. install_malloc_faultsim 1
  645. sqlite3_initialize
  646. autoinstall_test_functions
  647. }
  648. }
  649. ifcapable mem5 {
  650. test_suite "memsys5" -description {
  651. Run tests using the allocator in mem5.c.
  652. } -files [test_set $::allquicktests -exclude {
  653. autovacuum.test delete3.test manydb.test
  654. bigrow.test incrblob2.test memdb.test
  655. bitvec.test index2.test memsubsys1.test
  656. capi3c.test ioerr.test memsubsys2.test
  657. capi3.test join3.test pagesize.test
  658. collate5.test limit.test zeroblob.test
  659. }] -initialize {
  660. catch {db close}
  661. sqlite3_shutdown
  662. sqlite3_config_heap 25000000 64
  663. sqlite3_config_lookaside 0 0
  664. install_malloc_faultsim 1
  665. sqlite3_initialize
  666. autoinstall_test_functions
  667. } -shutdown {
  668. catch {db close}
  669. sqlite3_shutdown
  670. sqlite3_config_heap 0 0
  671. sqlite3_config_lookaside 100 500
  672. install_malloc_faultsim 1
  673. sqlite3_initialize
  674. autoinstall_test_functions
  675. }
  676. test_suite "memsys5-2" -description {
  677. Run tests using the allocator in mem5.c in a different configuration.
  678. } -files {
  679. select1.test
  680. } -initialize {
  681. catch {db close}
  682. sqlite3_shutdown
  683. sqlite3_config_memstatus 0
  684. sqlite3_config_heap 40000000 16
  685. sqlite3_config_lookaside 0 0
  686. install_malloc_faultsim 1
  687. sqlite3_initialize
  688. autoinstall_test_functions
  689. } -shutdown {
  690. catch {db close}
  691. sqlite3_shutdown
  692. sqlite3_config_heap 0 0
  693. sqlite3_config_lookaside 100 500
  694. install_malloc_faultsim 1
  695. sqlite3_initialize
  696. autoinstall_test_functions
  697. }
  698. }
  699. ifcapable threadsafe {
  700. test_suite "no_mutex_try" -description {
  701. The sqlite3_mutex_try() interface always fails
  702. } -files [
  703. test_set $::allquicktests -exclude mutex1.test mutex2.test
  704. ] -initialize {
  705. catch {db close}
  706. sqlite3_shutdown
  707. install_mutex_counters 1
  708. set ::disable_mutex_try 1
  709. sqlite3_initialize
  710. autoinstall_test_functions
  711. } -shutdown {
  712. catch {db close}
  713. sqlite3_shutdown
  714. install_mutex_counters 0
  715. sqlite3_initialize
  716. autoinstall_test_functions
  717. }
  718. }
  719. # run_tests "crash_safe_append" -description {
  720. # Run crash.test with persistent journals on a SAFE_APPEND file-system.
  721. # } -initialize {
  722. # rename crashsql sa_crashsql
  723. # proc crashsql {args} {
  724. # set options [lrange $args 0 [expr {[llength $args]-2}]]
  725. # lappend options -char safe_append
  726. # set sql [lindex $args end]
  727. # lappend options "
  728. # PRAGMA journal_mode=persistent;
  729. # $sql
  730. # "
  731. # set fd [open test.db-journal w]
  732. # puts $fd [string repeat 1234567890 100000]
  733. # close $fd
  734. # eval sa_crashsql $options
  735. # }
  736. # } -shutdown {
  737. # rename crashsql {}
  738. # rename sa_crashsql crashsql
  739. # } -files crash.test
  740. test_suite "safe_append" -description {
  741. Run some tests on a SAFE_APPEND file-system.
  742. } -initialize {
  743. rename sqlite3 sqlite3_safeappend
  744. proc sqlite3 {args} {
  745. if {[string range [lindex $args 0] 0 0] ne "-"} {
  746. lappend args -vfs devsym
  747. }
  748. uplevel [concat sqlite3_safeappend $args]
  749. }
  750. sqlite3_simulate_device -char safe_append
  751. } -shutdown {
  752. rename sqlite3 {}
  753. rename sqlite3_shutdown sqlite3
  754. } -files [
  755. test_set $::allquicktests shared_err.test -exclude async3.test
  756. ]
  757. # The set of tests to run on the alternative-pcache
  758. set perm-alt-pcache-testset {
  759. async.test
  760. attach.test
  761. delete.test delete2.test
  762. index.test
  763. insert.test insert2.test
  764. join.test join2.test
  765. rollback.test
  766. select1.test select2.test
  767. trans.test
  768. update.test
  769. }
  770. foreach discard_rate {0 10 50 90 100} {
  771. test_suite "pcache${discard_rate}" -description "
  772. Alternative pcache implementation with ${discard_rate}% random discard
  773. " -initialize "
  774. catch {db close}
  775. sqlite3_shutdown
  776. sqlite3_config_alt_pcache 1 $discard_rate 1
  777. sqlite3_initialize
  778. autoinstall_test_functions
  779. " -shutdown {
  780. catch {db close}
  781. sqlite3_shutdown
  782. sqlite3_config_alt_pcache 0 0 0
  783. sqlite3_config_lookaside 100 500
  784. install_malloc_faultsim 1
  785. sqlite3_initialize
  786. autoinstall_test_functions
  787. } -files ${perm-alt-pcache-testset}
  788. }
  789. test_suite "journaltest" -description {
  790. Check that pages are synced before being written (test_journal.c).
  791. } -initialize {
  792. catch {db close}
  793. register_jt_vfs -default ""
  794. } -shutdown {
  795. unregister_jt_vfs
  796. } -files [test_set $::allquicktests -exclude {
  797. wal* incrvacuum.test ioerr.test corrupt4.test io.test crash8.test
  798. async4.test bigfile.test backcompat.test
  799. }]
  800. if {[info commands register_demovfs] != ""} {
  801. test_suite "demovfs" -description {
  802. Check that the demovfs (code in test_demovfs.c) more or less works.
  803. } -initialize {
  804. register_demovfs
  805. } -shutdown {
  806. unregister_demovfs
  807. } -files {
  808. insert.test insert2.test insert3.test rollback.test
  809. select1.test select2.test select3.test
  810. }
  811. }
  812. test_suite "wal" -description {
  813. Run tests with journal_mode=WAL
  814. } -initialize {
  815. set ::G(savepoint6_iterations) 100
  816. } -shutdown {
  817. unset -nocomplain ::G(savepoint6_iterations)
  818. } -files {
  819. savepoint.test savepoint2.test savepoint6.test
  820. trans.test avtrans.test
  821. fts3aa.test fts3ab.test fts3ac.test fts3ad.test
  822. fts3ae.test fts3af.test fts3ag.test fts3ah.test
  823. fts3ai.test fts3aj.test fts3ak.test fts3al.test
  824. fts3am.test fts3an.test fts3ao.test fts3b.test
  825. fts3c.test fts3d.test fts3e.test fts3query.test
  826. }
  827. test_suite "rtree" -description {
  828. All R-tree related tests. Provides coverage of source file rtree.c.
  829. } -files [glob -nocomplain $::testdir/../ext/rtree/*.test]
  830. test_suite "no_optimization" -description {
  831. Run test scripts with optimizations disabled using the
  832. sqlite3_test_control(SQLITE_TESTCTRL_OPTIMIZATIONS) interface.
  833. } -files {
  834. where.test where2.test where3.test where4.test where5.test
  835. where6.test where7.test where8.test where9.test
  836. whereA.test whereB.test wherelimit.test
  837. select1.test select2.test select3.test select4.test select5.test
  838. select7.test select8.test selectA.test selectC.test
  839. } -dbconfig {
  840. optimization_control $::dbhandle all 0
  841. }
  842. test_suite "prepare" -description {
  843. Run tests with the db connection using sqlite3_prepare() instead of _v2().
  844. } -dbconfig {
  845. db_use_legacy_prepare $::dbhandle 1
  846. #$::dbhandle cache size 0
  847. } -files [
  848. test_set $allquicktests -exclude *malloc* *ioerr* *fault*
  849. ]
  850. # End of tests
  851. #############################################################################
  852. # run_tests NAME OPTIONS
  853. #
  854. # where available options are:
  855. #
  856. # -description TITLE
  857. # -initialize SCRIPT
  858. # -shutdown SCRIPT
  859. # -presql SQL
  860. # -files LIST-OF-FILES
  861. # -prefix NAME
  862. #
  863. proc run_tests {name args} {
  864. array set options $args
  865. set ::G(perm:name) $name
  866. set ::G(perm:prefix) $options(-prefix)
  867. set ::G(perm:presql) $options(-presql)
  868. set ::G(isquick) 1
  869. set ::G(perm:dbconfig) $options(-dbconfig)
  870. uplevel $options(-initialize)
  871. foreach file [lsort $options(-files)] {
  872. if {[file tail $file] == $file} { set file [file join $::testdir $file] }
  873. slave_test_file $file
  874. }
  875. uplevel $options(-shutdown)
  876. unset ::G(perm:name)
  877. unset ::G(perm:prefix)
  878. unset ::G(perm:presql)
  879. unset ::G(perm:dbconfig)
  880. }
  881. proc run_test_suite {name} {
  882. if {[info exists ::testspec($name)]==0} {
  883. error "No such test suite: $name"
  884. }
  885. uplevel run_tests $name $::testspec($name)
  886. }
  887. proc help {} {
  888. puts "Usage: $::argv0 TESTSUITE ?TESTFILE?"
  889. puts ""
  890. puts "Available test-suites are:"
  891. foreach k $::testsuitelist {
  892. if {[info exists ::testspec($k)]==0} {
  893. puts " ----------------------------------------"
  894. puts ""
  895. } else {
  896. array set o $::testspec($k)
  897. puts "Test suite: \"$k\""
  898. set d [string trim $o(-description)]
  899. set d [regsub {\n *} $d "\n "]
  900. puts " $d"
  901. puts ""
  902. }
  903. }
  904. exit -1
  905. }
  906. if {[info script] == $argv0} {
  907. proc main {argv} {
  908. if {[llength $argv]==0} {
  909. help
  910. } else {
  911. set suite [lindex $argv 0]
  912. if {[info exists ::testspec($suite)]==0} help
  913. set extra ""
  914. if {[llength $argv]>1} { set extra [list -files [lrange $argv 1 end]] }
  915. eval run_tests $suite $::testspec($suite) $extra
  916. }
  917. }
  918. main $argv
  919. finish_test
  920. }