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.Sanitize
) veryquick
27 set tcltest(linux.Device-One
) all
28 set tcltest(linux.Default
) all_plus_autovacuum_crash
29 set tcltest(linux.Valgrind
) valgrind
31 set tcltest(osx.Locking-Style
) veryquick
32 set tcltest(osx.Have-Not
) veryquick
33 set tcltest(osx.Apple
) all_less_no_mutex_try
35 set tcltest(win.Stdcall
) veryquick
36 set tcltest(win.Have-Not
) veryquick
37 set tcltest(win.Windows-Memdebug
) veryquick
38 set tcltest(win.Windows-Win32Heap
) veryquick
39 set tcltest(win.Windows-Sanitize
) veryquick
40 set tcltest(win.Default
) full
42 # Extra [make xyz] tests that should be run for various builds.
44 set extra
(linux.Check-Symbols
) checksymbols
45 set extra
(linux.Fast-One
) {fuzztest sourcetest
}
46 set extra
(linux.Debug-One
) {fuzztest sourcetest mptest
}
47 set extra
(linux.Debug-Two
) {fuzztest sourcetest
}
48 set extra
(linux.Have-Not
) {fuzztest sourcetest
}
49 set extra
(linux.Secure-Delete
) {fuzztest sourcetest
}
50 set extra
(linux.Unlock-Notify
) {fuzztest sourcetest
}
51 set extra
(linux.Update-Delete-Limit
) {fuzztest sourcetest
}
52 set extra
(linux.Extra-Robustness
) {fuzztest sourcetest
}
53 set extra
(linux.Device-Two
) {fuzztest sourcetest threadtest
}
54 set extra
(linux.No-lookaside
) {fuzztest sourcetest
}
55 set extra
(linux.Devkit
) {fuzztest sourcetest
}
56 set extra
(linux.Apple
) {fuzztest sourcetest
}
57 set extra
(linux.Sanitize
) {fuzztest sourcetest
}
58 set extra
(linux.Default
) {fuzztest sourcetest threadtest
}
60 set extra
(osx.Apple
) {fuzztest threadtest
}
61 set extra
(osx.Have-Not
) {fuzztest sourcetest
}
62 set extra
(osx.Locking-Style
) {mptest fuzztest sourcetest
}
64 set extra
(win.Default
) mptest
65 set extra
(win.Stdcall
) {fuzztest sourcetest
}
66 set extra
(win.Windows-Memdebug
) {fuzztest sourcetest
}
67 set extra
(win.Windows-Win32Heap
) {fuzztest sourcetest
}
68 set extra
(win.Windows-Sanitize
) fuzztest
69 set extra
(win.Have-Not
) {fuzztest sourcetest
}
71 # The following mirrors the set of test suites invoked by "all.test".
74 full no_optimization memsubsys1 memsubsys2 singlethread
75 multithread onefile utf16 exclusive persistent_journal
76 persistent_journal_error no_journal no_journal_error
77 autovacuum_ioerr no_mutex_try fullmutex journaltest
78 inmemory_journal pcache0 pcache10 pcache50 pcache90
79 pcache100 prepare mmap
82 #-----------------------------------------------------------------------
83 # Start of build() definitions.
87 --disable-amalgamation
--disable-shared
92 # These two are used by [testrunner.tcl mdevtest] (All-O0) and
93 # [testrunner.tcl sdevtest] (All-Sanitize).
95 set build
(All-Debug
) {
96 --enable-debug
--enable-all
101 set build
(All-Sanitize
) {
102 -DSQLITE_OMIT_LOOKASIDE=1
103 --enable-all
-fsanitize=address
,undefined
-fno-sanitize
-recover
=undefined
106 set build
(Sanitize
) {
107 CC
=clang
-fsanitize=address
,undefined
-fno-sanitize
-recover
=undefined
108 -DSQLITE_ENABLE_STAT4
109 -DSQLITE_OMIT_LOOKASIDE=1
110 -DCONFIG_SLOWDOWN_FACTOR=5.0
119 # The "Have-Not" configuration sets all possible -UHAVE_feature options
120 # in order to verify that the code works even on platforms that lack
121 # these support services.
122 set build
(Have-Not
) {
128 -DHAVE_MALLOC_USABLE_SIZE=0
133 set build
(Unlock-Notify
) {
135 -DSQLITE_ENABLE_UNLOCK_NOTIFY
137 -DSQLITE_TCL_DEFAULT_FULLMUTEX=1
139 set build
(User-Auth
) {
141 -DSQLITE_USER_AUTHENTICATION=1
143 set build
(Secure-Delete
) {
145 -DSQLITE_SECURE_DELETE=1
148 set build
(Update-Delete-Limit
) {
150 -DSQLITE_DEFAULT_FILE_FORMAT=4
151 -DSQLITE_ENABLE_UPDATE_DELETE_LIMIT=1
152 -DSQLITE_ENABLE_STMT_SCANSTATUS
153 -DSQLITE_LIKE_DOESNT_MATCH_BLOBS
154 -DSQLITE_ENABLE_CURSOR_HINTS
156 set build
(Check-Symbols
) {
158 -DSQLITE_ENABLE_FTS3_PARENTHESIS=1
159 -DSQLITE_ENABLE_FTS3=1
160 -DSQLITE_ENABLE_RTREE=1
161 -DSQLITE_ENABLE_MEMSYS5=1
162 -DSQLITE_ENABLE_MEMSYS3=1
163 -DSQLITE_ENABLE_COLUMN_METADATA=1
164 -DSQLITE_ENABLE_UPDATE_DELETE_LIMIT=1
165 -DSQLITE_SECURE_DELETE=1
167 -DSQLITE_ENABLE_ATOMIC_WRITE=1
168 -DSQLITE_ENABLE_MEMORY_MANAGEMENT=1
169 -DSQLITE_ENABLE_OVERSIZE_CELL_CHECK=1
170 -DSQLITE_ENABLE_STAT4
171 -DSQLITE_ENABLE_STMT_SCANSTATUS
172 --enable-fts
5 --enable-session
174 set build
(Debug-One
) {
179 -DSQLITE_MUTEX_NOOP=1
180 -DSQLITE_TCL_DEFAULT_FULLMUTEX=1
181 -DSQLITE_ENABLE_FTS3=1
182 -DSQLITE_ENABLE_RTREE=1
183 -DSQLITE_ENABLE_MEMSYS5=1
184 -DSQLITE_ENABLE_COLUMN_METADATA=1
185 -DSQLITE_ENABLE_STAT4
186 -DSQLITE_ENABLE_HIDDEN_COLUMNS
187 -DSQLITE_MAX_ATTACHED=125
188 -DSQLITE_MUTATION_TEST
191 set build
(Debug-Two
) {
192 -DSQLITE_DEFAULT_MEMSTATUS=0
193 -DSQLITE_MAX_EXPR_DEPTH=0
196 set build
(Fast-One
) {
198 -DSQLITE_ENABLE_FTS4=1
199 -DSQLITE_ENABLE_RTREE=1
200 -DSQLITE_ENABLE_STAT4
202 -DSQLITE_MAX_ATTACHED=125
203 -DSQLITE_MAX_MMAP_SIZE=12884901888
204 -DSQLITE_ENABLE_SORTER_MMAP=1
205 -DLONGDOUBLE_TYPE=double
208 set build
(Device-One
) {
211 -DSQLITE_DEFAULT_AUTOVACUUM=1
212 -DSQLITE_DEFAULT_CACHE_SIZE=64
213 -DSQLITE_DEFAULT_PAGE_SIZE=1024
214 -DSQLITE_DEFAULT_TEMP_CACHE_SIZE=32
215 -DSQLITE_DISABLE_LFS=1
216 -DSQLITE_ENABLE_ATOMIC_WRITE=1
217 -DSQLITE_ENABLE_IOTRACE=1
218 -DSQLITE_ENABLE_MEMORY_MANAGEMENT=1
219 -DSQLITE_MAX_PAGE_SIZE=4096
220 -DSQLITE_OMIT_LOAD_EXTENSION=1
221 -DSQLITE_OMIT_PROGRESS_CALLBACK=1
222 -DSQLITE_OMIT_VIRTUALTABLE=1
223 -DSQLITE_ENABLE_HIDDEN_COLUMNS
224 -DSQLITE_TEMP_STORE=3
226 set build
(Device-Two
) {
227 -DSQLITE_4_BYTE_ALIGNED_MALLOC=1
228 -DSQLITE_DEFAULT_AUTOVACUUM=1
229 -DSQLITE_DEFAULT_CACHE_SIZE=1000
230 -DSQLITE_DEFAULT_LOCKING_MODE=0
231 -DSQLITE_DEFAULT_PAGE_SIZE=1024
232 -DSQLITE_DEFAULT_TEMP_CACHE_SIZE=1000
233 -DSQLITE_DISABLE_LFS=1
234 -DSQLITE_ENABLE_FTS3=1
235 -DSQLITE_ENABLE_MEMORY_MANAGEMENT=1
236 -DSQLITE_ENABLE_RTREE=1
237 -DSQLITE_MAX_COMPOUND_SELECT=50
238 -DSQLITE_MAX_PAGE_SIZE=32768
239 -DSQLITE_OMIT_TRACE=1
240 -DSQLITE_TEMP_STORE=3
241 -DSQLITE_THREADSAFE=2
242 --enable-fts
5 --enable-session
244 set build
(Locking-Style
) {
246 -DSQLITE_ENABLE_LOCKING_STYLE=1
256 -DSQLITE_DEFAULT_CACHE_SIZE=1000
257 -DSQLITE_DEFAULT_CKPTFULLFSYNC=1
258 -DSQLITE_DEFAULT_MEMSTATUS=1
259 -DSQLITE_DEFAULT_PAGE_SIZE=1024
260 -DSQLITE_DISABLE_PAGECACHE_OVERFLOW_STATS=1
261 -DSQLITE_ENABLE_API_ARMOR=1
262 -DSQLITE_ENABLE_AUTO_PROFILE=1
263 -DSQLITE_ENABLE_FLOCKTIMEOUT=1
264 -DSQLITE_ENABLE_FTS3=1
265 -DSQLITE_ENABLE_FTS3_PARENTHESIS=1
266 -DSQLITE_ENABLE_FTS3_TOKENIZER=1
267 -DSQLITE_ENABLE_PERSIST_WAL=1
268 -DSQLITE_ENABLE_PURGEABLE_PCACHE=1
269 -DSQLITE_ENABLE_RTREE=1
270 -DSQLITE_ENABLE_SETLK_TIMEOUT=2
271 -DSQLITE_ENABLE_SNAPSHOT=1
272 -DSQLITE_ENABLE_UPDATE_DELETE_LIMIT=1
273 -DSQLITE_MAX_LENGTH=2147483645
274 -DSQLITE_MAX_VARIABLE_NUMBER=500000
276 -DSQLITE_OMIT_AUTORESET=1
277 -DSQLITE_OMIT_LOAD_EXTENSION=1
278 -DSQLITE_PREFER_PROXY_LOCKING=1
279 -DSQLITE_SERIES_CONSTRAINT_VERIFY=1
280 -DSQLITE_THREADSAFE=2
282 -DSQLITE_WRITE_WALFRAME_PREBUFFERED=1
287 set build
(Extra-Robustness
) {
288 -DSQLITE_ENABLE_OVERSIZE_CELL_CHECK=1
289 -DSQLITE_MAX_ATTACHED=62
292 -DSQLITE_DEFAULT_FILE_FORMAT=4
293 -DSQLITE_MAX_ATTACHED=30
294 -DSQLITE_ENABLE_COLUMN_METADATA
297 -DSQLITE_ENABLE_FTS4_PARENTHESIS
298 -DSQLITE_DISABLE_FTS4_DEFERRED
299 -DSQLITE_ENABLE_RTREE
302 set build
(No-lookaside
) {
303 -DSQLITE_TEST_REALLOC_STRESS=1
304 -DSQLITE_OMIT_LOOKASIDE=1
306 set build
(Valgrind
) {
307 -DSQLITE_ENABLE_STAT4
309 -DSQLITE_ENABLE_RTREE
310 -DSQLITE_ENABLE_HIDDEN_COLUMNS
311 -DLONGDOUBLE_TYPE=double
312 -DCONFIG_SLOWDOWN_FACTOR=8.0
315 set build
(Windows-Memdebug
) {
319 set build
(Windows-Win32Heap
) {
323 set build
(Windows-Sanitize
) {
330 #-------------------------------------------------------------------------
333 variable ::trd::tcltest
334 variable ::trd::extra
335 variable ::trd::all_configs
336 variable ::trd::build
340 proc trd_builds
{platform
} {
343 set klist
[lsort -uniq [concat \
344 [array names
tcltest ${platform
}.
*] \
345 [array names extra
${platform
}.
*] \
347 if {[llength $klist]==0} {
348 error "no such platform: $platform"
353 foreach {p c
} [split $k "."] {}
359 proc trd_configs
{platform bld
} {
364 if {[info exists
tcltest($platform.
$bld)]} {
365 set clist
$tcltest($platform.
$bld)
367 set clist
$all_configs
368 } elseif
{$clist=="all_plus_autovacuum_crash"} {
369 set clist
[concat $all_configs autovacuum_crash
]
370 } elseif
{$clist=="all_less_no_mutex_try"} {
371 set idx
[lsearch $all_configs no_mutex_try
]
372 set clist
[lreplace $all_configs $idx $idx]
379 proc trd_extras
{platform bld
} {
381 if {[info exists extra
($platform.
$bld)]==0} { return [list] }
382 return $extra($platform.
$bld)
389 # This returns data used by testrunner.tcl to run commands equivalent
390 # to [make fuzztest]. The returned value is a list, which should be
391 # interpreted as a sequence of pairs. The first element of each pair
392 # is an interpreter name. The second element is a list of files.
393 # testrunner.tcl automatically creates one job to build each interpreter,
394 # and one to run each of the files with it once it has been built.
396 # In practice, the returned value looks like this:
399 # {fuzzcheck {$testdir/fuzzdata1.db $testdir/fuzzdata2.db ...}}
400 # {{sessionfuzz run} $testdir/sessionfuzz-data1.db}
403 # where $testdir is replaced by the full-path to the test-directory (the
404 # directory containing this file). "fuzzcheck" and "sessionfuzz" have .exe
405 # extensions on windows.
407 proc trd_fuzztest_data
{} {
409 set lFuzzDb
[glob [file join $::testdir fuzzdata
*.db
]]
410 set lSessionDb
[glob [file join $::testdir sessionfuzz-data
*.db
]]
412 if {$::tcl_platform(platform
)=="windows"} {
413 return [list fuzzcheck.exe
$lFuzzDb]
416 return [list fuzzcheck
$lFuzzDb {sessionfuzz run
} $lSessionDb]
420 proc trd_all_configs
{} {
425 proc trimscript
{text} {
426 set text [string map
{"\n " "\n"} [string trim
$text]]
429 proc make_sh_script
{srcdir opts cflags makeOpts configOpts
} {
431 set tcldir
[::tcl::pkgconfig get libdir
,install
]
433 if {[info exists
::env(OPTS
)]} {
434 append myopts
"# From environment variable:\n"
435 append myopts
"OPTS=$::env(OPTS)\n\n"
437 foreach o
[lsort $opts] {
438 append myopts
"OPTS=\"\$OPTS $o\"\n"
441 return [trimscript
[subst -nocommands {
443 if [ "\$#" -ne 1 ] ; then
444 echo
"Usage: \$0 <target>"
451 if [ ! -f Makefile
] ; then
452 \$SRCDIR/configure
--with-tcl
=\$TCL $configOpts
458 make
\$1 "CFLAGS=\$CFLAGS" "OPTS=\$OPTS" $makeOpts
462 # Generate the text of a *.bat script.
464 proc make_bat_file
{srcdir opts cflags makeOpts
} {
465 set srcdir
[file nativename
[file normalize
$srcdir]]
467 return [trimscript
[subst -nocommands {
470 nmake
/f
$srcdir\\Makefile.msc TOP
="$srcdir" %TARGET
% "CCOPTS=$cflags" "OPTS=$opts" $makeOpts
475 # Generate the text of a shell script.
477 proc make_script
{cfg srcdir bMsvc
} {
478 set opts
[list] ;# OPTS value
479 set cflags
[expr {$bMsvc ?
"-Zi" : "-g"}] ;# CFLAGS value
480 set makeOpts
[list] ;# Extra args for [make]
481 set configOpts
[list] ;# Extra args for [configure]
483 # Define either SQLITE_OS_WIN or SQLITE_OS_UNIX, as appropriate.
484 if {$::tcl_platform(platform
)=="windows"} {
485 lappend opts
-DSQLITE_OS_WIN=1
487 lappend opts
-DSQLITE_OS_UNIX=1
490 # Unless the configuration specifies -DHAVE_USLEEP=0, set -DHAVE_USLEEP=1.
492 if {[lsearch $cfg "-DHAVE_USLEEP=0"]<0} {
493 lappend cfg
-DHAVE_USLEEP=1
496 # Loop through the parameters of the nominated configuration, updating
497 # $opts, $cflags, $makeOpts and $configOpts along the way. Rules are as
500 # 1. If the parameter begins with "-D", add it to $opts.
502 # 2. If the parameter begins with "--" add it to $configOpts. Unless
503 # this command is preparing a script for MSVC - then add an
504 # equivalent to $makeOpts or $opts.
506 # 3. If the parameter begins with "-" add it to $cflags. If in MSVC
507 # mode and the parameter is an -O<integer> option, instead add
508 # an OPTIMIZATIONS=<integer> switch to $makeOpts.
510 # 4. If none of the above apply, add the parameter to $makeOpts
514 if {[string range
$param 0 1]=="-D"} {
519 if {[string range
$param 0 1]=="--"} {
521 lappend configOpts
$param
525 --disable-amalgamation
{
526 lappend makeOpts USE_AMALGAMATION
=0
529 lappend makeOpts USE_CRT_DLL
=0 DYNAMIC_SHELL
=0
532 lappend opts
-DSQLITE_ENABLE_FTS5
535 lappend makeOpts USE_CRT_DLL
=1 DYNAMIC_SHELL
=1
538 lappend opts
-DSQLITE_ENABLE_PREUPDATE_HOOK
539 lappend opts
-DSQLITE_ENABLE_SESSION
544 # lappend makeOpts OPTIMIZATIONS=0
545 lappend opts
-DSQLITE_DEBUG
548 error "Cannot translate $param for MSVC"
556 if {[string range
$param 0 0]=="-"} {
559 if {[regexp -- {^
-O(\d
+)$} $param -> level
]} {
560 lappend makeOpts OPTIMIZATIONS
=$level
563 if {$param eq
"-fsanitize=address,undefined"} {
564 lappend makeOpts ASAN
=1
569 lappend cflags
$param
573 lappend makeOpts
$param
577 set zRet
[make_sh_script
$srcdir $opts $cflags $makeOpts $configOpts]
579 set zRet
[make_bat_file
$srcdir $opts $cflags $makeOpts]
585 # trd_buildscript CONFIG SRCDIR MSVC
587 # This command returns the full text of a script (either a shell script or
588 # an ms-dos bat file) that may be used to build SQLite source code according
589 # to a nominated configuration.
591 # Parameter CONFIG must be a configuration defined above in the ::trd::build
592 # array. SRCDIR is the root directory of an SQLite source tree (the parent
593 # directory of that containing this script). MSVC is a boolean - true to
594 # use the MSVC compiler, false otherwise.
596 proc trd_buildscript
{config srcdir bMsvc
} {
599 # Ensure that the named configuration exists.
600 if {![info exists build
($config)]} {
601 error "No such build config: $config"
604 # Generate and return the script.
605 return [make_script
$build($config) $srcdir $bMsvc]
610 # trd_test_script_properties PATH
612 # The argument must be a path to a Tcl test script. This function scans the
613 # first 100 lines of the script for lines that look like:
615 # TESTRUNNER: <properties>
617 # where <properties> is a list of identifiers, each of which defines a
618 # property of the test script. Example properties are "slow" or "superslow".
620 proc trd_test_script_properties
{path
} {
621 # Use this global array as a cache:
622 global trd_test_script_properties_cache
624 if {![info exists trd_test_script_properties_cache
($path)]} {
627 for {set line
0} {$line < 100 && ![eof $fd]} {incr line
} {
629 if {[string match
-nocase *testrunner
:* $text]} {
630 regexp -nocase {.
*testrunner
:(.
*)} $text -> properties
631 lappend ret
{*}$properties
634 set trd_test_script_properties_cache
($path) $ret
638 set trd_test_script_properties_cache
($path)