11 # Tcl tests to run for various builds.
13 set tcltest(linux.Fast-One
) veryquick
14 set tcltest(linux.Debug-One
) veryquick
15 set tcltest(linux.Debug-Two
) veryquick
16 set tcltest(linux.Have-Not
) veryquick
17 set tcltest(linux.Secure-Delete
) veryquick
18 set tcltest(linux.Unlock-Notify
) veryquick
19 set tcltest(linux.User-Auth
) veryquick
20 set tcltest(linux.Update-Delete-Limit
) veryquick
21 set tcltest(linux.Extra-Robustness
) veryquick
22 set tcltest(linux.Device-Two
) veryquick
23 set tcltest(linux.No-lookaside
) veryquick
24 set tcltest(linux.Devkit
) veryquick
25 set tcltest(linux.Apple
) veryquick
26 set tcltest(linux.Android
) veryquick
27 set tcltest(linux.Sanitize
) veryquick
28 set tcltest(linux.Device-One
) all
29 set tcltest(linux.Default
) all_plus_autovacuum_crash
30 set tcltest(linux.Valgrind
) valgrind
32 set tcltest(osx.Locking-Style
) veryquick
33 set tcltest(osx.Have-Not
) veryquick
34 set tcltest(osx.Apple
) all_less_no_mutex_try
36 set tcltest(win.Stdcall
) veryquick
37 set tcltest(win.Have-Not
) veryquick
38 set tcltest(win.Windows-Memdebug
) veryquick
39 set tcltest(win.Windows-Win32Heap
) veryquick
40 set tcltest(win.Windows-Sanitize
) veryquick
41 set tcltest(win.Default
) full
43 # Extra [make xyz] tests that should be run for various builds.
45 set extra
(linux.Check-Symbols
) checksymbols
46 set extra
(linux.Fast-One
) {fuzztest sourcetest
}
47 set extra
(linux.Debug-One
) {fuzztest sourcetest mptest
}
48 set extra
(linux.Debug-Two
) {fuzztest sourcetest
}
49 set extra
(linux.Have-Not
) {fuzztest sourcetest
}
50 set extra
(linux.Secure-Delete
) {fuzztest sourcetest
}
51 set extra
(linux.Unlock-Notify
) {fuzztest sourcetest
}
52 set extra
(linux.Update-Delete-Limit
) {fuzztest sourcetest
}
53 set extra
(linux.Extra-Robustness
) {fuzztest sourcetest
}
54 set extra
(linux.Device-Two
) {fuzztest sourcetest threadtest
}
55 set extra
(linux.No-lookaside
) {fuzztest sourcetest
}
56 set extra
(linux.Devkit
) {fuzztest sourcetest
}
57 set extra
(linux.Android
) {fuzztest sourcetest
}
58 set extra
(linux.Apple
) {fuzztest sourcetest
}
59 set extra
(linux.Sanitize
) {fuzztest sourcetest
}
60 set extra
(linux.Default
) {fuzztest sourcetest threadtest
}
62 set extra
(osx.Apple
) {fuzztest threadtest
}
63 set extra
(osx.Have-Not
) {fuzztest sourcetest
}
64 set extra
(osx.Locking-Style
) {mptest fuzztest sourcetest
}
66 set extra
(win.Default
) mptest
67 set extra
(win.Stdcall
) {fuzztest sourcetest
}
68 set extra
(win.Windows-Memdebug
) {fuzztest sourcetest
}
69 set extra
(win.Windows-Win32Heap
) {fuzztest sourcetest
}
70 set extra
(win.Windows-Sanitize
) fuzztest
71 set extra
(win.Have-Not
) {fuzztest sourcetest
}
73 # The following mirrors the set of test suites invoked by "all.test".
76 full no_optimization memsubsys1 memsubsys2 singlethread
77 multithread onefile utf16 exclusive persistent_journal
78 persistent_journal_error no_journal no_journal_error
79 autovacuum_ioerr no_mutex_try fullmutex journaltest
80 inmemory_journal pcache0 pcache10 pcache50 pcache90
81 pcache100 prepare mmap
84 #-----------------------------------------------------------------------
85 # Start of build() definitions.
89 --disable-amalgamation
--disable-shared
94 # These two are used by [testrunner.tcl mdevtest] (All-O0) and
95 # [testrunner.tcl sdevtest] (All-Sanitize).
97 set build
(All-Debug
) {
98 --enable-debug
--enable-all
103 set build
(All-Sanitize
) {
104 -DSQLITE_OMIT_LOOKASIDE=1
105 --enable-all
-fsanitize=address
,undefined
-fno-sanitize
-recover
=undefined
108 set build
(Sanitize
) {
109 CC
=clang
-fsanitize=address
,undefined
-fno-sanitize
-recover
=undefined
110 -DSQLITE_ENABLE_STAT4
111 -DSQLITE_OMIT_LOOKASIDE=1
112 -DCONFIG_SLOWDOWN_FACTOR=5.0
122 # The "Have-Not" configuration sets all possible -UHAVE_feature options
123 # in order to verify that the code works even on platforms that lack
124 # these support services.
125 set build
(Have-Not
) {
131 -DHAVE_MALLOC_USABLE_SIZE=0
136 set build
(Unlock-Notify
) {
138 -DSQLITE_ENABLE_UNLOCK_NOTIFY
140 -DSQLITE_TCL_DEFAULT_FULLMUTEX=1
142 set build
(User-Auth
) {
144 -DSQLITE_USER_AUTHENTICATION=1
146 set build
(Secure-Delete
) {
148 -DSQLITE_SECURE_DELETE=1
151 set build
(Update-Delete-Limit
) {
153 -DSQLITE_DEFAULT_FILE_FORMAT=4
154 -DSQLITE_ENABLE_UPDATE_DELETE_LIMIT=1
155 -DSQLITE_ENABLE_STMT_SCANSTATUS
156 -DSQLITE_LIKE_DOESNT_MATCH_BLOBS
157 -DSQLITE_ENABLE_CURSOR_HINTS
159 set build
(Check-Symbols
) {
161 -DSQLITE_ENABLE_FTS3_PARENTHESIS=1
162 -DSQLITE_ENABLE_FTS3=1
163 -DSQLITE_ENABLE_RTREE=1
164 -DSQLITE_ENABLE_MEMSYS5=1
165 -DSQLITE_ENABLE_MEMSYS3=1
166 -DSQLITE_ENABLE_COLUMN_METADATA=1
167 -DSQLITE_ENABLE_UPDATE_DELETE_LIMIT=1
168 -DSQLITE_SECURE_DELETE=1
170 -DSQLITE_ENABLE_ATOMIC_WRITE=1
171 -DSQLITE_ENABLE_MEMORY_MANAGEMENT=1
172 -DSQLITE_ENABLE_OVERSIZE_CELL_CHECK=1
173 -DSQLITE_ENABLE_STAT4
174 -DSQLITE_ENABLE_STMT_SCANSTATUS
175 --enable-fts
5 --enable-session
177 set build
(Debug-One
) {
182 -DSQLITE_MUTEX_NOOP=1
183 -DSQLITE_TCL_DEFAULT_FULLMUTEX=1
184 -DSQLITE_ENABLE_FTS3=1
185 -DSQLITE_ENABLE_RTREE=1
186 -DSQLITE_ENABLE_MEMSYS5=1
187 -DSQLITE_ENABLE_COLUMN_METADATA=1
188 -DSQLITE_ENABLE_STAT4
189 -DSQLITE_ENABLE_HIDDEN_COLUMNS
190 -DSQLITE_MAX_ATTACHED=125
191 -DSQLITE_MUTATION_TEST
194 set build
(Debug-Two
) {
195 -DSQLITE_DEFAULT_MEMSTATUS=0
196 -DSQLITE_MAX_EXPR_DEPTH=0
199 set build
(Fast-One
) {
201 -DSQLITE_ENABLE_FTS4=1
202 -DSQLITE_ENABLE_RTREE=1
203 -DSQLITE_ENABLE_STAT4
205 -DSQLITE_MAX_ATTACHED=125
206 -DSQLITE_MAX_MMAP_SIZE=12884901888
207 -DSQLITE_ENABLE_SORTER_MMAP=1
208 -DLONGDOUBLE_TYPE=double
211 set build
(Device-One
) {
214 -DSQLITE_DEFAULT_AUTOVACUUM=1
215 -DSQLITE_DEFAULT_CACHE_SIZE=64
216 -DSQLITE_DEFAULT_PAGE_SIZE=1024
217 -DSQLITE_DEFAULT_TEMP_CACHE_SIZE=32
218 -DSQLITE_DISABLE_LFS=1
219 -DSQLITE_ENABLE_ATOMIC_WRITE=1
220 -DSQLITE_ENABLE_IOTRACE=1
221 -DSQLITE_ENABLE_MEMORY_MANAGEMENT=1
222 -DSQLITE_MAX_PAGE_SIZE=4096
223 -DSQLITE_OMIT_LOAD_EXTENSION=1
224 -DSQLITE_OMIT_PROGRESS_CALLBACK=1
225 -DSQLITE_OMIT_VIRTUALTABLE=1
226 -DSQLITE_ENABLE_HIDDEN_COLUMNS
227 -DSQLITE_TEMP_STORE=3
229 set build
(Device-Two
) {
230 -DSQLITE_4_BYTE_ALIGNED_MALLOC=1
231 -DSQLITE_DEFAULT_AUTOVACUUM=1
232 -DSQLITE_DEFAULT_CACHE_SIZE=1000
233 -DSQLITE_DEFAULT_LOCKING_MODE=0
234 -DSQLITE_DEFAULT_PAGE_SIZE=1024
235 -DSQLITE_DEFAULT_TEMP_CACHE_SIZE=1000
236 -DSQLITE_DISABLE_LFS=1
237 -DSQLITE_ENABLE_FTS3=1
238 -DSQLITE_ENABLE_MEMORY_MANAGEMENT=1
239 -DSQLITE_ENABLE_RTREE=1
240 -DSQLITE_MAX_COMPOUND_SELECT=50
241 -DSQLITE_MAX_PAGE_SIZE=32768
242 -DSQLITE_OMIT_TRACE=1
243 -DSQLITE_TEMP_STORE=3
244 -DSQLITE_THREADSAFE=2
245 --enable-fts
5 --enable-session
247 set build
(Locking-Style
) {
249 -DSQLITE_ENABLE_LOCKING_STYLE=1
255 -DSQLITE_POWERSAFE_OVERWRITE=1
256 -DSQLITE_DEFAULT_FILE_FORMAT=4
257 -DSQLITE_DEFAULT_AUTOVACUUM=1
258 -DSQLITE_ENABLE_MEMORY_MANAGEMENT=1
260 -DSQLITE_ENABLE_FTS3_BACKWARDS
262 -DSQLITE_SECURE_DELETE
263 -DSQLITE_ENABLE_BATCH_ATOMIC_WRITE
264 -DBIONIC_IOCTL_NO_SIGNEDNESS_OVERLOAD
265 -DSQLITE_ALLOW_ROWID_IN_VIEW
266 -DSQLITE_ENABLE_BYTECODE_VTAB
267 -Wno-unused
-parameter
270 -Dfdatasync=fdatasync
272 -DHAVE_MALLOC_USABLE_SIZE
273 -DSQLITE_ENABLE_DBSTAT_VTAB
275 # Compile-options used by Android but omitted from these
278 # -DSQLITE_DEFAULT_LEGACY_ALTER_TABLE
279 # -DSQLITE_DEFAULT_JOURNAL_SIZE_LIMIT=1048576
280 # -DSQLITE_DEFAULT_FILE_PERMISSIONS=0600
281 # -DSQLITE_OMIT_BUILTIN_TEST
282 # -DSQLITE_OMIT_LOAD_EXTENSION
283 # -DSQLITE_OMIT_COMPILEOPTION_DIAGS
293 -DSQLITE_DEFAULT_CACHE_SIZE=1000
294 -DSQLITE_DEFAULT_CKPTFULLFSYNC=1
295 -DSQLITE_DEFAULT_MEMSTATUS=1
296 -DSQLITE_DEFAULT_PAGE_SIZE=1024
297 -DSQLITE_DISABLE_PAGECACHE_OVERFLOW_STATS=1
298 -DSQLITE_ENABLE_API_ARMOR=1
299 -DSQLITE_ENABLE_AUTO_PROFILE=1
300 -DSQLITE_ENABLE_FLOCKTIMEOUT=1
301 -DSQLITE_ENABLE_FTS3=1
302 -DSQLITE_ENABLE_FTS3_PARENTHESIS=1
303 -DSQLITE_ENABLE_FTS3_TOKENIZER=1
304 -DSQLITE_ENABLE_PERSIST_WAL=1
305 -DSQLITE_ENABLE_PURGEABLE_PCACHE=1
306 -DSQLITE_ENABLE_RTREE=1
307 -DSQLITE_ENABLE_SETLK_TIMEOUT=2
308 -DSQLITE_ENABLE_SNAPSHOT=1
309 -DSQLITE_ENABLE_UPDATE_DELETE_LIMIT=1
310 -DSQLITE_MAX_LENGTH=2147483645
311 -DSQLITE_MAX_VARIABLE_NUMBER=500000
313 -DSQLITE_OMIT_AUTORESET=1
314 -DSQLITE_OMIT_LOAD_EXTENSION=1
315 -DSQLITE_PREFER_PROXY_LOCKING=1
316 -DSQLITE_SERIES_CONSTRAINT_VERIFY=1
317 -DSQLITE_THREADSAFE=2
319 -DSQLITE_WRITE_WALFRAME_PREBUFFERED=1
324 set build
(Extra-Robustness
) {
325 -DSQLITE_ENABLE_OVERSIZE_CELL_CHECK=1
326 -DSQLITE_MAX_ATTACHED=62
329 -DSQLITE_DEFAULT_FILE_FORMAT=4
330 -DSQLITE_MAX_ATTACHED=30
331 -DSQLITE_ENABLE_COLUMN_METADATA
334 -DSQLITE_ENABLE_FTS4_PARENTHESIS
335 -DSQLITE_DISABLE_FTS4_DEFERRED
336 -DSQLITE_ENABLE_RTREE
339 set build
(No-lookaside
) {
340 -DSQLITE_TEST_REALLOC_STRESS=1
341 -DSQLITE_OMIT_LOOKASIDE=1
343 set build
(Valgrind
) {
344 -DSQLITE_ENABLE_STAT4
346 -DSQLITE_ENABLE_RTREE
347 -DSQLITE_ENABLE_HIDDEN_COLUMNS
348 -DLONGDOUBLE_TYPE=double
349 -DCONFIG_SLOWDOWN_FACTOR=8.0
352 set build
(Windows-Memdebug
) {
356 set build
(Windows-Win32Heap
) {
360 set build
(Windows-Sanitize
) {
367 #-------------------------------------------------------------------------
370 variable ::trd::tcltest
371 variable ::trd::extra
372 variable ::trd::all_configs
373 variable ::trd::build
377 proc trd_builds
{platform
} {
380 set klist
[lsort -uniq [concat \
381 [array names
tcltest ${platform
}.
*] \
382 [array names extra
${platform
}.
*] \
384 if {[llength $klist]==0} {
385 error "no such platform: $platform"
390 foreach {p c
} [split $k "."] {}
396 proc trd_configs
{platform bld
} {
401 if {[info exists
tcltest($platform.
$bld)]} {
402 set clist
$tcltest($platform.
$bld)
404 set clist
$all_configs
405 } elseif
{$clist=="all_plus_autovacuum_crash"} {
406 set clist
[concat $all_configs autovacuum_crash
]
407 } elseif
{$clist=="all_less_no_mutex_try"} {
408 set idx
[lsearch $all_configs no_mutex_try
]
409 set clist
[lreplace $all_configs $idx $idx]
416 proc trd_extras
{platform bld
} {
418 if {[info exists extra
($platform.
$bld)]==0} { return [list] }
419 return $extra($platform.
$bld)
426 # This returns data used by testrunner.tcl to run commands equivalent
427 # to [make fuzztest]. The returned value is a list, which should be
428 # interpreted as a sequence of pairs. The first element of each pair
429 # is an interpreter name. The second element is a list of files.
430 # testrunner.tcl automatically creates one job to build each interpreter,
431 # and one to run each of the files with it once it has been built.
433 # In practice, the returned value looks like this:
436 # {fuzzcheck {$testdir/fuzzdata1.db $testdir/fuzzdata2.db ...}}
437 # {{sessionfuzz run} $testdir/sessionfuzz-data1.db}
440 # where $testdir is replaced by the full-path to the test-directory (the
441 # directory containing this file). "fuzzcheck" and "sessionfuzz" have .exe
442 # extensions on windows.
444 proc trd_fuzztest_data
{} {
446 set lFuzzDb
[glob [file join $::testdir fuzzdata
*.db
]]
447 set lSessionDb
[glob [file join $::testdir sessionfuzz-data
*.db
]]
449 if {$::tcl_platform(platform
)=="windows"} {
450 return [list fuzzcheck.exe
$lFuzzDb]
453 return [list fuzzcheck
$lFuzzDb {sessionfuzz run
} $lSessionDb]
457 proc trd_all_configs
{} {
462 proc trimscript
{text} {
463 set text [string map
{"\n " "\n"} [string trim
$text]]
466 proc make_sh_script
{srcdir opts cflags makeOpts configOpts
} {
468 set tcldir
[::tcl::pkgconfig get libdir
,install
]
470 if {[info exists
::env(OPTS
)]} {
471 append myopts
"# From environment variable:\n"
472 append myopts
"OPTS=$::env(OPTS)\n\n"
474 foreach o
[lsort $opts] {
475 append myopts
"OPTS=\"\$OPTS $o\"\n"
478 return [trimscript
[subst -nocommands {
480 if [ "\$#" -ne 1 ] ; then
481 echo
"Usage: \$0 <target>"
488 if [ ! -f Makefile
] ; then
489 \$SRCDIR/configure
--with-tcl
=\$TCL $configOpts
495 make
\$1 "CFLAGS=\$CFLAGS" "OPTS=\$OPTS" $makeOpts
499 # Generate the text of a *.bat script.
501 proc make_bat_file
{srcdir opts cflags makeOpts
} {
502 set srcdir
[file nativename
[file normalize
$srcdir]]
504 return [trimscript
[subst -nocommands {
507 nmake
/f
$srcdir\\Makefile.msc TOP
="$srcdir" %TARGET
% "CCOPTS=$cflags" "OPTS=$opts" $makeOpts
512 # Generate the text of a shell script.
514 proc make_script
{cfg srcdir bMsvc
} {
515 set opts
[list] ;# OPTS value
516 set cflags
[expr {$bMsvc ?
"-Zi" : "-g"}] ;# CFLAGS value
517 set makeOpts
[list] ;# Extra args for [make]
518 set configOpts
[list] ;# Extra args for [configure]
520 # Define either SQLITE_OS_WIN or SQLITE_OS_UNIX, as appropriate.
521 if {$::tcl_platform(platform
)=="windows"} {
522 lappend opts
-DSQLITE_OS_WIN=1
524 lappend opts
-DSQLITE_OS_UNIX=1
527 # Unless the configuration specifies -DHAVE_USLEEP=0, set -DHAVE_USLEEP=1.
529 if {[lsearch $cfg "-DHAVE_USLEEP=0"]<0} {
530 lappend cfg
-DHAVE_USLEEP=1
533 # Loop through the parameters of the nominated configuration, updating
534 # $opts, $cflags, $makeOpts and $configOpts along the way. Rules are as
537 # 1. If the parameter begins with "-D", add it to $opts.
539 # 2. If the parameter begins with "--" add it to $configOpts. Unless
540 # this command is preparing a script for MSVC - then add an
541 # equivalent to $makeOpts or $opts.
543 # 3. If the parameter begins with "-" add it to $cflags. If in MSVC
544 # mode and the parameter is an -O<integer> option, instead add
545 # an OPTIMIZATIONS=<integer> switch to $makeOpts.
547 # 4. If none of the above apply, add the parameter to $makeOpts
551 if {[string range
$param 0 1]=="-D"} {
556 if {[string range
$param 0 1]=="--"} {
558 lappend configOpts
$param
562 --disable-amalgamation
{
563 lappend makeOpts USE_AMALGAMATION
=0
566 lappend makeOpts USE_CRT_DLL
=0 DYNAMIC_SHELL
=0
569 lappend opts
-DSQLITE_ENABLE_FTS5
572 lappend makeOpts USE_CRT_DLL
=1 DYNAMIC_SHELL
=1
575 lappend opts
-DSQLITE_ENABLE_PREUPDATE_HOOK
576 lappend opts
-DSQLITE_ENABLE_SESSION
581 # lappend makeOpts OPTIMIZATIONS=0
582 lappend opts
-DSQLITE_DEBUG
585 error "Cannot translate $param for MSVC"
593 if {[string range
$param 0 0]=="-"} {
596 if {[regexp -- {^
-O(\d
+)$} $param -> level
]} {
597 lappend makeOpts OPTIMIZATIONS
=$level
600 if {$param eq
"-fsanitize=address,undefined"} {
601 lappend makeOpts ASAN
=1
606 lappend cflags
$param
610 lappend makeOpts
$param
614 set zRet
[make_sh_script
$srcdir $opts $cflags $makeOpts $configOpts]
616 set zRet
[make_bat_file
$srcdir $opts $cflags $makeOpts]
622 # trd_buildscript CONFIG SRCDIR MSVC
624 # This command returns the full text of a script (either a shell script or
625 # an ms-dos bat file) that may be used to build SQLite source code according
626 # to a nominated configuration.
628 # Parameter CONFIG must be a configuration defined above in the ::trd::build
629 # array. SRCDIR is the root directory of an SQLite source tree (the parent
630 # directory of that containing this script). MSVC is a boolean - true to
631 # use the MSVC compiler, false otherwise.
633 proc trd_buildscript
{config srcdir bMsvc
} {
636 # Ensure that the named configuration exists.
637 if {![info exists build
($config)]} {
638 if {$config!="help"} {
639 puts "No such build config: $config"
641 puts "Available configurations: [lsort [array names build]]"
646 # Generate and return the script.
647 return [make_script
$build($config) $srcdir $bMsvc]
652 # trd_test_script_properties PATH
654 # The argument must be a path to a Tcl test script. This function scans the
655 # first 100 lines of the script for lines that look like:
657 # TESTRUNNER: <properties>
659 # where <properties> is a list of identifiers, each of which defines a
660 # property of the test script. Example properties are "slow" or "superslow".
662 proc trd_test_script_properties
{path
} {
663 # Use this global array as a cache:
664 global trd_test_script_properties_cache
666 if {![info exists trd_test_script_properties_cache
($path)]} {
669 for {set line
0} {$line < 100 && ![eof $fd]} {incr line
} {
671 if {[string match
-nocase *testrunner
:* $text]} {
672 regexp -nocase {.
*testrunner
:(.
*)} $text -> properties
673 lappend ret
{*}$properties
676 set trd_test_script_properties_cache
($path) $ret
680 set trd_test_script_properties_cache
($path)