Merge branch 'prerelease' of ssh://git.zetetic.net/sqlcipher into prerelease
[sqlcipher.git] / test / releasetest_data.tcl
blobbd3f108118aafbd4a6631ff220980546f065b5f2
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 platforms
26 List available platforms.
28 $argv0 tests ?-nodebug? PLATFORM
29 List tests in a specified platform. If the -nodebug switch is
30 specified, synthetic debug/ndebug configurations are omitted. Each
31 test is a combination of a configuration and a makefile target.
33 $argv0 script ?-msvc? CONFIGURATION TARGET
34 Given a configuration and make target, return a bash (or, if -msvc
35 is specified, batch) script to execute the test. The first argument
36 passed to the script must be a directory containing SQLite source code.
38 $argv0 configurations
39 List available configurations.
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
54 -DSQLITE_ENABLE_DESERIALIZE
56 "Sanitize" {
57 CC=clang -fsanitize=undefined
58 -DSQLITE_ENABLE_STAT4
59 --enable-session
61 "Stdcall" {
62 -DUSE_STDCALL=1
63 -O2
65 "Have-Not" {
66 # The "Have-Not" configuration sets all possible -UHAVE_feature options
67 # in order to verify that the code works even on platforms that lack
68 # these support services.
69 -DHAVE_FDATASYNC=0
70 -DHAVE_GMTIME_R=0
71 -DHAVE_ISNAN=0
72 -DHAVE_LOCALTIME_R=0
73 -DHAVE_LOCALTIME_S=0
74 -DHAVE_MALLOC_USABLE_SIZE=0
75 -DHAVE_STRCHRNUL=0
76 -DHAVE_USLEEP=0
77 -DHAVE_UTIME=0
79 "Unlock-Notify" {
80 -O2
81 -DSQLITE_ENABLE_UNLOCK_NOTIFY
82 -DSQLITE_THREADSAFE
83 -DSQLITE_TCL_DEFAULT_FULLMUTEX=1
85 "User-Auth" {
86 -O2
87 -DSQLITE_USER_AUTHENTICATION=1
89 "Secure-Delete" {
90 -O2
91 -DSQLITE_SECURE_DELETE=1
92 -DSQLITE_SOUNDEX=1
94 "Update-Delete-Limit" {
95 -O2
96 -DSQLITE_DEFAULT_FILE_FORMAT=4
97 -DSQLITE_ENABLE_UPDATE_DELETE_LIMIT=1
98 -DSQLITE_ENABLE_STMT_SCANSTATUS
99 -DSQLITE_LIKE_DOESNT_MATCH_BLOBS
100 -DSQLITE_ENABLE_CURSOR_HINTS
101 --enable-json1
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-json1 --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 --enable-json1
138 "Fast-One" {
140 -DSQLITE_ENABLE_FTS4=1
141 -DSQLITE_ENABLE_RTREE=1
142 -DSQLITE_ENABLE_STAT4
143 -DSQLITE_ENABLE_RBU
144 -DSQLITE_MAX_ATTACHED=125
145 -DLONGDOUBLE_TYPE=double
146 --enable-session
148 "Device-One" {
150 -DSQLITE_DEBUG=1
151 -DSQLITE_DEFAULT_AUTOVACUUM=1
152 -DSQLITE_DEFAULT_CACHE_SIZE=64
153 -DSQLITE_DEFAULT_PAGE_SIZE=1024
154 -DSQLITE_DEFAULT_TEMP_CACHE_SIZE=32
155 -DSQLITE_DISABLE_LFS=1
156 -DSQLITE_ENABLE_ATOMIC_WRITE=1
157 -DSQLITE_ENABLE_IOTRACE=1
158 -DSQLITE_ENABLE_MEMORY_MANAGEMENT=1
159 -DSQLITE_MAX_PAGE_SIZE=4096
160 -DSQLITE_OMIT_LOAD_EXTENSION=1
161 -DSQLITE_OMIT_PROGRESS_CALLBACK=1
162 -DSQLITE_OMIT_VIRTUALTABLE=1
163 -DSQLITE_ENABLE_HIDDEN_COLUMNS
164 -DSQLITE_TEMP_STORE=3
165 --enable-json1
167 "Device-Two" {
168 -DSQLITE_4_BYTE_ALIGNED_MALLOC=1
169 -DSQLITE_DEFAULT_AUTOVACUUM=1
170 -DSQLITE_DEFAULT_CACHE_SIZE=1000
171 -DSQLITE_DEFAULT_LOCKING_MODE=0
172 -DSQLITE_DEFAULT_PAGE_SIZE=1024
173 -DSQLITE_DEFAULT_TEMP_CACHE_SIZE=1000
174 -DSQLITE_DISABLE_LFS=1
175 -DSQLITE_ENABLE_FTS3=1
176 -DSQLITE_ENABLE_MEMORY_MANAGEMENT=1
177 -DSQLITE_ENABLE_RTREE=1
178 -DSQLITE_MAX_COMPOUND_SELECT=50
179 -DSQLITE_MAX_PAGE_SIZE=32768
180 -DSQLITE_OMIT_TRACE=1
181 -DSQLITE_TEMP_STORE=3
182 -DSQLITE_THREADSAFE=2
183 -DSQLITE_ENABLE_DESERIALIZE=1
184 --enable-json1 --enable-fts5 --enable-session
186 "Locking-Style" {
188 -DSQLITE_ENABLE_LOCKING_STYLE=1
190 "Apple" {
192 -DHAVE_GMTIME_R=1
193 -DHAVE_ISNAN=1
194 -DHAVE_LOCALTIME_R=1
195 -DHAVE_PREAD=1
196 -DHAVE_PWRITE=1
197 -DHAVE_UTIME=1
198 -DSQLITE_DEFAULT_CACHE_SIZE=1000
199 -DSQLITE_DEFAULT_CKPTFULLFSYNC=1
200 -DSQLITE_DEFAULT_MEMSTATUS=1
201 -DSQLITE_DEFAULT_PAGE_SIZE=1024
202 -DSQLITE_DISABLE_PAGECACHE_OVERFLOW_STATS=1
203 -DSQLITE_ENABLE_API_ARMOR=1
204 -DSQLITE_ENABLE_AUTO_PROFILE=1
205 -DSQLITE_ENABLE_FLOCKTIMEOUT=1
206 -DSQLITE_ENABLE_FTS3=1
207 -DSQLITE_ENABLE_FTS3_PARENTHESIS=1
208 -DSQLITE_ENABLE_FTS3_TOKENIZER=1
209 -DSQLITE_ENABLE_PERSIST_WAL=1
210 -DSQLITE_ENABLE_PURGEABLE_PCACHE=1
211 -DSQLITE_ENABLE_RTREE=1
212 -DSQLITE_ENABLE_SNAPSHOT=1
213 # -DSQLITE_ENABLE_SQLLOG=1
214 -DSQLITE_ENABLE_UPDATE_DELETE_LIMIT=1
215 -DSQLITE_MAX_LENGTH=2147483645
216 -DSQLITE_MAX_VARIABLE_NUMBER=500000
217 # -DSQLITE_MEMDEBUG=1
218 -DSQLITE_NO_SYNC=1
219 -DSQLITE_OMIT_AUTORESET=1
220 -DSQLITE_OMIT_LOAD_EXTENSION=1
221 -DSQLITE_PREFER_PROXY_LOCKING=1
222 -DSQLITE_SERIES_CONSTRAINT_VERIFY=1
223 -DSQLITE_THREADSAFE=2
224 -DSQLITE_USE_URI=1
225 -DSQLITE_WRITE_WALFRAME_PREBUFFERED=1
226 -DUSE_GUARDED_FD=1
227 -DUSE_PREAD=1
228 --enable-json1 --enable-fts5
230 "Extra-Robustness" {
231 -DSQLITE_ENABLE_OVERSIZE_CELL_CHECK=1
232 -DSQLITE_MAX_ATTACHED=62
234 "Devkit" {
235 -DSQLITE_DEFAULT_FILE_FORMAT=4
236 -DSQLITE_MAX_ATTACHED=30
237 -DSQLITE_ENABLE_COLUMN_METADATA
238 -DSQLITE_ENABLE_FTS4
239 -DSQLITE_ENABLE_FTS5
240 -DSQLITE_ENABLE_FTS4_PARENTHESIS
241 -DSQLITE_DISABLE_FTS4_DEFERRED
242 -DSQLITE_ENABLE_RTREE
243 --enable-json1 --enable-fts5
245 "No-lookaside" {
246 -DSQLITE_TEST_REALLOC_STRESS=1
247 -DSQLITE_OMIT_LOOKASIDE=1
249 "Valgrind" {
250 -DSQLITE_ENABLE_STAT4
251 -DSQLITE_ENABLE_FTS4
252 -DSQLITE_ENABLE_RTREE
253 -DSQLITE_ENABLE_HIDDEN_COLUMNS
254 --enable-json1
257 "Windows-Memdebug" {
258 MEMDEBUG=1
259 DEBUG=3
261 "Windows-Win32Heap" {
262 WIN32HEAP=1
263 DEBUG=4
266 # The next group of configurations are used only by the
267 # Failure-Detection platform. They are all the same, but we need
268 # different names for them all so that they results appear in separate
269 # subdirectories.
271 Fail0 {-O0}
272 Fail2 {-O0}
273 Fail3 {-O0}
274 Fail4 {-O0}
275 FuzzFail1 {-O0}
276 FuzzFail2 {-O0}
278 if {$tcl_platform(os)=="Darwin"} {
279 lappend Configs(Apple -DSQLITE_ENABLE_LOCKING_STYLE=1
282 array set ::Platforms [strip_comments {
283 Linux-x86_64 {
284 "Check-Symbols*" checksymbols
285 "Fast-One" "fuzztest test"
286 "Debug-One" "mptest test"
287 "Have-Not" test
288 "Secure-Delete" test
289 "Unlock-Notify" "QUICKTEST_INCLUDE=notify2.test test"
290 "User-Auth" tcltest
291 "Update-Delete-Limit" test
292 "Extra-Robustness" test
293 "Device-Two" "threadtest test"
294 "No-lookaside" test
295 "Devkit" test
296 "Apple" test
297 "Sanitize" {QUICKTEST_OMIT=func4.test,nan.test test}
298 "Device-One" fulltest
299 "Default" "threadtest fulltest"
300 "Valgrind*" valgrindtest
302 Linux-i686 {
303 "Devkit" test
304 "Have-Not" test
305 "Unlock-Notify" "QUICKTEST_INCLUDE=notify2.test test"
306 "Device-One" test
307 "Device-Two" test
308 "Default" "threadtest fulltest"
310 Darwin-i386 {
311 "Locking-Style" "mptest test"
312 "Have-Not" test
313 "Apple" "threadtest fulltest"
315 Darwin-x86_64 {
316 "Locking-Style" "mptest test"
317 "Have-Not" test
318 "Apple" "threadtest fulltest"
320 "Windows NT-intel" {
321 "Stdcall" test
322 "Have-Not" test
323 "Windows-Memdebug*" test
324 "Windows-Win32Heap*" test
325 "Default" "mptest fulltestonly"
327 "Windows NT-amd64" {
328 "Stdcall" test
329 "Have-Not" test
330 "Windows-Memdebug*" test
331 "Windows-Win32Heap*" test
332 "Default" "mptest fulltestonly"
335 # The Failure-Detection platform runs various tests that deliberately
336 # fail. This is used as a test of this script to verify that this script
337 # correctly identifies failures.
339 Failure-Detection {
340 Fail0* "TEST_FAILURE=0 test"
341 Sanitize* "TEST_FAILURE=1 test"
342 Fail2* "TEST_FAILURE=2 valgrindtest"
343 Fail3* "TEST_FAILURE=3 valgrindtest"
344 Fail4* "TEST_FAILURE=4 test"
345 FuzzFail1* "TEST_FAILURE=5 test"
346 FuzzFail2* "TEST_FAILURE=5 valgrindtest"
350 # Configuration verification: Check that each entry in the list of configs
351 # specified for each platforms exists.
353 foreach {key value} [array get ::Platforms] {
354 foreach {v t} $value {
355 if {[string range $v end end]=="*"} {
356 set v [string range $v 0 end-1]
358 if {0==[info exists ::Configs($v)]} {
359 puts stderr "No such configuration: \"$v\""
360 exit -1
365 proc usage {} {
366 global argv0
367 puts stderr [subst $::USAGE]
368 exit 1
371 proc is_prefix {p str min} {
372 set n [string length $p]
373 if {$n<$min} { return 0 }
374 if {[string range $str 0 [expr $n-1]]!=$p} { return 0 }
375 return 1
378 proc main_configurations {} {
379 foreach k [lsort [array names ::Configs]] {
380 puts $k
384 proc main_platforms {} {
385 foreach k [lsort [array names ::Platforms]] {
386 puts "\"$k\""
390 proc main_script {args} {
391 set bMsvc 0
392 set nArg [llength $args]
393 if {$nArg==3} {
394 if {![is_prefix [lindex $args 0] -msvc 2]} usage
395 set bMsvc 1
396 } elseif {$nArg<2 || $nArg>3} {
397 usage
399 set config [lindex $args end-1]
400 set target [lindex $args end]
402 set opts [list] ;# OPTS value
403 set cflags [expr {$bMsvc ? "-Zi" : "-g"}] ;# CFLAGS value
404 set makeOpts [list] ;# Extra args for [make]
405 set configOpts [list] ;# Extra args for [configure]
407 if {$::tcl_platform(platform)=="windows" || $bMsvc} {
408 lappend opts -DSQLITE_OS_WIN=1
409 } else {
410 lappend opts -DSQLITE_OS_UNIX=1
413 # Figure out if this is a synthetic ndebug or debug configuration.
415 set bRemoveDebug 0
416 if {[string match *-ndebug $config]} {
417 set bRemoveDebug 1
418 set config [string range $config 0 end-7]
420 if {[string match *-debug $config]} {
421 lappend opts -DSQLITE_DEBUG
422 lappend opts -DSQLITE_EXTRA_IFNULLROW
423 set config [string range $config 0 end-6]
426 # Ensure that the named configuration exists.
428 if {![info exists ::Configs($config)]} {
429 puts stderr "No such config: $config"
430 exit 1
433 # Loop through the parameters of the nominated configuration, updating
434 # $opts, $cflags, $makeOpts and $configOpts along the way. Rules are as
435 # follows:
437 # 1. If the parameter begins with a "*", discard it.
439 # 2. If $bRemoveDebug is set and the parameter is -DSQLITE_DEBUG or
440 # -DSQLITE_DEBUG=1, discard it
442 # 3. If the parameter begins with "-D", add it to $opts.
444 # 4. If the parameter begins with "--" add it to $configOpts. Unless
445 # this command is preparing a script for MSVC - then add an
446 # equivalent to $makeOpts or $opts.
448 # 5. If the parameter begins with "-" add it to $cflags. If in MSVC
449 # mode and the parameter is an -O<integer> option, instead add
450 # an OPTIMIZATIONS=<integer> switch to $makeOpts.
452 # 6. If none of the above apply, add the parameter to $makeOpts
454 foreach param $::Configs($config) {
455 if {[string range $param 0 0]=="*"} continue
457 if {$bRemoveDebug} {
458 if {$param=="-DSQLITE_DEBUG" || $param=="-DSQLITE_DEBUG=1"
459 || $param=="-DSQLITE_MEMDEBUG" || $param=="-DSQLITE_MEMDEBUG=1"
461 continue
465 if {[string range $param 0 1]=="-D"} {
466 lappend opts $param
467 continue
470 if {[string range $param 0 1]=="--"} {
471 if {$bMsvc} {
472 switch -- $param {
473 --disable-amalgamation {
474 lappend makeOpts USE_AMALGAMATION=0
476 --disable-shared {
477 lappend makeOpts USE_CRT_DLL=0 DYNAMIC_SHELL=0
479 --enable-fts5 {
480 lappend opts -DSQLITE_ENABLE_FTS5
482 --enable-json1 {
483 lappend opts -DSQLITE_ENABLE_JSON1
485 --enable-shared {
486 lappend makeOpts USE_CRT_DLL=1 DYNAMIC_SHELL=1
488 --enable-session {
489 lappend opts -DSQLITE_ENABLE_PREUPDATE_HOOK
490 lappend opts -DSQLITE_ENABLE_SESSION
492 default {
493 error "Cannot translate $param for MSVC"
496 } else {
497 lappend configOpts $param
500 continue
503 if {[string range $param 0 0]=="-"} {
504 if {$bMsvc && [regexp -- {^-O(\d+)$} $param -> level]} {
505 lappend makeOpts OPTIMIZATIONS=$level
506 } else {
507 lappend cflags $param
509 continue
512 lappend makeOpts $param
515 # Some configurations specify -DHAVE_USLEEP=0. For all others, add
516 # -DHAVE_USLEEP=1.
518 if {[lsearch $opts "-DHAVE_USLEEP=0"]<0} {
519 lappend opts -DHAVE_USLEEP=1
522 if {$bMsvc==0} {
523 puts {set -e}
524 puts {}
525 puts {if [ "$#" -ne 1 ] ; then}
526 puts { echo "Usage: $0 <sqlite-src-dir>" }
527 puts { exit -1 }
528 puts {fi }
529 puts {SRCDIR=$1}
530 puts {}
531 puts "TCL=\"[::tcl::pkgconfig get libdir,install]\""
533 puts "\$SRCDIR/configure --with-tcl=\$TCL $configOpts"
534 puts {}
535 puts {OPTS=" -DSQLITE_NO_SYNC=1"}
536 foreach o $opts {
537 puts "OPTS=\"\$OPTS $o\""
539 puts {}
540 puts "CFLAGS=\"$cflags\""
541 puts {}
542 puts "make $target \"CFLAGS=\$CFLAGS\" \"OPTS=\$OPTS\" $makeOpts"
543 } else {
545 puts {set SRCDIR=%1}
546 set makecmd "nmake /f %SRCDIR%\\Makefile.msc TOP=%SRCDIR% $target "
547 append makecmd "\"CFLAGS=$cflags\" \"OPTS=$opts\" $makeOpts"
549 puts "set TMP=%CD%"
550 puts $makecmd
554 proc main_tests {args} {
555 set bNodebug 0
556 set nArg [llength $args]
557 if {$nArg==2} {
558 if {[is_prefix [lindex $args 0] -nodebug 2]} {
559 set bNodebug 1
560 } elseif {[is_prefix [lindex $args 0] -debug 2]} {
561 set bNodebug 0
562 } else usage
563 } elseif {$nArg==0 || $nArg>2} {
564 usage
566 set p [lindex $args end]
567 if {![info exists ::Platforms($p)]} {
568 puts stderr "No such platform: $p"
569 exit 1
572 foreach {config target} $::Platforms($p) {
573 set bNosynthetic 0
574 if {[string range $config end end]=="*"} {
575 set bNosynthetic 1
576 set config [string range $config 0 end-1]
578 puts "$config \"$target\""
579 if {$bNodebug==0 && $bNosynthetic==0} {
580 set iHas [string first SQLITE_DEBUG $::Configs($config)]
581 set dtarget test
582 if {$target=="tcltest"} {
583 set dtarget tcltest
585 if {$iHas>=0} {
586 puts "$config-ndebug \"$dtarget\""
587 } else {
588 puts "$config-debug \"$dtarget\""
594 if {[llength $argv]==0} { usage }
595 set cmd [lindex $argv 0]
596 set n [expr [llength $argv]-1]
597 if {[string match ${cmd}* configurations] && $n==0} {
598 main_configurations
599 } elseif {[string match ${cmd}* script]} {
600 main_script {*}[lrange $argv 1 end]
601 } elseif {[string match ${cmd}* platforms] && $n==0} {
602 main_platforms
603 } elseif {[string match ${cmd}* tests]} {
604 main_tests {*}[lrange $argv 1 end]
605 } else {
606 usage