standardize flag handling
[sqlcipher.git] / test / releasetest_data.tcl
blob2f4e71e8cef622d70de6f8e691490f9546c9164f
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
54 -DSQLITE_ENABLE_RBU
56 "Sanitize" {
57 CC=clang -fsanitize=address,undefined
58 -DSQLITE_ENABLE_STAT4
59 -DCONFIG_SLOWDOWN_FACTOR=5.0
60 --enable-debug
61 --enable-all
63 "Stdcall" {
64 -DUSE_STDCALL=1
65 -O2
67 "Have-Not" {
68 # The "Have-Not" configuration sets all possible -UHAVE_feature options
69 # in order to verify that the code works even on platforms that lack
70 # these support services.
71 -DHAVE_FDATASYNC=0
72 -DHAVE_GMTIME_R=0
73 -DHAVE_ISNAN=0
74 -DHAVE_LOCALTIME_R=0
75 -DHAVE_LOCALTIME_S=0
76 -DHAVE_MALLOC_USABLE_SIZE=0
77 -DHAVE_STRCHRNUL=0
78 -DHAVE_USLEEP=0
79 -DHAVE_UTIME=0
81 "Unlock-Notify" {
82 -O2
83 -DSQLITE_ENABLE_UNLOCK_NOTIFY
84 -DSQLITE_THREADSAFE
85 -DSQLITE_TCL_DEFAULT_FULLMUTEX=1
87 "User-Auth" {
88 -O2
89 -DSQLITE_USER_AUTHENTICATION=1
91 "Secure-Delete" {
92 -O2
93 -DSQLITE_SECURE_DELETE=1
94 -DSQLITE_SOUNDEX=1
96 "Update-Delete-Limit" {
97 -O2
98 -DSQLITE_DEFAULT_FILE_FORMAT=4
99 -DSQLITE_ENABLE_UPDATE_DELETE_LIMIT=1
100 -DSQLITE_ENABLE_STMT_SCANSTATUS
101 -DSQLITE_LIKE_DOESNT_MATCH_BLOBS
102 -DSQLITE_ENABLE_CURSOR_HINTS
104 "Check-Symbols" {
105 -DSQLITE_MEMDEBUG=1
106 -DSQLITE_ENABLE_FTS3_PARENTHESIS=1
107 -DSQLITE_ENABLE_FTS3=1
108 -DSQLITE_ENABLE_RTREE=1
109 -DSQLITE_ENABLE_MEMSYS5=1
110 -DSQLITE_ENABLE_MEMSYS3=1
111 -DSQLITE_ENABLE_COLUMN_METADATA=1
112 -DSQLITE_ENABLE_UPDATE_DELETE_LIMIT=1
113 -DSQLITE_SECURE_DELETE=1
114 -DSQLITE_SOUNDEX=1
115 -DSQLITE_ENABLE_ATOMIC_WRITE=1
116 -DSQLITE_ENABLE_MEMORY_MANAGEMENT=1
117 -DSQLITE_ENABLE_OVERSIZE_CELL_CHECK=1
118 -DSQLITE_ENABLE_STAT4
119 -DSQLITE_ENABLE_STMT_SCANSTATUS
120 --enable-fts5 --enable-session
122 "Debug-One" {
123 --disable-shared
124 -O2 -funsigned-char
125 -DSQLITE_DEBUG=1
126 -DSQLITE_MEMDEBUG=1
127 -DSQLITE_MUTEX_NOOP=1
128 -DSQLITE_TCL_DEFAULT_FULLMUTEX=1
129 -DSQLITE_ENABLE_FTS3=1
130 -DSQLITE_ENABLE_RTREE=1
131 -DSQLITE_ENABLE_MEMSYS5=1
132 -DSQLITE_ENABLE_COLUMN_METADATA=1
133 -DSQLITE_ENABLE_STAT4
134 -DSQLITE_ENABLE_HIDDEN_COLUMNS
135 -DSQLITE_MAX_ATTACHED=125
136 -DSQLITE_MUTATION_TEST
137 --enable-fts5
139 "Debug-Two" {
140 -DSQLITE_DEFAULT_MEMSTATUS=0
141 -DSQLITE_MAX_EXPR_DEPTH=0
142 --enable-debug
144 "Fast-One" {
146 -DSQLITE_ENABLE_FTS4=1
147 -DSQLITE_ENABLE_RTREE=1
148 -DSQLITE_ENABLE_STAT4
149 -DSQLITE_ENABLE_RBU
150 -DSQLITE_MAX_ATTACHED=125
151 -DSQLITE_MAX_MMAP_SIZE=12884901888
152 -DSQLITE_ENABLE_SORTER_MMAP=1
153 -DLONGDOUBLE_TYPE=double
154 --enable-session
156 "Device-One" {
158 -DSQLITE_DEBUG=1
159 -DSQLITE_DEFAULT_AUTOVACUUM=1
160 -DSQLITE_DEFAULT_CACHE_SIZE=64
161 -DSQLITE_DEFAULT_PAGE_SIZE=1024
162 -DSQLITE_DEFAULT_TEMP_CACHE_SIZE=32
163 -DSQLITE_DISABLE_LFS=1
164 -DSQLITE_ENABLE_ATOMIC_WRITE=1
165 -DSQLITE_ENABLE_IOTRACE=1
166 -DSQLITE_ENABLE_MEMORY_MANAGEMENT=1
167 -DSQLITE_MAX_PAGE_SIZE=4096
168 -DSQLITE_OMIT_LOAD_EXTENSION=1
169 -DSQLITE_OMIT_PROGRESS_CALLBACK=1
170 -DSQLITE_OMIT_VIRTUALTABLE=1
171 -DSQLITE_ENABLE_HIDDEN_COLUMNS
172 -DSQLITE_TEMP_STORE=3
174 "Device-Two" {
175 -DSQLITE_4_BYTE_ALIGNED_MALLOC=1
176 -DSQLITE_DEFAULT_AUTOVACUUM=1
177 -DSQLITE_DEFAULT_CACHE_SIZE=1000
178 -DSQLITE_DEFAULT_LOCKING_MODE=0
179 -DSQLITE_DEFAULT_PAGE_SIZE=1024
180 -DSQLITE_DEFAULT_TEMP_CACHE_SIZE=1000
181 -DSQLITE_DISABLE_LFS=1
182 -DSQLITE_ENABLE_FTS3=1
183 -DSQLITE_ENABLE_MEMORY_MANAGEMENT=1
184 -DSQLITE_ENABLE_RTREE=1
185 -DSQLITE_MAX_COMPOUND_SELECT=50
186 -DSQLITE_MAX_PAGE_SIZE=32768
187 -DSQLITE_OMIT_TRACE=1
188 -DSQLITE_TEMP_STORE=3
189 -DSQLITE_THREADSAFE=2
190 --enable-fts5 --enable-session
192 "Locking-Style" {
194 -DSQLITE_ENABLE_LOCKING_STYLE=1
196 "Apple" {
198 -DHAVE_GMTIME_R=1
199 -DHAVE_ISNAN=1
200 -DHAVE_LOCALTIME_R=1
201 -DHAVE_PREAD=1
202 -DHAVE_PWRITE=1
203 -DHAVE_UTIME=1
204 -DSQLITE_DEFAULT_CACHE_SIZE=1000
205 -DSQLITE_DEFAULT_CKPTFULLFSYNC=1
206 -DSQLITE_DEFAULT_MEMSTATUS=1
207 -DSQLITE_DEFAULT_PAGE_SIZE=1024
208 -DSQLITE_DISABLE_PAGECACHE_OVERFLOW_STATS=1
209 -DSQLITE_ENABLE_API_ARMOR=1
210 -DSQLITE_ENABLE_AUTO_PROFILE=1
211 -DSQLITE_ENABLE_FLOCKTIMEOUT=1
212 -DSQLITE_ENABLE_FTS3=1
213 -DSQLITE_ENABLE_FTS3_PARENTHESIS=1
214 -DSQLITE_ENABLE_FTS3_TOKENIZER=1
215 -DSQLITE_ENABLE_PERSIST_WAL=1
216 -DSQLITE_ENABLE_PURGEABLE_PCACHE=1
217 -DSQLITE_ENABLE_RTREE=1
218 -DSQLITE_ENABLE_SNAPSHOT=1
219 # -DSQLITE_ENABLE_SQLLOG=1
220 -DSQLITE_ENABLE_UPDATE_DELETE_LIMIT=1
221 -DSQLITE_MAX_LENGTH=2147483645
222 -DSQLITE_MAX_VARIABLE_NUMBER=500000
223 # -DSQLITE_MEMDEBUG=1
224 -DSQLITE_NO_SYNC=1
225 -DSQLITE_OMIT_AUTORESET=1
226 -DSQLITE_OMIT_LOAD_EXTENSION=1
227 -DSQLITE_PREFER_PROXY_LOCKING=1
228 -DSQLITE_SERIES_CONSTRAINT_VERIFY=1
229 -DSQLITE_THREADSAFE=2
230 -DSQLITE_USE_URI=1
231 -DSQLITE_WRITE_WALFRAME_PREBUFFERED=1
232 -DUSE_GUARDED_FD=1
233 -DUSE_PREAD=1
234 --enable-fts5
236 "Extra-Robustness" {
237 -DSQLITE_ENABLE_OVERSIZE_CELL_CHECK=1
238 -DSQLITE_MAX_ATTACHED=62
240 "Devkit" {
241 -DSQLITE_DEFAULT_FILE_FORMAT=4
242 -DSQLITE_MAX_ATTACHED=30
243 -DSQLITE_ENABLE_COLUMN_METADATA
244 -DSQLITE_ENABLE_FTS4
245 -DSQLITE_ENABLE_FTS5
246 -DSQLITE_ENABLE_FTS4_PARENTHESIS
247 -DSQLITE_DISABLE_FTS4_DEFERRED
248 -DSQLITE_ENABLE_RTREE
249 --enable-fts5
251 "No-lookaside" {
252 -DSQLITE_TEST_REALLOC_STRESS=1
253 -DSQLITE_OMIT_LOOKASIDE=1
255 "Valgrind" {
256 -DSQLITE_ENABLE_STAT4
257 -DSQLITE_ENABLE_FTS4
258 -DSQLITE_ENABLE_RTREE
259 -DSQLITE_ENABLE_HIDDEN_COLUMNS
260 -DCONFIG_SLOWDOWN_FACTOR=8.0
263 "Windows-Memdebug" {
264 MEMDEBUG=1
265 DEBUG=3
267 "Windows-Win32Heap" {
268 WIN32HEAP=1
269 DEBUG=4
272 # The next group of configurations are used only by the
273 # Failure-Detection platform. They are all the same, but we need
274 # different names for them all so that they results appear in separate
275 # subdirectories.
277 Fail0 {-O0}
278 Fail2 {-O0}
279 Fail3 {-O0}
280 Fail4 {-O0}
281 FuzzFail1 {-O0}
282 FuzzFail2 {-O0}
284 if {$tcl_platform(os)=="Darwin"} {
285 lappend Configs(Apple) -DSQLITE_ENABLE_LOCKING_STYLE=1
288 array set ::Platforms [strip_comments {
289 Linux-x86_64 {
290 "Check-Symbols*" "" checksymbols
291 "Fast-One" QUICKTEST_INCLUDE=rbu.test "fuzztest test"
292 "Debug-One" "" "mptest test"
293 "Debug-Two" "" test
294 "Have-Not" "" test
295 "Secure-Delete" "" test
296 "Unlock-Notify" QUICKTEST_INCLUDE=notify2.test test
297 "User-Auth" "" tcltest
298 "Update-Delete-Limit" "" test
299 "Extra-Robustness" "" test
300 "Device-Two" "" "threadtest test"
301 "No-lookaside" "" test
302 "Devkit" "" test
303 "Apple" "" test
304 "Sanitize*" "" test
305 "Device-One" "" alltest
306 "Default" "" "threadtest fuzztest alltest"
307 "Valgrind*" "" valgrindtest
309 Linux-i686 {
310 "Devkit" "" test
311 "Have-Not" "" test
312 "Unlock-Notify" QUICKTEST_INCLUDE=notify2.test test
313 "Device-One" "" test
314 "Device-Two" "" test
315 "Default" "" "threadtest fuzztest alltest"
317 Darwin-i386 {
318 "Locking-Style" "" "mptest test"
319 "Have-Not" "" test
320 "Apple" "" "threadtest fuzztest alltest"
322 Darwin-x86_64 {
323 "Locking-Style" "" "mptest test"
324 "Have-Not" "" test
325 "Apple" "" "threadtest fuzztest alltest"
327 Darwin-arm64 {
328 "Locking-Style" "" "mptest test"
329 "Have-Not" "" test
330 "Apple" "" "threadtest fuzztest alltest"
332 "Windows NT-intel" {
333 "Stdcall" "" test
334 "Have-Not" "" test
335 "Windows-Memdebug*" "" test
336 "Windows-Win32Heap*" "" test
337 "Default" "" "mptest fulltestonly"
339 "Windows NT-amd64" {
340 "Stdcall" "" test
341 "Have-Not" "" test
342 "Windows-Memdebug*" "" test
343 "Windows-Win32Heap*" "" test
344 "Default" "" "mptest fulltestonly"
347 # The Failure-Detection platform runs various tests that deliberately
348 # fail. This is used as a test of this script to verify that this script
349 # correctly identifies failures.
351 Failure-Detection {
352 Fail0* "TEST_FAILURE=0" test
353 Sanitize* "TEST_FAILURE=1" test
354 Fail2* "TEST_FAILURE=2" valgrindtest
355 Fail3* "TEST_FAILURE=3" valgrindtest
356 Fail4* "TEST_FAILURE=4" test
357 FuzzFail1* "TEST_FAILURE=5" test
358 FuzzFail2* "TEST_FAILURE=5" valgrindtest
362 #--------------------------------------------------------------------------
363 #--------------------------------------------------------------------------
364 #--------------------------------------------------------------------------
365 # End of configuration section.
366 #--------------------------------------------------------------------------
367 #--------------------------------------------------------------------------
368 #--------------------------------------------------------------------------
370 # Configuration verification: Check that each entry in the list of configs
371 # specified for each platforms exists.
373 foreach {key value} [array get ::Platforms] {
374 foreach {v vars t} $value {
375 if {[string range $v end end]=="*"} {
376 set v [string range $v 0 end-1]
378 if {0==[info exists ::Configs($v)]} {
379 puts stderr "No such configuration: \"$v\""
380 exit -1
385 proc usage {} {
386 global argv0
387 puts stderr [subst $::USAGE]
388 exit 1
391 proc is_prefix {p str min} {
392 set n [string length $p]
393 if {$n<$min} { return 0 }
394 if {[string range $str 0 [expr $n-1]]!=$p} { return 0 }
395 return 1
398 proc main_configurations {} {
399 foreach k [lsort [array names ::Configs]] {
400 puts $k
404 proc main_platforms {} {
405 foreach k [lsort [array names ::Platforms]] {
406 puts "\"$k\""
410 proc main_script {args} {
411 set bMsvc 0
412 set nArg [llength $args]
413 if {$nArg==3} {
414 if {![is_prefix [lindex $args 0] -msvc 2]} usage
415 set bMsvc 1
416 } elseif {$nArg<2 || $nArg>3} {
417 usage
419 set config [lindex $args end-1]
420 set target [lindex $args end]
422 set opts [list] ;# OPTS value
423 set cflags [expr {$bMsvc ? "-Zi" : "-g"}] ;# CFLAGS value
424 set makeOpts [list] ;# Extra args for [make]
425 set configOpts [list] ;# Extra args for [configure]
427 if {$::tcl_platform(platform)=="windows" || $bMsvc} {
428 lappend opts -DSQLITE_OS_WIN=1
429 } else {
430 lappend opts -DSQLITE_OS_UNIX=1
433 # Figure out if this is a synthetic ndebug or debug configuration.
435 set bRemoveDebug 0
436 if {[string match *-ndebug $config]} {
437 set bRemoveDebug 1
438 set config [string range $config 0 end-7]
440 if {[string match *-debug $config]} {
441 lappend opts -DSQLITE_DEBUG
442 lappend opts -DSQLITE_EXTRA_IFNULLROW
443 set config [string range $config 0 end-6]
445 regexp {^(.*)-[0-9]+} $config -> config
447 # Ensure that the named configuration exists.
449 if {![info exists ::Configs($config)]} {
450 puts stderr "No such config: $config"
451 exit 1
454 # Loop through the parameters of the nominated configuration, updating
455 # $opts, $cflags, $makeOpts and $configOpts along the way. Rules are as
456 # follows:
458 # 1. If the parameter begins with a "*", discard it.
460 # 2. If $bRemoveDebug is set and the parameter is -DSQLITE_DEBUG or
461 # -DSQLITE_DEBUG=1, discard it
463 # 3. If the parameter begins with "-D", add it to $opts.
465 # 4. If the parameter begins with "--" add it to $configOpts. Unless
466 # this command is preparing a script for MSVC - then add an
467 # equivalent to $makeOpts or $opts.
469 # 5. If the parameter begins with "-" add it to $cflags. If in MSVC
470 # mode and the parameter is an -O<integer> option, instead add
471 # an OPTIMIZATIONS=<integer> switch to $makeOpts.
473 # 6. If none of the above apply, add the parameter to $makeOpts
475 foreach param $::Configs($config) {
476 if {[string range $param 0 0]=="*"} continue
478 if {$bRemoveDebug} {
479 if {$param=="-DSQLITE_DEBUG" || $param=="-DSQLITE_DEBUG=1"
480 || $param=="-DSQLITE_MEMDEBUG" || $param=="-DSQLITE_MEMDEBUG=1"
481 || $param=="--enable-debug"
483 continue
487 if {[string range $param 0 1]=="-D"} {
488 lappend opts $param
489 continue
492 if {[string range $param 0 1]=="--"} {
493 if {$bMsvc} {
494 switch -- $param {
495 --disable-amalgamation {
496 lappend makeOpts USE_AMALGAMATION=0
498 --disable-shared {
499 lappend makeOpts USE_CRT_DLL=0 DYNAMIC_SHELL=0
501 --enable-fts5 {
502 lappend opts -DSQLITE_ENABLE_FTS5
504 --enable-shared {
505 lappend makeOpts USE_CRT_DLL=1 DYNAMIC_SHELL=1
507 --enable-session {
508 lappend opts -DSQLITE_ENABLE_PREUPDATE_HOOK
509 lappend opts -DSQLITE_ENABLE_SESSION
511 default {
512 error "Cannot translate $param for MSVC"
515 } else {
516 lappend configOpts $param
519 continue
522 if {[string range $param 0 0]=="-"} {
523 if {$bMsvc && [regexp -- {^-O(\d+)$} $param -> level]} {
524 lappend makeOpts OPTIMIZATIONS=$level
525 } else {
526 lappend cflags $param
528 continue
531 lappend makeOpts $param
534 # Some configurations specify -DHAVE_USLEEP=0. For all others, add
535 # -DHAVE_USLEEP=1.
537 if {[lsearch $opts "-DHAVE_USLEEP=0"]<0} {
538 lappend opts -DHAVE_USLEEP=1
541 if {$bMsvc==0} {
542 puts {set -e}
543 puts {}
544 puts {if [ "$#" -ne 1 ] ; then}
545 puts { echo "Usage: $0 <sqlite-src-dir>" }
546 puts { exit -1 }
547 puts {fi }
548 puts {SRCDIR=$1}
549 puts {}
550 puts "TCL=\"[::tcl::pkgconfig get libdir,install]\""
552 puts "\$SRCDIR/configure --with-tcl=\$TCL $configOpts"
553 puts {}
554 puts {OPTS=" -DSQLITE_NO_SYNC=1"}
555 foreach o $opts {
556 puts "OPTS=\"\$OPTS $o\""
558 puts {}
559 puts "CFLAGS=\"$cflags\""
560 puts {}
561 puts "make $target \"CFLAGS=\$CFLAGS\" \"OPTS=\$OPTS\" $makeOpts"
562 } else {
564 puts {set SRCDIR=%1}
565 set makecmd "nmake /f %SRCDIR%\\Makefile.msc TOP=%SRCDIR% $target "
566 append makecmd "\"CFLAGS=$cflags\" \"OPTS=$opts\" $makeOpts"
568 puts "set TMP=%CD%"
569 puts $makecmd
573 proc main_trscript {args} {
574 set bMsvc 0
575 set nArg [llength $args]
576 if {$nArg==3} {
577 if {![is_prefix [lindex $args 0] -msvc 2]} usage
578 set bMsvc 1
579 } elseif {$nArg<2 || $nArg>3} {
580 usage
582 set config [lindex $args end-1]
583 set srcdir [lindex $args end]
585 set opts [list] ;# OPTS value
586 set cflags [expr {$bMsvc ? "-Zi" : "-g"}] ;# CFLAGS value
587 set makeOpts [list] ;# Extra args for [make]
588 set configOpts [list] ;# Extra args for [configure]
590 if {$::tcl_platform(platform)=="windows" || $bMsvc} {
591 lappend opts -DSQLITE_OS_WIN=1
592 } else {
593 lappend opts -DSQLITE_OS_UNIX=1
596 # Figure out if this is a synthetic ndebug or debug configuration.
598 set bRemoveDebug 0
599 if {[string match *-ndebug $config]} {
600 set bRemoveDebug 1
601 set config [string range $config 0 end-7]
603 if {[string match *-debug $config]} {
604 lappend opts -DSQLITE_DEBUG
605 lappend opts -DSQLITE_EXTRA_IFNULLROW
606 set config [string range $config 0 end-6]
608 regexp {^(.*)-[0-9]+} $config -> config
610 # Ensure that the named configuration exists.
612 if {![info exists ::Configs($config)]} {
613 puts stderr "No such config: $config"
614 exit 1
617 # Loop through the parameters of the nominated configuration, updating
618 # $opts, $cflags, $makeOpts and $configOpts along the way. Rules are as
619 # follows:
621 # 1. If the parameter begins with a "*", discard it.
623 # 2. If $bRemoveDebug is set and the parameter is -DSQLITE_DEBUG or
624 # -DSQLITE_DEBUG=1, discard it
626 # 3. If the parameter begins with "-D", add it to $opts.
628 # 4. If the parameter begins with "--" add it to $configOpts. Unless
629 # this command is preparing a script for MSVC - then add an
630 # equivalent to $makeOpts or $opts.
632 # 5. If the parameter begins with "-" add it to $cflags. If in MSVC
633 # mode and the parameter is an -O<integer> option, instead add
634 # an OPTIMIZATIONS=<integer> switch to $makeOpts.
636 # 6. If none of the above apply, add the parameter to $makeOpts
638 foreach param $::Configs($config) {
639 if {[string range $param 0 0]=="*"} continue
641 if {$bRemoveDebug} {
642 if {$param=="-DSQLITE_DEBUG" || $param=="-DSQLITE_DEBUG=1"
643 || $param=="-DSQLITE_MEMDEBUG" || $param=="-DSQLITE_MEMDEBUG=1"
644 || $param=="--enable-debug"
646 continue
650 if {[string range $param 0 1]=="-D"} {
651 lappend opts $param
652 continue
655 if {[string range $param 0 1]=="--"} {
656 if {$bMsvc} {
657 switch -- $param {
658 --disable-amalgamation {
659 lappend makeOpts USE_AMALGAMATION=0
661 --disable-shared {
662 lappend makeOpts USE_CRT_DLL=0 DYNAMIC_SHELL=0
664 --enable-fts5 {
665 lappend opts -DSQLITE_ENABLE_FTS5
667 --enable-shared {
668 lappend makeOpts USE_CRT_DLL=1 DYNAMIC_SHELL=1
670 --enable-session {
671 lappend opts -DSQLITE_ENABLE_PREUPDATE_HOOK
672 lappend opts -DSQLITE_ENABLE_SESSION
674 default {
675 error "Cannot translate $param for MSVC"
678 } else {
679 lappend configOpts $param
682 continue
685 if {[string range $param 0 0]=="-"} {
686 if {$bMsvc && [regexp -- {^-O(\d+)$} $param -> level]} {
687 lappend makeOpts OPTIMIZATIONS=$level
688 } else {
689 lappend cflags $param
691 continue
694 lappend makeOpts $param
697 # Some configurations specify -DHAVE_USLEEP=0. For all others, add
698 # -DHAVE_USLEEP=1.
700 if {[lsearch $opts "-DHAVE_USLEEP=0"]<0} {
701 lappend opts -DHAVE_USLEEP=1
704 if {$bMsvc==0} {
705 puts {set -e}
706 puts {}
707 puts {if [ "$#" -ne 1 ] ; then}
708 puts { echo "Usage: $0 <target>" }
709 puts { exit -1 }
710 puts {fi }
711 puts "SRCDIR=\"$srcdir\""
712 puts {}
713 puts "TCL=\"[::tcl::pkgconfig get libdir,install]\""
715 puts {if [ ! -f Makefile ] ; then}
716 puts " \$SRCDIR/configure --with-tcl=\$TCL $configOpts"
717 puts {fi}
718 puts {}
719 puts {OPTS=" -DSQLITE_NO_SYNC=1"}
720 foreach o $opts {
721 puts "OPTS=\"\$OPTS $o\""
723 puts {}
724 puts "CFLAGS=\"$cflags\""
725 puts {}
726 puts "make \$1 \"CFLAGS=\$CFLAGS\" \"OPTS=\$OPTS\" $makeOpts"
727 } else {
729 set srcdir [file nativename [file normalize $srcdir]]
730 # set srcdir [string map [list "\\" "\\\\"] $srcdir]
732 puts {set TARGET=%1}
733 set makecmd "nmake /f $srcdir\\Makefile.msc TOP=\"$srcdir\" %TARGET% "
734 append makecmd "\"CFLAGS=$cflags\" \"OPTS=$opts\" $makeOpts"
736 puts "set TMP=%CD%"
737 puts $makecmd
741 proc main_tests {args} {
742 set bNodebug 0
743 set nArg [llength $args]
744 if {$nArg==2} {
745 if {[is_prefix [lindex $args 0] -nodebug 2]} {
746 set bNodebug 1
747 } elseif {[is_prefix [lindex $args 0] -debug 2]} {
748 set bNodebug 0
749 } else usage
750 } elseif {$nArg==0 || $nArg>2} {
751 usage
753 set p [lindex $args end]
754 if {![info exists ::Platforms($p)]} {
755 puts stderr "No such platform: $p"
756 exit 1
759 set lTest [list]
761 foreach {config vars target} $::Platforms($p) {
762 if {[string range $config end end]=="*"} {
763 set config [string range $config 0 end-1]
764 } elseif {$bNodebug==0} {
765 set dtarget test
766 if {[lsearch $target fuzztest]<0 && [lsearch $target test]<0} {
767 set dtarget tcltest
769 if {$vars!=""} { set dtarget "$vars $dtarget" }
771 if {[string first SQLITE_DEBUG $::Configs($config)]>=0
772 || [string first --enable-debug $::Configs($config)]>=0
774 lappend lTest "$config-ndebug \"$dtarget\""
775 } else {
776 lappend lTest "$config-debug \"$dtarget\""
780 if {[llength $target]==1 && ([string match "*TEST_FAILURE*" $vars] || (
781 [lsearch $target "valgrindtest"]<0
782 && [lsearch $target "alltest"]<0
783 && [lsearch $target "fulltestonly"]<0
784 && ![string match Sanitize* $config]
785 ))} {
786 if {$vars!=""} { set target "$vars $target" }
787 lappend lTest "$config \"$target\""
788 } else {
789 set idir -1
790 foreach t $target {
791 if {$t=="valgrindtest" || $t=="alltest" || $t=="fulltestonly"
792 || [string match Sanitize* $config]
794 if {$vars!=""} { set t "$vars $t" }
795 for {set ii 1} {$ii<=4} {incr ii} {
796 lappend lTest "$config-[incr idir] \"TCLTEST_PART=$ii/4 $t\""
798 } else {
799 if {$vars!=""} { set t "$vars $t" }
800 lappend lTest "$config-[incr idir] \"$t\""
806 foreach l $lTest {
807 puts $l
812 if {[llength $argv]==0} { usage }
813 set cmd [lindex $argv 0]
814 set n [expr [llength $argv]-1]
815 if {[string match ${cmd}* configurations] && $n==0} {
816 main_configurations
817 } elseif {[string match ${cmd}* script]} {
818 main_script {*}[lrange $argv 1 end]
819 } elseif {[string match ${cmd}* trscript]} {
820 main_trscript {*}[lrange $argv 1 end]
821 } elseif {[string match ${cmd}* platforms] && $n==0} {
822 main_platforms
823 } elseif {[string match ${cmd}* tests]} {
824 main_tests {*}[lrange $argv 1 end]
825 } else {
826 usage