resolve upstream merge conflict in distclean
[sqlcipher.git] / test / releasetest_data.tcl
blob314331aeefbb798b2225f7b45d11f1fd08090c29
1 # 2019 August 01
3 # The author disclaims copyright to this source code. In place of
4 # a legal notice, here is a blessing:
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.
10 #***********************************************************************
12 # This file implements a program that produces scripts (either shell scripts
13 # or batch files) to implement a particular test that is part of the SQLite
14 # release testing procedure. For example, to run veryquick.test with a
15 # specified set of -D compiler switches.
17 # A "configuration" is a set of options passed to [./configure] and [make]
18 # to build the SQLite library in a particular fashion. A "platform" is a
19 # list of tests; most platforms are named after the hardware/OS platform
20 # that the tests will be run on as part of the release procedure. Each
21 # "test" is a combination of a configuration and a makefile target (e.g.
22 # "fulltest"). The program may be invoked as follows:
24 set USAGE {
25 $argv0 script ?-msvc? CONFIGURATION TARGET
26 Given a configuration and make target, return a bash (or, if -msvc
27 is specified, batch) script to execute the test. The first argument
28 passed to the script must be a directory containing SQLite source code.
30 $argv0 configurations
31 List available configurations.
33 $argv0 platforms
34 List available platforms.
36 $argv0 tests ?-nodebug? PLATFORM
37 List tests in a specified platform. If the -nodebug switch is
38 specified, synthetic debug/ndebug configurations are omitted. Each
39 test is a combination of a configuration and a makefile target.
42 # Omit comments (text between # and \n) in a long multi-line string.
44 proc strip_comments {in} {
45 regsub -all {#[^\n]*\n} $in {} out
46 return $out
49 array set ::Configs [strip_comments {
50 "Default" {
51 -O2
52 --disable-amalgamation --disable-shared
53 --enable-session
55 "Sanitize" {
56 CC=clang -fsanitize=address,undefined
57 -DSQLITE_ENABLE_STAT4
58 -DCONFIG_SLOWDOWN_FACTOR=5.0
59 --enable-debug
60 --enable-all
62 "Stdcall" {
63 -DUSE_STDCALL=1
64 -O2
66 "Have-Not" {
67 # The "Have-Not" configuration sets all possible -UHAVE_feature options
68 # in order to verify that the code works even on platforms that lack
69 # these support services.
70 -DHAVE_FDATASYNC=0
71 -DHAVE_GMTIME_R=0
72 -DHAVE_ISNAN=0
73 -DHAVE_LOCALTIME_R=0
74 -DHAVE_LOCALTIME_S=0
75 -DHAVE_MALLOC_USABLE_SIZE=0
76 -DHAVE_STRCHRNUL=0
77 -DHAVE_USLEEP=0
78 -DHAVE_UTIME=0
80 "Unlock-Notify" {
81 -O2
82 -DSQLITE_ENABLE_UNLOCK_NOTIFY
83 -DSQLITE_THREADSAFE
84 -DSQLITE_TCL_DEFAULT_FULLMUTEX=1
86 "User-Auth" {
87 -O2
88 -DSQLITE_USER_AUTHENTICATION=1
90 "Secure-Delete" {
91 -O2
92 -DSQLITE_SECURE_DELETE=1
93 -DSQLITE_SOUNDEX=1
95 "Update-Delete-Limit" {
96 -O2
97 -DSQLITE_DEFAULT_FILE_FORMAT=4
98 -DSQLITE_ENABLE_UPDATE_DELETE_LIMIT=1
99 -DSQLITE_ENABLE_STMT_SCANSTATUS
100 -DSQLITE_LIKE_DOESNT_MATCH_BLOBS
101 -DSQLITE_ENABLE_CURSOR_HINTS
103 "Check-Symbols" {
104 -DSQLITE_MEMDEBUG=1
105 -DSQLITE_ENABLE_FTS3_PARENTHESIS=1
106 -DSQLITE_ENABLE_FTS3=1
107 -DSQLITE_ENABLE_RTREE=1
108 -DSQLITE_ENABLE_MEMSYS5=1
109 -DSQLITE_ENABLE_MEMSYS3=1
110 -DSQLITE_ENABLE_COLUMN_METADATA=1
111 -DSQLITE_ENABLE_UPDATE_DELETE_LIMIT=1
112 -DSQLITE_SECURE_DELETE=1
113 -DSQLITE_SOUNDEX=1
114 -DSQLITE_ENABLE_ATOMIC_WRITE=1
115 -DSQLITE_ENABLE_MEMORY_MANAGEMENT=1
116 -DSQLITE_ENABLE_OVERSIZE_CELL_CHECK=1
117 -DSQLITE_ENABLE_STAT4
118 -DSQLITE_ENABLE_STMT_SCANSTATUS
119 --enable-fts5 --enable-session
121 "Debug-One" {
122 --disable-shared
123 -O2 -funsigned-char
124 -DSQLITE_DEBUG=1
125 -DSQLITE_MEMDEBUG=1
126 -DSQLITE_MUTEX_NOOP=1
127 -DSQLITE_TCL_DEFAULT_FULLMUTEX=1
128 -DSQLITE_ENABLE_FTS3=1
129 -DSQLITE_ENABLE_RTREE=1
130 -DSQLITE_ENABLE_MEMSYS5=1
131 -DSQLITE_ENABLE_COLUMN_METADATA=1
132 -DSQLITE_ENABLE_STAT4
133 -DSQLITE_ENABLE_HIDDEN_COLUMNS
134 -DSQLITE_MAX_ATTACHED=125
135 -DSQLITE_MUTATION_TEST
136 --enable-fts5
138 "Debug-Two" {
139 -DSQLITE_DEFAULT_MEMSTATUS=0
140 -DSQLITE_MAX_EXPR_DEPTH=0
141 --enable-debug
143 "Fast-One" {
145 -DSQLITE_ENABLE_FTS4=1
146 -DSQLITE_ENABLE_RTREE=1
147 -DSQLITE_ENABLE_STAT4
148 -DSQLITE_ENABLE_RBU
149 -DSQLITE_MAX_ATTACHED=125
150 -DSQLITE_MAX_MMAP_SIZE=12884901888
151 -DSQLITE_ENABLE_SORTER_MMAP=1
152 -DLONGDOUBLE_TYPE=double
153 --enable-session
155 "Device-One" {
157 -DSQLITE_DEBUG=1
158 -DSQLITE_DEFAULT_AUTOVACUUM=1
159 -DSQLITE_DEFAULT_CACHE_SIZE=64
160 -DSQLITE_DEFAULT_PAGE_SIZE=1024
161 -DSQLITE_DEFAULT_TEMP_CACHE_SIZE=32
162 -DSQLITE_DISABLE_LFS=1
163 -DSQLITE_ENABLE_ATOMIC_WRITE=1
164 -DSQLITE_ENABLE_IOTRACE=1
165 -DSQLITE_ENABLE_MEMORY_MANAGEMENT=1
166 -DSQLITE_MAX_PAGE_SIZE=4096
167 -DSQLITE_OMIT_LOAD_EXTENSION=1
168 -DSQLITE_OMIT_PROGRESS_CALLBACK=1
169 -DSQLITE_OMIT_VIRTUALTABLE=1
170 -DSQLITE_ENABLE_HIDDEN_COLUMNS
171 -DSQLITE_TEMP_STORE=3
173 "Device-Two" {
174 -DSQLITE_4_BYTE_ALIGNED_MALLOC=1
175 -DSQLITE_DEFAULT_AUTOVACUUM=1
176 -DSQLITE_DEFAULT_CACHE_SIZE=1000
177 -DSQLITE_DEFAULT_LOCKING_MODE=0
178 -DSQLITE_DEFAULT_PAGE_SIZE=1024
179 -DSQLITE_DEFAULT_TEMP_CACHE_SIZE=1000
180 -DSQLITE_DISABLE_LFS=1
181 -DSQLITE_ENABLE_FTS3=1
182 -DSQLITE_ENABLE_MEMORY_MANAGEMENT=1
183 -DSQLITE_ENABLE_RTREE=1
184 -DSQLITE_MAX_COMPOUND_SELECT=50
185 -DSQLITE_MAX_PAGE_SIZE=32768
186 -DSQLITE_OMIT_TRACE=1
187 -DSQLITE_TEMP_STORE=3
188 -DSQLITE_THREADSAFE=2
189 --enable-fts5 --enable-session
191 "Locking-Style" {
193 -DSQLITE_ENABLE_LOCKING_STYLE=1
195 "Apple" {
197 -DHAVE_GMTIME_R=1
198 -DHAVE_ISNAN=1
199 -DHAVE_LOCALTIME_R=1
200 -DHAVE_PREAD=1
201 -DHAVE_PWRITE=1
202 -DHAVE_UTIME=1
203 -DSQLITE_DEFAULT_CACHE_SIZE=1000
204 -DSQLITE_DEFAULT_CKPTFULLFSYNC=1
205 -DSQLITE_DEFAULT_MEMSTATUS=1
206 -DSQLITE_DEFAULT_PAGE_SIZE=1024
207 -DSQLITE_DISABLE_PAGECACHE_OVERFLOW_STATS=1
208 -DSQLITE_ENABLE_API_ARMOR=1
209 -DSQLITE_ENABLE_AUTO_PROFILE=1
210 -DSQLITE_ENABLE_FLOCKTIMEOUT=1
211 -DSQLITE_ENABLE_FTS3=1
212 -DSQLITE_ENABLE_FTS3_PARENTHESIS=1
213 -DSQLITE_ENABLE_FTS3_TOKENIZER=1
214 -DSQLITE_ENABLE_PERSIST_WAL=1
215 -DSQLITE_ENABLE_PURGEABLE_PCACHE=1
216 -DSQLITE_ENABLE_RTREE=1
217 -DSQLITE_ENABLE_SNAPSHOT=1
218 # -DSQLITE_ENABLE_SQLLOG=1
219 -DSQLITE_ENABLE_UPDATE_DELETE_LIMIT=1
220 -DSQLITE_MAX_LENGTH=2147483645
221 -DSQLITE_MAX_VARIABLE_NUMBER=500000
222 # -DSQLITE_MEMDEBUG=1
223 -DSQLITE_NO_SYNC=1
224 -DSQLITE_OMIT_AUTORESET=1
225 -DSQLITE_OMIT_LOAD_EXTENSION=1
226 -DSQLITE_PREFER_PROXY_LOCKING=1
227 -DSQLITE_SERIES_CONSTRAINT_VERIFY=1
228 -DSQLITE_THREADSAFE=2
229 -DSQLITE_USE_URI=1
230 -DSQLITE_WRITE_WALFRAME_PREBUFFERED=1
231 -DUSE_GUARDED_FD=1
232 -DUSE_PREAD=1
233 --enable-fts5
235 "Extra-Robustness" {
236 -DSQLITE_ENABLE_OVERSIZE_CELL_CHECK=1
237 -DSQLITE_MAX_ATTACHED=62
239 "Devkit" {
240 -DSQLITE_DEFAULT_FILE_FORMAT=4
241 -DSQLITE_MAX_ATTACHED=30
242 -DSQLITE_ENABLE_COLUMN_METADATA
243 -DSQLITE_ENABLE_FTS4
244 -DSQLITE_ENABLE_FTS5
245 -DSQLITE_ENABLE_FTS4_PARENTHESIS
246 -DSQLITE_DISABLE_FTS4_DEFERRED
247 -DSQLITE_ENABLE_RTREE
248 --enable-fts5
250 "No-lookaside" {
251 -DSQLITE_TEST_REALLOC_STRESS=1
252 -DSQLITE_OMIT_LOOKASIDE=1
254 "Valgrind" {
255 -DSQLITE_ENABLE_STAT4
256 -DSQLITE_ENABLE_FTS4
257 -DSQLITE_ENABLE_RTREE
258 -DSQLITE_ENABLE_HIDDEN_COLUMNS
259 -DCONFIG_SLOWDOWN_FACTOR=8.0
262 "Windows-Memdebug" {
263 MEMDEBUG=1
264 DEBUG=3
266 "Windows-Win32Heap" {
267 WIN32HEAP=1
268 DEBUG=4
271 # The next group of configurations are used only by the
272 # Failure-Detection platform. They are all the same, but we need
273 # different names for them all so that they results appear in separate
274 # subdirectories.
276 Fail0 {-O0}
277 Fail2 {-O0}
278 Fail3 {-O0}
279 Fail4 {-O0}
280 FuzzFail1 {-O0}
281 FuzzFail2 {-O0}
283 if {$tcl_platform(os)=="Darwin"} {
284 lappend Configs(Apple) -DSQLITE_ENABLE_LOCKING_STYLE=1
287 array set ::Platforms [strip_comments {
288 Linux-x86_64 {
289 "Check-Symbols*" "" checksymbols
290 "Fast-One" QUICKTEST_INCLUDE=rbu.test "fuzztest test"
291 "Debug-One" "" "mptest test"
292 "Debug-Two" "" test
293 "Have-Not" "" test
294 "Secure-Delete" "" test
295 "Unlock-Notify" QUICKTEST_INCLUDE=notify2.test test
296 "User-Auth" "" tcltest
297 "Update-Delete-Limit" "" test
298 "Extra-Robustness" "" test
299 "Device-Two" "" "threadtest test"
300 "No-lookaside" "" test
301 "Devkit" "" test
302 "Apple" "" test
303 "Sanitize*" "" test
304 "Device-One" "" alltest
305 "Default" "" "threadtest fuzztest alltest"
306 "Valgrind*" "" valgrindtest
308 Linux-i686 {
309 "Devkit" "" test
310 "Have-Not" "" test
311 "Unlock-Notify" QUICKTEST_INCLUDE=notify2.test test
312 "Device-One" "" test
313 "Device-Two" "" test
314 "Default" "" "threadtest fuzztest alltest"
316 Darwin-i386 {
317 "Locking-Style" "" "mptest test"
318 "Have-Not" "" test
319 "Apple" "" "threadtest fuzztest alltest"
321 Darwin-x86_64 {
322 "Locking-Style" "" "mptest test"
323 "Have-Not" "" test
324 "Apple" "" "threadtest fuzztest alltest"
326 Darwin-arm64 {
327 "Locking-Style" "" "mptest test"
328 "Have-Not" "" test
329 "Apple" "" "threadtest fuzztest alltest"
331 "Windows NT-intel" {
332 "Stdcall" "" test
333 "Have-Not" "" test
334 "Windows-Memdebug*" "" test
335 "Windows-Win32Heap*" "" test
336 "Default" "" "mptest fulltestonly"
338 "Windows NT-amd64" {
339 "Stdcall" "" test
340 "Have-Not" "" test
341 "Windows-Memdebug*" "" test
342 "Windows-Win32Heap*" "" test
343 "Default" "" "mptest fulltestonly"
346 # The Failure-Detection platform runs various tests that deliberately
347 # fail. This is used as a test of this script to verify that this script
348 # correctly identifies failures.
350 Failure-Detection {
351 Fail0* "TEST_FAILURE=0" test
352 Sanitize* "TEST_FAILURE=1" test
353 Fail2* "TEST_FAILURE=2" valgrindtest
354 Fail3* "TEST_FAILURE=3" valgrindtest
355 Fail4* "TEST_FAILURE=4" test
356 FuzzFail1* "TEST_FAILURE=5" test
357 FuzzFail2* "TEST_FAILURE=5" valgrindtest
361 #--------------------------------------------------------------------------
362 #--------------------------------------------------------------------------
363 #--------------------------------------------------------------------------
364 # End of configuration section.
365 #--------------------------------------------------------------------------
366 #--------------------------------------------------------------------------
367 #--------------------------------------------------------------------------
369 # Configuration verification: Check that each entry in the list of configs
370 # specified for each platforms exists.
372 foreach {key value} [array get ::Platforms] {
373 foreach {v vars t} $value {
374 if {[string range $v end end]=="*"} {
375 set v [string range $v 0 end-1]
377 if {0==[info exists ::Configs($v)]} {
378 puts stderr "No such configuration: \"$v\""
379 exit -1
384 proc usage {} {
385 global argv0
386 puts stderr [subst $::USAGE]
387 exit 1
390 proc is_prefix {p str min} {
391 set n [string length $p]
392 if {$n<$min} { return 0 }
393 if {[string range $str 0 [expr $n-1]]!=$p} { return 0 }
394 return 1
397 proc main_configurations {} {
398 foreach k [lsort [array names ::Configs]] {
399 puts $k
403 proc main_platforms {} {
404 foreach k [lsort [array names ::Platforms]] {
405 puts "\"$k\""
409 proc main_script {args} {
410 set bMsvc 0
411 set nArg [llength $args]
412 if {$nArg==3} {
413 if {![is_prefix [lindex $args 0] -msvc 2]} usage
414 set bMsvc 1
415 } elseif {$nArg<2 || $nArg>3} {
416 usage
418 set config [lindex $args end-1]
419 set target [lindex $args end]
421 set opts [list] ;# OPTS value
422 set cflags [expr {$bMsvc ? "-Zi" : "-g"}] ;# CFLAGS value
423 set makeOpts [list] ;# Extra args for [make]
424 set configOpts [list] ;# Extra args for [configure]
426 if {$::tcl_platform(platform)=="windows" || $bMsvc} {
427 lappend opts -DSQLITE_OS_WIN=1
428 } else {
429 lappend opts -DSQLITE_OS_UNIX=1
432 # Figure out if this is a synthetic ndebug or debug configuration.
434 set bRemoveDebug 0
435 if {[string match *-ndebug $config]} {
436 set bRemoveDebug 1
437 set config [string range $config 0 end-7]
439 if {[string match *-debug $config]} {
440 lappend opts -DSQLITE_DEBUG
441 lappend opts -DSQLITE_EXTRA_IFNULLROW
442 set config [string range $config 0 end-6]
444 regexp {^(.*)-[0-9]+} $config -> config
446 # Ensure that the named configuration exists.
448 if {![info exists ::Configs($config)]} {
449 puts stderr "No such config: $config"
450 exit 1
453 # Loop through the parameters of the nominated configuration, updating
454 # $opts, $cflags, $makeOpts and $configOpts along the way. Rules are as
455 # follows:
457 # 1. If the parameter begins with a "*", discard it.
459 # 2. If $bRemoveDebug is set and the parameter is -DSQLITE_DEBUG or
460 # -DSQLITE_DEBUG=1, discard it
462 # 3. If the parameter begins with "-D", add it to $opts.
464 # 4. If the parameter begins with "--" add it to $configOpts. Unless
465 # this command is preparing a script for MSVC - then add an
466 # equivalent to $makeOpts or $opts.
468 # 5. If the parameter begins with "-" add it to $cflags. If in MSVC
469 # mode and the parameter is an -O<integer> option, instead add
470 # an OPTIMIZATIONS=<integer> switch to $makeOpts.
472 # 6. If none of the above apply, add the parameter to $makeOpts
474 foreach param $::Configs($config) {
475 if {[string range $param 0 0]=="*"} continue
477 if {$bRemoveDebug} {
478 if {$param=="-DSQLITE_DEBUG" || $param=="-DSQLITE_DEBUG=1"
479 || $param=="-DSQLITE_MEMDEBUG" || $param=="-DSQLITE_MEMDEBUG=1"
480 || $param=="--enable-debug"
482 continue
486 if {[string range $param 0 1]=="-D"} {
487 lappend opts $param
488 continue
491 if {[string range $param 0 1]=="--"} {
492 if {$bMsvc} {
493 switch -- $param {
494 --disable-amalgamation {
495 lappend makeOpts USE_AMALGAMATION=0
497 --disable-shared {
498 lappend makeOpts USE_CRT_DLL=0 DYNAMIC_SHELL=0
500 --enable-fts5 {
501 lappend opts -DSQLITE_ENABLE_FTS5
503 --enable-shared {
504 lappend makeOpts USE_CRT_DLL=1 DYNAMIC_SHELL=1
506 --enable-session {
507 lappend opts -DSQLITE_ENABLE_PREUPDATE_HOOK
508 lappend opts -DSQLITE_ENABLE_SESSION
510 default {
511 error "Cannot translate $param for MSVC"
514 } else {
515 lappend configOpts $param
518 continue
521 if {[string range $param 0 0]=="-"} {
522 if {$bMsvc && [regexp -- {^-O(\d+)$} $param -> level]} {
523 lappend makeOpts OPTIMIZATIONS=$level
524 } else {
525 lappend cflags $param
527 continue
530 lappend makeOpts $param
533 # Some configurations specify -DHAVE_USLEEP=0. For all others, add
534 # -DHAVE_USLEEP=1.
536 if {[lsearch $opts "-DHAVE_USLEEP=0"]<0} {
537 lappend opts -DHAVE_USLEEP=1
540 if {$bMsvc==0} {
541 puts {set -e}
542 puts {}
543 puts {if [ "$#" -ne 1 ] ; then}
544 puts { echo "Usage: $0 <sqlite-src-dir>" }
545 puts { exit -1 }
546 puts {fi }
547 puts {SRCDIR=$1}
548 puts {}
549 puts "TCL=\"[::tcl::pkgconfig get libdir,install]\""
551 puts "\$SRCDIR/configure --with-tcl=\$TCL $configOpts"
552 puts {}
553 puts {OPTS=" -DSQLITE_NO_SYNC=1"}
554 foreach o $opts {
555 puts "OPTS=\"\$OPTS $o\""
557 puts {}
558 puts "CFLAGS=\"$cflags\""
559 puts {}
560 puts "make $target \"CFLAGS=\$CFLAGS\" \"OPTS=\$OPTS\" $makeOpts"
561 } else {
563 puts {set SRCDIR=%1}
564 set makecmd "nmake /f %SRCDIR%\\Makefile.msc TOP=%SRCDIR% $target "
565 append makecmd "\"CFLAGS=$cflags\" \"OPTS=$opts\" $makeOpts"
567 puts "set TMP=%CD%"
568 puts $makecmd
572 proc main_tests {args} {
573 set bNodebug 0
574 set nArg [llength $args]
575 if {$nArg==2} {
576 if {[is_prefix [lindex $args 0] -nodebug 2]} {
577 set bNodebug 1
578 } elseif {[is_prefix [lindex $args 0] -debug 2]} {
579 set bNodebug 0
580 } else usage
581 } elseif {$nArg==0 || $nArg>2} {
582 usage
584 set p [lindex $args end]
585 if {![info exists ::Platforms($p)]} {
586 puts stderr "No such platform: $p"
587 exit 1
590 set lTest [list]
592 foreach {config vars target} $::Platforms($p) {
593 if {[string range $config end end]=="*"} {
594 set config [string range $config 0 end-1]
595 } elseif {$bNodebug==0} {
596 set dtarget test
597 if {[lsearch $target fuzztest]<0 && [lsearch $target test]<0} {
598 set dtarget tcltest
600 if {$vars!=""} { set dtarget "$vars $dtarget" }
602 if {[string first SQLITE_DEBUG $::Configs($config)]>=0
603 || [string first --enable-debug $::Configs($config)]>=0
605 lappend lTest "$config-ndebug \"$dtarget\""
606 } else {
607 lappend lTest "$config-debug \"$dtarget\""
611 if {[llength $target]==1 && ([string match "*TEST_FAILURE*" $vars] || (
612 [lsearch $target "valgrindtest"]<0
613 && [lsearch $target "alltest"]<0
614 && [lsearch $target "fulltestonly"]<0
615 && ![string match Sanitize* $config]
616 ))} {
617 if {$vars!=""} { set target "$vars $target" }
618 lappend lTest "$config \"$target\""
619 } else {
620 set idir -1
621 foreach t $target {
622 if {$t=="valgrindtest" || $t=="alltest" || $t=="fulltestonly"
623 || [string match Sanitize* $config]
625 if {$vars!=""} { set t "$vars $t" }
626 for {set ii 1} {$ii<=4} {incr ii} {
627 lappend lTest "$config-[incr idir] \"TCLTEST_PART=$ii/4 $t\""
629 } else {
630 if {$vars!=""} { set t "$vars $t" }
631 lappend lTest "$config-[incr idir] \"$t\""
637 foreach l $lTest {
638 puts $l
643 if {[llength $argv]==0} { usage }
644 set cmd [lindex $argv 0]
645 set n [expr [llength $argv]-1]
646 if {[string match ${cmd}* configurations] && $n==0} {
647 main_configurations
648 } elseif {[string match ${cmd}* script]} {
649 main_script {*}[lrange $argv 1 end]
650 } elseif {[string match ${cmd}* platforms] && $n==0} {
651 main_platforms
652 } elseif {[string match ${cmd}* tests]} {
653 main_tests {*}[lrange $argv 1 end]
654 } else {
655 usage