4 # Documentation for this script. This may be output to stderr
5 # if the script is invoked incorrectly. See the [process_options]
9 This
Tcl script is used to test the various configurations required
10 before releasing a new version. Supported command line
options (all
13 -makefile PATH-TO-MAKEFILE
(default "releasetest.mk")
14 -platform PLATFORM
(see below
)
15 -quick BOOLEAN
(default "0")
16 -config CONFIGNAME
(Run only CONFIGNAME
)
18 The
default value
for -makefile is
"./releasetest.mk".
20 The script determines the
default value
for -platform using the
21 $tcl_platform(os
) and
$tcl_platform(machine
) variables. Supported
22 platforms are
"Linux-x86", "Linux-x86_64" and
"Darwin-i386".
24 If the
-quick option is
set to true
, then the
"veryquick.test" script
25 is run
for all compilation configurations. Otherwise
, sometimes
"all.test"
26 is run
, sometimes
"veryquick.test".
28 Almost any SQLite makefile
(except those generated by configure
- see below
)
29 should work. The following properties are required
:
31 * The makefile should support the
"fulltest" target.
32 * The makefile should support the
variable "OPTS" as a way to pass
33 options from the make command line to lemon and the C compiler.
35 More precisely
, the following invocation must be supported
:
37 make
-f $::MAKEFILE fulltest OPTS
="-DSQLITE_SECURE_DELETE=1 -DSQLITE_DEBUG=1"
39 Makefiles generated by the sqlite configure program cannot be used as
40 they do not respect the OPTS
variable.
42 Example Makefile contents
:
44 ########################################################
45 TOP
=/home
/dan
/work
/sqlite
/sqlite
47 TCL_FLAGS
=-I/home
/dan
/tcl
/include
48 LIBTCL
=-L/home
/dan
/tcl
/lib
-ltcl
51 TCC
= gcc
-ansi -g $(CFLAGS
)
55 THREADLIB
= -lpthread -ldl
56 include
$(TOP
)/main.mk
57 ########################################################
66 -DSQLITE_MAX_ATTACHED=55
67 -DSQLITE_TCL_DEFAULT_FULLMUTEX=1
71 -DSQLITE_ENABLE_UNLOCK_NOTIFY
73 -DSQLITE_TCL_DEFAULT_FULLMUTEX=1
77 -DSQLITE_SECURE_DELETE=1
80 "Update-Delete-Limit" {
82 -DSQLITE_DEFAULT_FILE_FORMAT=4
83 -DSQLITE_ENABLE_UPDATE_DELETE_LIMIT=1
87 -DSQLITE_ENABLE_FTS3_PARENTHESIS=1
88 -DSQLITE_ENABLE_FTS3=1
89 -DSQLITE_ENABLE_RTREE=1
90 -DSQLITE_ENABLE_MEMSYS5=1
91 -DSQLITE_ENABLE_MEMSYS3=1
92 -DSQLITE_ENABLE_COLUMN_METADATA=1
93 -DSQLITE_ENABLE_UPDATE_DELETE_LIMIT=1
94 -DSQLITE_SECURE_DELETE=1
96 -DSQLITE_ENABLE_ATOMIC_WRITE=1
97 -DSQLITE_ENABLE_IOTRACE=1
98 -DSQLITE_ENABLE_MEMORY_MANAGEMENT=1
99 -DSQLITE_ENABLE_OVERSIZE_CELL_CHECK=1
105 -DSQLITE_MUTEX_NOOP=1
106 -DSQLITE_TCL_DEFAULT_FULLMUTEX=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
116 -DSQLITE_DEFAULT_AUTOVACUUM=1
117 -DSQLITE_DEFAULT_CACHE_SIZE=64
118 -DSQLITE_DEFAULT_PAGE_SIZE=1024
119 -DSQLITE_DEFAULT_TEMP_CACHE_SIZE=32
120 -DSQLITE_DISABLE_LFS=1
121 -DSQLITE_ENABLE_ATOMIC_WRITE=1
122 -DSQLITE_ENABLE_IOTRACE=1
123 -DSQLITE_ENABLE_MEMORY_MANAGEMENT=1
124 -DSQLITE_MAX_PAGE_SIZE=4096
125 -DSQLITE_OMIT_LOAD_EXTENSION=1
126 -DSQLITE_OMIT_PROGRESS_CALLBACK=1
127 -DSQLITE_OMIT_VIRTUALTABLE=1
128 -DSQLITE_TEMP_STORE=3
131 -DSQLITE_4_BYTE_ALIGNED_MALLOC=1
132 -DSQLITE_DEFAULT_AUTOVACUUM=1
133 -DSQLITE_DEFAULT_CACHE_SIZE=1000
134 -DSQLITE_DEFAULT_LOCKING_MODE=0
135 -DSQLITE_DEFAULT_PAGE_SIZE=1024
136 -DSQLITE_DEFAULT_TEMP_CACHE_SIZE=1000
137 -DSQLITE_DISABLE_LFS=1
138 -DSQLITE_ENABLE_FTS3=1
139 -DSQLITE_ENABLE_MEMORY_MANAGEMENT=1
140 -DSQLITE_ENABLE_RTREE=1
141 -DSQLITE_MAX_COMPOUND_SELECT=50
142 -DSQLITE_MAX_PAGE_SIZE=32768
143 -DSQLITE_OMIT_TRACE=1
144 -DSQLITE_TEMP_STORE=3
145 -DSQLITE_THREADSAFE=2
149 -DSQLITE_ENABLE_LOCKING_STYLE=1
152 -DSQLITE_OMIT_LOAD_EXTENSION=1
153 -DSQLITE_DEFAULT_MEMSTATUS=0
154 -DSQLITE_THREADSAFE=2
156 -DSQLITE_ENABLE_LOCKING_STYLE=1
158 -DSQLITE_ENABLE_RTREE=1
159 -DSQLITE_ENABLE_FTS3=1
160 -DSQLITE_ENABLE_FTS3_PARENTHESIS=1
161 -DSQLITE_DEFAULT_CACHE_SIZE=1000
162 -DSQLITE_MAX_LENGTH=2147483645
163 -DSQLITE_MAX_VARIABLE_NUMBER=500000
165 -DSQLITE_PREFER_PROXY_LOCKING=1
168 -DSQLITE_ENABLE_OVERSIZE_CELL_CHECK=1
169 -DSQLITE_MAX_ATTACHED=62
172 -DSQLITE_DEFAULT_FILE_FORMAT=4
173 -DSQLITE_MAX_ATTACHED=30
174 -DSQLITE_ENABLE_COLUMN_METADATA
176 -DSQLITE_ENABLE_FTS4_PARENTHESIS
177 -DSQLITE_DISABLE_FTS4_DEFERRED
178 -DSQLITE_ENABLE_RTREE
182 -DSQLITE_TEST_REALLOC_STRESS=1
183 -DSQLITE_OMIT_LOOKASIDE=1
188 array set ::Platforms {
190 "Check-Symbols" checksymbols
193 "Unlock-Notify" "QUICKTEST_INCLUDE=notify2.test test"
194 "Update-Delete-Limit" test
195 "Extra-Robustness" test
200 "Default" "threadtest fulltest"
201 "Device-One" fulltest
205 "Unlock-Notify" "QUICKTEST_INCLUDE=notify2.test test"
208 "Default" "threadtest fulltest"
212 "OS-X" "threadtest fulltest"
217 # End of configuration section.
218 #########################################################################
219 #########################################################################
221 foreach {key value
} [array get
::Platforms] {
222 foreach {v t
} $value {
223 if {0==[info exists
::Configs($v)]} {
224 puts stderr
"No such configuration: \"$v\""
230 proc run_test_suite
{name testtarget config
} {
232 # Tcl variable $opts is used to build up the value used to set the
233 # OPTS Makefile variable. Variable $cflags holds the value for
234 # CFLAGS. The makefile will pass OPTS to both gcc and lemon, but
235 # CFLAGS is only passed to gcc.
239 foreach arg
$config {
240 if {[string match
-D* $arg]} {
247 set cflags
[join $cflags " "]
248 set opts
[join $opts " "]
249 append opts
" -DSQLITE_NO_SYNC=1 -DHAVE_USLEEP"
251 # Set the sub-directory to use.
253 set dir
[string tolower
[string map
{- _
" " _
} $name]]
255 if {$::tcl_platform(platform
)=="windows"} {
256 append opts
" -DSQLITE_OS_WIN=1"
258 append opts
" -DSQLITE_OS_UNIX=1"
263 set makefile
[file normalize
$::MAKEFILE]
265 puts -nonewline "Testing configuration \"$name\" (logfile=$dir/test.log)..."
268 set makecmd
[concat \
269 [list exec make
-C $dir -f $makefile clean
] \
271 [list CFLAGS
=$cflags OPTS
=$opts >& $dir/test.log
] \
274 set tm1
[clock seconds
]
275 set rc
[catch $makecmd]
276 set tm2
[clock seconds
]
278 set minutes
[expr {($tm2-$tm1)/60}]
279 set seconds
[expr {($tm2-$tm1)%60}]
280 puts -nonewline [format " (%d:%.2d) " $minutes $seconds]
289 # This proc processes the command line options passed to this script.
290 # Currently the only option supported is "-makefile", default
291 # "releasetest.mk". Set the ::MAKEFILE variable to the value of this
294 proc process_options
{argv
} {
295 set ::MAKEFILE releasetest.mk
;# Default value
296 set ::QUICK 0 ;# Default value
298 set platform
$::tcl_platform(os
)-$::tcl_platform(machine
)
300 for {set i
0} {$i < [llength $argv]} {incr i
} {
301 switch -- [lindex $argv $i] {
304 set ::MAKEFILE [lindex $argv $i]
309 set platform
[lindex $argv $i]
314 set ::QUICK [lindex $argv $i]
319 set config
[lindex $argv $i]
324 puts stderr
[string trim
$::USAGE_MESSAGE]
330 set ::MAKEFILE [file normalize
$::MAKEFILE]
332 if {0==[info exists
::Platforms($platform)]} {
333 puts "Unknown platform: $platform"
334 puts -nonewline "Set the -platform option to "
336 foreach p
[array names
::Platforms] {
337 lappend print
"\"$p\""
339 lset print end
"or [lindex $print end]"
340 puts "[join $print {, }]."
345 if {[llength $config]==1} {lappend config fulltest
}
346 set ::CONFIGLIST $config
348 set ::CONFIGLIST $::Platforms($platform)
350 puts "Running the following configurations for $platform:"
351 puts " [string trim $::CONFIGLIST]"
358 # Process any command line options.
359 process_options
$argv
361 foreach {zConfig target
} $::CONFIGLIST {
362 if {$::QUICK} {set target test
}
363 set config_options
$::Configs($zConfig)
365 run_test_suite
$zConfig $target $config_options
367 # If the configuration included the SQLITE_DEBUG option, then remove
368 # it and run veryquick.test. If it did not include the SQLITE_DEBUG option
369 # add it and run veryquick.test.
370 if {$target!="checksymbols"} {
371 set debug_idx
[lsearch -glob $config_options -DSQLITE_DEBUG*]
372 if {$debug_idx < 0} {
373 run_test_suite
"${zConfig}_debug" test
[
374 concat $config_options -DSQLITE_DEBUG=1
377 run_test_suite
"${zConfig}_ndebug" test
[
378 lreplace $config_options $debug_idx $debug_idx