Snapshot of upstream SQLite 3.43.2
[sqlcipher.git] / test / releasetest_data.tcl
blob4ed57a9c8e9a3ebf732529be395660f268631191
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 "All-Debug" {
57 --enable-debug --enable-all
59 "All-O0" {
60 -O0 --enable-all
62 "Sanitize" {
63 CC=clang -fsanitize=address,undefined
64 -DSQLITE_ENABLE_STAT4
65 -DCONFIG_SLOWDOWN_FACTOR=5.0
66 --enable-debug
67 --enable-all
69 "Stdcall" {
70 -DUSE_STDCALL=1
71 -O2
73 "Have-Not" {
74 # The "Have-Not" configuration sets all possible -UHAVE_feature options
75 # in order to verify that the code works even on platforms that lack
76 # these support services.
77 -DHAVE_FDATASYNC=0
78 -DHAVE_GMTIME_R=0
79 -DHAVE_ISNAN=0
80 -DHAVE_LOCALTIME_R=0
81 -DHAVE_LOCALTIME_S=0
82 -DHAVE_MALLOC_USABLE_SIZE=0
83 -DHAVE_STRCHRNUL=0
84 -DHAVE_USLEEP=0
85 -DHAVE_UTIME=0
87 "Unlock-Notify" {
88 -O2
89 -DSQLITE_ENABLE_UNLOCK_NOTIFY
90 -DSQLITE_THREADSAFE
91 -DSQLITE_TCL_DEFAULT_FULLMUTEX=1
93 "User-Auth" {
94 -O2
95 -DSQLITE_USER_AUTHENTICATION=1
97 "Secure-Delete" {
98 -O2
99 -DSQLITE_SECURE_DELETE=1
100 -DSQLITE_SOUNDEX=1
102 "Update-Delete-Limit" {
104 -DSQLITE_DEFAULT_FILE_FORMAT=4
105 -DSQLITE_ENABLE_UPDATE_DELETE_LIMIT=1
106 -DSQLITE_ENABLE_STMT_SCANSTATUS
107 -DSQLITE_LIKE_DOESNT_MATCH_BLOBS
108 -DSQLITE_ENABLE_CURSOR_HINTS
110 "Check-Symbols" {
111 -DSQLITE_MEMDEBUG=1
112 -DSQLITE_ENABLE_FTS3_PARENTHESIS=1
113 -DSQLITE_ENABLE_FTS3=1
114 -DSQLITE_ENABLE_RTREE=1
115 -DSQLITE_ENABLE_MEMSYS5=1
116 -DSQLITE_ENABLE_MEMSYS3=1
117 -DSQLITE_ENABLE_COLUMN_METADATA=1
118 -DSQLITE_ENABLE_UPDATE_DELETE_LIMIT=1
119 -DSQLITE_SECURE_DELETE=1
120 -DSQLITE_SOUNDEX=1
121 -DSQLITE_ENABLE_ATOMIC_WRITE=1
122 -DSQLITE_ENABLE_MEMORY_MANAGEMENT=1
123 -DSQLITE_ENABLE_OVERSIZE_CELL_CHECK=1
124 -DSQLITE_ENABLE_STAT4
125 -DSQLITE_ENABLE_STMT_SCANSTATUS
126 --enable-fts5 --enable-session
128 "Debug-One" {
129 --disable-shared
130 -O2 -funsigned-char
131 -DSQLITE_DEBUG=1
132 -DSQLITE_MEMDEBUG=1
133 -DSQLITE_MUTEX_NOOP=1
134 -DSQLITE_TCL_DEFAULT_FULLMUTEX=1
135 -DSQLITE_ENABLE_FTS3=1
136 -DSQLITE_ENABLE_RTREE=1
137 -DSQLITE_ENABLE_MEMSYS5=1
138 -DSQLITE_ENABLE_COLUMN_METADATA=1
139 -DSQLITE_ENABLE_STAT4
140 -DSQLITE_ENABLE_HIDDEN_COLUMNS
141 -DSQLITE_MAX_ATTACHED=125
142 -DSQLITE_MUTATION_TEST
143 --enable-fts5
145 "Debug-Two" {
146 -DSQLITE_DEFAULT_MEMSTATUS=0
147 -DSQLITE_MAX_EXPR_DEPTH=0
148 --enable-debug
150 "Fast-One" {
152 -DSQLITE_ENABLE_FTS4=1
153 -DSQLITE_ENABLE_RTREE=1
154 -DSQLITE_ENABLE_STAT4
155 -DSQLITE_ENABLE_RBU
156 -DSQLITE_MAX_ATTACHED=125
157 -DSQLITE_MAX_MMAP_SIZE=12884901888
158 -DSQLITE_ENABLE_SORTER_MMAP=1
159 -DLONGDOUBLE_TYPE=double
160 --enable-session
162 "Device-One" {
164 -DSQLITE_DEBUG=1
165 -DSQLITE_DEFAULT_AUTOVACUUM=1
166 -DSQLITE_DEFAULT_CACHE_SIZE=64
167 -DSQLITE_DEFAULT_PAGE_SIZE=1024
168 -DSQLITE_DEFAULT_TEMP_CACHE_SIZE=32
169 -DSQLITE_DISABLE_LFS=1
170 -DSQLITE_ENABLE_ATOMIC_WRITE=1
171 -DSQLITE_ENABLE_IOTRACE=1
172 -DSQLITE_ENABLE_MEMORY_MANAGEMENT=1
173 -DSQLITE_MAX_PAGE_SIZE=4096
174 -DSQLITE_OMIT_LOAD_EXTENSION=1
175 -DSQLITE_OMIT_PROGRESS_CALLBACK=1
176 -DSQLITE_OMIT_VIRTUALTABLE=1
177 -DSQLITE_ENABLE_HIDDEN_COLUMNS
178 -DSQLITE_TEMP_STORE=3
180 "Device-Two" {
181 -DSQLITE_4_BYTE_ALIGNED_MALLOC=1
182 -DSQLITE_DEFAULT_AUTOVACUUM=1
183 -DSQLITE_DEFAULT_CACHE_SIZE=1000
184 -DSQLITE_DEFAULT_LOCKING_MODE=0
185 -DSQLITE_DEFAULT_PAGE_SIZE=1024
186 -DSQLITE_DEFAULT_TEMP_CACHE_SIZE=1000
187 -DSQLITE_DISABLE_LFS=1
188 -DSQLITE_ENABLE_FTS3=1
189 -DSQLITE_ENABLE_MEMORY_MANAGEMENT=1
190 -DSQLITE_ENABLE_RTREE=1
191 -DSQLITE_MAX_COMPOUND_SELECT=50
192 -DSQLITE_MAX_PAGE_SIZE=32768
193 -DSQLITE_OMIT_TRACE=1
194 -DSQLITE_TEMP_STORE=3
195 -DSQLITE_THREADSAFE=2
196 --enable-fts5 --enable-session
198 "Locking-Style" {
200 -DSQLITE_ENABLE_LOCKING_STYLE=1
202 "Apple" {
204 -DHAVE_GMTIME_R=1
205 -DHAVE_ISNAN=1
206 -DHAVE_LOCALTIME_R=1
207 -DHAVE_PREAD=1
208 -DHAVE_PWRITE=1
209 -DHAVE_UTIME=1
210 -DSQLITE_DEFAULT_CACHE_SIZE=1000
211 -DSQLITE_DEFAULT_CKPTFULLFSYNC=1
212 -DSQLITE_DEFAULT_MEMSTATUS=1
213 -DSQLITE_DEFAULT_PAGE_SIZE=1024
214 -DSQLITE_DISABLE_PAGECACHE_OVERFLOW_STATS=1
215 -DSQLITE_ENABLE_API_ARMOR=1
216 -DSQLITE_ENABLE_AUTO_PROFILE=1
217 -DSQLITE_ENABLE_FLOCKTIMEOUT=1
218 -DSQLITE_ENABLE_FTS3=1
219 -DSQLITE_ENABLE_FTS3_PARENTHESIS=1
220 -DSQLITE_ENABLE_FTS3_TOKENIZER=1
221 -DSQLITE_ENABLE_PERSIST_WAL=1
222 -DSQLITE_ENABLE_PURGEABLE_PCACHE=1
223 -DSQLITE_ENABLE_RTREE=1
224 -DSQLITE_ENABLE_SNAPSHOT=1
225 # -DSQLITE_ENABLE_SQLLOG=1
226 -DSQLITE_ENABLE_UPDATE_DELETE_LIMIT=1
227 -DSQLITE_MAX_LENGTH=2147483645
228 -DSQLITE_MAX_VARIABLE_NUMBER=500000
229 # -DSQLITE_MEMDEBUG=1
230 -DSQLITE_NO_SYNC=1
231 -DSQLITE_OMIT_AUTORESET=1
232 -DSQLITE_OMIT_LOAD_EXTENSION=1
233 -DSQLITE_PREFER_PROXY_LOCKING=1
234 -DSQLITE_SERIES_CONSTRAINT_VERIFY=1
235 -DSQLITE_THREADSAFE=2
236 -DSQLITE_USE_URI=1
237 -DSQLITE_WRITE_WALFRAME_PREBUFFERED=1
238 -DUSE_GUARDED_FD=1
239 -DUSE_PREAD=1
240 --enable-fts5
242 "Extra-Robustness" {
243 -DSQLITE_ENABLE_OVERSIZE_CELL_CHECK=1
244 -DSQLITE_MAX_ATTACHED=62
246 "Devkit" {
247 -DSQLITE_DEFAULT_FILE_FORMAT=4
248 -DSQLITE_MAX_ATTACHED=30
249 -DSQLITE_ENABLE_COLUMN_METADATA
250 -DSQLITE_ENABLE_FTS4
251 -DSQLITE_ENABLE_FTS5
252 -DSQLITE_ENABLE_FTS4_PARENTHESIS
253 -DSQLITE_DISABLE_FTS4_DEFERRED
254 -DSQLITE_ENABLE_RTREE
255 --enable-fts5
257 "No-lookaside" {
258 -DSQLITE_TEST_REALLOC_STRESS=1
259 -DSQLITE_OMIT_LOOKASIDE=1
261 "Valgrind" {
262 -DSQLITE_ENABLE_STAT4
263 -DSQLITE_ENABLE_FTS4
264 -DSQLITE_ENABLE_RTREE
265 -DSQLITE_ENABLE_HIDDEN_COLUMNS
266 -DLONGDOUBLE_TYPE=double
267 -DCONFIG_SLOWDOWN_FACTOR=8.0
270 "Windows-Memdebug" {
271 MEMDEBUG=1
272 DEBUG=3
274 "Windows-Win32Heap" {
275 WIN32HEAP=1
276 DEBUG=4
279 # The next group of configurations are used only by the
280 # Failure-Detection platform. They are all the same, but we need
281 # different names for them all so that they results appear in separate
282 # subdirectories.
284 Fail0 {-O0}
285 Fail2 {-O0}
286 Fail3 {-O0}
287 Fail4 {-O0}
288 FuzzFail1 {-O0}
289 FuzzFail2 {-O0}
291 if {$tcl_platform(os)=="Darwin"} {
292 lappend Configs(Apple) -DSQLITE_ENABLE_LOCKING_STYLE=1
295 array set ::Platforms [strip_comments {
296 Linux-x86_64 {
297 "Check-Symbols*" "" checksymbols
298 "Fast-One" QUICKTEST_INCLUDE=rbu.test "fuzztest test"
299 "Debug-One" "" "mptest test"
300 "Debug-Two" "" test
301 "Have-Not" "" test
302 "Secure-Delete" "" test
303 "Unlock-Notify" QUICKTEST_INCLUDE=notify2.test test
304 "User-Auth" "" tcltest
305 "Update-Delete-Limit" "" test
306 "Extra-Robustness" "" test
307 "Device-Two" "" "threadtest test"
308 "No-lookaside" "" test
309 "Devkit" "" test
310 "Apple" "" test
311 "Sanitize*" "" test
312 "Device-One" "" alltest
313 "Default" "" "threadtest fuzztest alltest"
314 "Valgrind*" "" valgrindtest
316 Linux-i686 {
317 "Devkit" "" test
318 "Have-Not" "" test
319 "Unlock-Notify" QUICKTEST_INCLUDE=notify2.test test
320 "Device-One" "" test
321 "Device-Two" "" test
322 "Default" "" "threadtest fuzztest alltest"
324 Darwin-i386 {
325 "Locking-Style" "" "mptest test"
326 "Have-Not" "" test
327 "Apple" "" "threadtest fuzztest alltest"
329 Darwin-x86_64 {
330 "Locking-Style" "" "mptest test"
331 "Have-Not" "" test
332 "Apple" "" "threadtest fuzztest alltest"
334 Darwin-arm64 {
335 "Locking-Style" "" "mptest test"
336 "Have-Not" "" test
337 "Apple" "" "threadtest fuzztest alltest"
339 "Windows NT-intel" {
340 "Stdcall" "" test
341 "Have-Not" "" test
342 "Windows-Memdebug*" "" test
343 "Windows-Win32Heap*" "" test
344 "Default" "" "mptest fulltestonly"
346 "Windows NT-amd64" {
347 "Stdcall" "" test
348 "Have-Not" "" test
349 "Windows-Memdebug*" "" test
350 "Windows-Win32Heap*" "" test
351 "Default" "" "mptest fulltestonly"
354 # The Failure-Detection platform runs various tests that deliberately
355 # fail. This is used as a test of this script to verify that this script
356 # correctly identifies failures.
358 Failure-Detection {
359 Fail0* "TEST_FAILURE=0" test
360 Sanitize* "TEST_FAILURE=1" test
361 Fail2* "TEST_FAILURE=2" valgrindtest
362 Fail3* "TEST_FAILURE=3" valgrindtest
363 Fail4* "TEST_FAILURE=4" test
364 FuzzFail1* "TEST_FAILURE=5" test
365 FuzzFail2* "TEST_FAILURE=5" valgrindtest
369 #--------------------------------------------------------------------------
370 #--------------------------------------------------------------------------
371 #--------------------------------------------------------------------------
372 # End of configuration section.
373 #--------------------------------------------------------------------------
374 #--------------------------------------------------------------------------
375 #--------------------------------------------------------------------------
377 # Configuration verification: Check that each entry in the list of configs
378 # specified for each platforms exists.
380 foreach {key value} [array get ::Platforms] {
381 foreach {v vars t} $value {
382 if {[string range $v end end]=="*"} {
383 set v [string range $v 0 end-1]
385 if {0==[info exists ::Configs($v)]} {
386 puts stderr "No such configuration: \"$v\""
387 exit -1
392 proc usage {} {
393 global argv0
394 puts stderr [subst $::USAGE]
395 exit 1
398 proc is_prefix {p str min} {
399 set n [string length $p]
400 if {$n<$min} { return 0 }
401 if {[string range $str 0 [expr $n-1]]!=$p} { return 0 }
402 return 1
405 proc main_configurations {} {
406 foreach k [lsort [array names ::Configs]] {
407 puts $k
411 proc main_platforms {} {
412 foreach k [lsort [array names ::Platforms]] {
413 puts "\"$k\""
417 proc main_script {args} {
418 set bMsvc 0
419 set nArg [llength $args]
420 if {$nArg==3} {
421 if {![is_prefix [lindex $args 0] -msvc 2]} usage
422 set bMsvc 1
423 } elseif {$nArg<2 || $nArg>3} {
424 usage
426 set config [lindex $args end-1]
427 set target [lindex $args end]
429 set opts [list] ;# OPTS value
430 set cflags [expr {$bMsvc ? "-Zi" : "-g"}] ;# CFLAGS value
431 set makeOpts [list] ;# Extra args for [make]
432 set configOpts [list] ;# Extra args for [configure]
434 if {$::tcl_platform(platform)=="windows" || $bMsvc} {
435 lappend opts -DSQLITE_OS_WIN=1
436 } else {
437 lappend opts -DSQLITE_OS_UNIX=1
440 # Figure out if this is a synthetic ndebug or debug configuration.
442 set bRemoveDebug 0
443 if {[string match *-ndebug $config]} {
444 set bRemoveDebug 1
445 set config [string range $config 0 end-7]
447 if {[string match *-debug $config]} {
448 lappend opts -DSQLITE_DEBUG
449 lappend opts -DSQLITE_EXTRA_IFNULLROW
450 set config [string range $config 0 end-6]
452 regexp {^(.*)-[0-9]+} $config -> config
454 # Ensure that the named configuration exists.
456 if {![info exists ::Configs($config)]} {
457 puts stderr "No such config: $config"
458 exit 1
461 # Loop through the parameters of the nominated configuration, updating
462 # $opts, $cflags, $makeOpts and $configOpts along the way. Rules are as
463 # follows:
465 # 1. If the parameter begins with a "*", discard it.
467 # 2. If $bRemoveDebug is set and the parameter is -DSQLITE_DEBUG or
468 # -DSQLITE_DEBUG=1, discard it
470 # 3. If the parameter begins with "-D", add it to $opts.
472 # 4. If the parameter begins with "--" add it to $configOpts. Unless
473 # this command is preparing a script for MSVC - then add an
474 # equivalent to $makeOpts or $opts.
476 # 5. If the parameter begins with "-" add it to $cflags. If in MSVC
477 # mode and the parameter is an -O<integer> option, instead add
478 # an OPTIMIZATIONS=<integer> switch to $makeOpts.
480 # 6. If none of the above apply, add the parameter to $makeOpts
482 foreach param $::Configs($config) {
483 if {[string range $param 0 0]=="*"} continue
485 if {$bRemoveDebug} {
486 if {$param=="-DSQLITE_DEBUG" || $param=="-DSQLITE_DEBUG=1"
487 || $param=="-DSQLITE_MEMDEBUG" || $param=="-DSQLITE_MEMDEBUG=1"
488 || $param=="--enable-debug"
490 continue
494 if {[string range $param 0 1]=="-D"} {
495 lappend opts $param
496 continue
499 if {[string range $param 0 1]=="--"} {
500 if {$bMsvc} {
501 switch -- $param {
502 --disable-amalgamation {
503 lappend makeOpts USE_AMALGAMATION=0
505 --disable-shared {
506 lappend makeOpts USE_CRT_DLL=0 DYNAMIC_SHELL=0
508 --enable-fts5 {
509 lappend opts -DSQLITE_ENABLE_FTS5
511 --enable-shared {
512 lappend makeOpts USE_CRT_DLL=1 DYNAMIC_SHELL=1
514 --enable-session {
515 lappend opts -DSQLITE_ENABLE_PREUPDATE_HOOK
516 lappend opts -DSQLITE_ENABLE_SESSION
518 default {
519 error "Cannot translate $param for MSVC"
522 } else {
523 lappend configOpts $param
526 continue
529 if {[string range $param 0 0]=="-"} {
530 if {$bMsvc && [regexp -- {^-O(\d+)$} $param -> level]} {
531 lappend makeOpts OPTIMIZATIONS=$level
532 } else {
533 lappend cflags $param
535 continue
538 lappend makeOpts $param
541 # Some configurations specify -DHAVE_USLEEP=0. For all others, add
542 # -DHAVE_USLEEP=1.
544 if {[lsearch $opts "-DHAVE_USLEEP=0"]<0} {
545 lappend opts -DHAVE_USLEEP=1
548 if {$bMsvc==0} {
549 puts {set -e}
550 puts {}
551 puts {if [ "$#" -ne 1 ] ; then}
552 puts { echo "Usage: $0 <sqlite-src-dir>" }
553 puts { exit -1 }
554 puts {fi }
555 puts {SRCDIR=$1}
556 puts {}
557 puts "TCL=\"[::tcl::pkgconfig get libdir,install]\""
559 puts "\$SRCDIR/configure --with-tcl=\$TCL $configOpts"
560 puts {}
561 puts {OPTS=" -DSQLITE_NO_SYNC=1"}
562 foreach o $opts {
563 puts "OPTS=\"\$OPTS $o\""
565 puts {}
566 puts "CFLAGS=\"$cflags\""
567 puts {}
568 puts "make $target \"CFLAGS=\$CFLAGS\" \"OPTS=\$OPTS\" $makeOpts"
569 } else {
571 puts {set SRCDIR=%1}
572 set makecmd "nmake /f %SRCDIR%\\Makefile.msc TOP=%SRCDIR% $target "
573 append makecmd "\"CFLAGS=$cflags\" \"OPTS=$opts\" $makeOpts"
575 puts "set TMP=%CD%"
576 puts $makecmd
580 proc main_trscript {args} {
581 set bMsvc 0
582 set nArg [llength $args]
583 if {$nArg==3} {
584 if {![is_prefix [lindex $args 0] -msvc 2]} usage
585 set bMsvc 1
586 } elseif {$nArg<2 || $nArg>3} {
587 usage
589 set config [lindex $args end-1]
590 set srcdir [lindex $args end]
592 set opts [list] ;# OPTS value
593 set cflags [expr {$bMsvc ? "-Zi" : "-g"}] ;# CFLAGS value
594 set makeOpts [list] ;# Extra args for [make]
595 set configOpts [list] ;# Extra args for [configure]
597 if {$::tcl_platform(platform)=="windows" || $bMsvc} {
598 lappend opts -DSQLITE_OS_WIN=1
599 } else {
600 lappend opts -DSQLITE_OS_UNIX=1
603 # Figure out if this is a synthetic ndebug or debug configuration.
605 set bRemoveDebug 0
606 if {[string match *-ndebug $config]} {
607 set bRemoveDebug 1
608 set config [string range $config 0 end-7]
610 if {[string match *-debug $config]} {
611 lappend opts -DSQLITE_DEBUG
612 lappend opts -DSQLITE_EXTRA_IFNULLROW
613 set config [string range $config 0 end-6]
615 regexp {^(.*)-[0-9]+} $config -> config
617 # Ensure that the named configuration exists.
619 if {![info exists ::Configs($config)]} {
620 puts stderr "No such config: $config"
621 exit 1
624 # Loop through the parameters of the nominated configuration, updating
625 # $opts, $cflags, $makeOpts and $configOpts along the way. Rules are as
626 # follows:
628 # 1. If the parameter begins with a "*", discard it.
630 # 2. If $bRemoveDebug is set and the parameter is -DSQLITE_DEBUG or
631 # -DSQLITE_DEBUG=1, discard it
633 # 3. If the parameter begins with "-D", add it to $opts.
635 # 4. If the parameter begins with "--" add it to $configOpts. Unless
636 # this command is preparing a script for MSVC - then add an
637 # equivalent to $makeOpts or $opts.
639 # 5. If the parameter begins with "-" add it to $cflags. If in MSVC
640 # mode and the parameter is an -O<integer> option, instead add
641 # an OPTIMIZATIONS=<integer> switch to $makeOpts.
643 # 6. If none of the above apply, add the parameter to $makeOpts
645 foreach param $::Configs($config) {
646 if {[string range $param 0 0]=="*"} continue
648 if {$bRemoveDebug} {
649 if {$param=="-DSQLITE_DEBUG" || $param=="-DSQLITE_DEBUG=1"
650 || $param=="-DSQLITE_MEMDEBUG" || $param=="-DSQLITE_MEMDEBUG=1"
651 || $param=="--enable-debug"
653 continue
657 if {[string range $param 0 1]=="-D"} {
658 lappend opts $param
659 continue
662 if {[string range $param 0 1]=="--"} {
663 if {$bMsvc} {
664 switch -- $param {
665 --disable-amalgamation {
666 lappend makeOpts USE_AMALGAMATION=0
668 --disable-shared {
669 lappend makeOpts USE_CRT_DLL=0 DYNAMIC_SHELL=0
671 --enable-fts5 {
672 lappend opts -DSQLITE_ENABLE_FTS5
674 --enable-shared {
675 lappend makeOpts USE_CRT_DLL=1 DYNAMIC_SHELL=1
677 --enable-session {
678 lappend opts -DSQLITE_ENABLE_PREUPDATE_HOOK
679 lappend opts -DSQLITE_ENABLE_SESSION
681 --enable-all {
683 --enable-debug {
684 # lappend makeOpts OPTIMIZATIONS=0
685 lappend opts -DSQLITE_DEBUG
687 default {
688 error "Cannot translate $param for MSVC"
691 } else {
692 lappend configOpts $param
695 continue
698 if {[string range $param 0 0]=="-"} {
699 if {$bMsvc && [regexp -- {^-O(\d+)$} $param -> level]} {
700 lappend makeOpts OPTIMIZATIONS=$level
701 } else {
702 lappend cflags $param
704 continue
707 lappend makeOpts $param
710 # Some configurations specify -DHAVE_USLEEP=0. For all others, add
711 # -DHAVE_USLEEP=1.
713 if {[lsearch $opts "-DHAVE_USLEEP=0"]<0} {
714 lappend opts -DHAVE_USLEEP=1
717 if {$bMsvc==0} {
718 puts {set -e}
719 puts {}
720 puts {if [ "$#" -ne 1 ] ; then}
721 puts { echo "Usage: $0 <target>" }
722 puts { exit -1 }
723 puts {fi }
724 puts "SRCDIR=\"$srcdir\""
725 puts {}
726 puts "TCL=\"[::tcl::pkgconfig get libdir,install]\""
728 puts {if [ ! -f Makefile ] ; then}
729 puts " \$SRCDIR/configure --with-tcl=\$TCL $configOpts"
730 puts {fi}
731 puts {}
732 if {[info exists ::env(OPTS)]} {
733 puts "# From environment variable:"
734 puts "OPTS=$::env(OPTS)"
735 puts ""
737 puts {OPTS="$OPTS -DSQLITE_NO_SYNC=1"}
738 foreach o $opts {
739 puts "OPTS=\"\$OPTS $o\""
741 puts {}
742 puts "CFLAGS=\"$cflags\""
743 puts {}
744 puts "make \$1 \"CFLAGS=\$CFLAGS\" \"OPTS=\$OPTS\" $makeOpts"
745 } else {
747 set srcdir [file nativename [file normalize $srcdir]]
748 # set srcdir [string map [list "\\" "\\\\"] $srcdir]
750 puts {set TARGET=%1}
751 set makecmd "nmake /f $srcdir\\Makefile.msc TOP=\"$srcdir\" %TARGET% "
752 append makecmd "\"CFLAGS=$cflags\" \"OPTS=$opts\" $makeOpts"
754 puts "set TMP=%CD%"
755 puts $makecmd
759 proc main_tests {args} {
760 set bNodebug 0
761 set nArg [llength $args]
762 if {$nArg==2} {
763 if {[is_prefix [lindex $args 0] -nodebug 2]} {
764 set bNodebug 1
765 } elseif {[is_prefix [lindex $args 0] -debug 2]} {
766 set bNodebug 0
767 } else usage
768 } elseif {$nArg==0 || $nArg>2} {
769 usage
771 set p [lindex $args end]
772 if {![info exists ::Platforms($p)]} {
773 puts stderr "No such platform: $p"
774 exit 1
777 set lTest [list]
779 foreach {config vars target} $::Platforms($p) {
780 if {[string range $config end end]=="*"} {
781 set config [string range $config 0 end-1]
782 } elseif {$bNodebug==0} {
783 set dtarget test
784 if {[lsearch $target fuzztest]<0 && [lsearch $target test]<0} {
785 set dtarget tcltest
787 if {$vars!=""} { set dtarget "$vars $dtarget" }
789 if {[string first SQLITE_DEBUG $::Configs($config)]>=0
790 || [string first --enable-debug $::Configs($config)]>=0
792 lappend lTest "$config-ndebug \"$dtarget\""
793 } else {
794 lappend lTest "$config-debug \"$dtarget\""
798 if {[llength $target]==1 && ([string match "*TEST_FAILURE*" $vars] || (
799 [lsearch $target "valgrindtest"]<0
800 && [lsearch $target "alltest"]<0
801 && [lsearch $target "fulltestonly"]<0
802 && ![string match Sanitize* $config]
803 ))} {
804 if {$vars!=""} { set target "$vars $target" }
805 lappend lTest "$config \"$target\""
806 } else {
807 set idir -1
808 foreach t $target {
809 if {$t=="valgrindtest" || $t=="alltest" || $t=="fulltestonly"
810 || [string match Sanitize* $config]
812 if {$vars!=""} { set t "$vars $t" }
813 for {set ii 1} {$ii<=4} {incr ii} {
814 lappend lTest "$config-[incr idir] \"TCLTEST_PART=$ii/4 $t\""
816 } else {
817 if {$vars!=""} { set t "$vars $t" }
818 lappend lTest "$config-[incr idir] \"$t\""
824 foreach l $lTest {
825 puts $l
830 if {[llength $argv]==0} { usage }
831 set cmd [lindex $argv 0]
832 set n [expr [llength $argv]-1]
833 if {[string match ${cmd}* configurations] && $n==0} {
834 main_configurations
835 } elseif {[string match ${cmd}* script]} {
836 main_script {*}[lrange $argv 1 end]
837 } elseif {[string match ${cmd}* trscript]} {
838 main_trscript {*}[lrange $argv 1 end]
839 } elseif {[string match ${cmd}* platforms] && $n==0} {
840 main_platforms
841 } elseif {[string match ${cmd}* tests]} {
842 main_tests {*}[lrange $argv 1 end]
843 } else {
844 usage