Update mojo sdk to rev 1dc8a9a5db73d3718d99917fadf31f5fb2ebad4f
[chromium-blink-merge.git] / third_party / sqlite / sqlite-src-3080704 / test / releasetest.tcl
blobd2a1bd2bb0c54606a3c0d655ae82eaff0d9b49b2
2 set rcsid {$Id: $}
4 # Documentation for this script. This may be output to stderr
5 # if the script is invoked incorrectly. See the [process_options]
6 # proc below.
8 set ::USAGE_MESSAGE {
9 This Tcl script is used to test the various configurations required
10 before releasing a new version. Supported command line options (all
11 optional) are:
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
50 BCC = gcc
51 TCC = gcc -ansi -g $(CFLAGS)
52 NAWK = awk
53 AR = ar cr
54 RANLIB = ranlib
55 THREADLIB = -lpthread -ldl
56 include $(TOP)/main.mk
57 ########################################################
60 array set ::Configs {
61 "Default" {
62 -O2
64 "Ftrapv" {
65 -O2 -ftrapv
66 -DSQLITE_MAX_ATTACHED=55
67 -DSQLITE_TCL_DEFAULT_FULLMUTEX=1
69 "Unlock-Notify" {
70 -O2
71 -DSQLITE_ENABLE_UNLOCK_NOTIFY
72 -DSQLITE_THREADSAFE
73 -DSQLITE_TCL_DEFAULT_FULLMUTEX=1
75 "Secure-Delete" {
76 -O2
77 -DSQLITE_SECURE_DELETE=1
78 -DSQLITE_SOUNDEX=1
80 "Update-Delete-Limit" {
81 -O2
82 -DSQLITE_DEFAULT_FILE_FORMAT=4
83 -DSQLITE_ENABLE_UPDATE_DELETE_LIMIT=1
85 "Check-Symbols" {
86 -DSQLITE_MEMDEBUG=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
95 -DSQLITE_SOUNDEX=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
101 "Debug-One" {
103 -DSQLITE_DEBUG=1
104 -DSQLITE_MEMDEBUG=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
113 "Device-One" {
115 -DSQLITE_DEBUG=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
130 "Device-Two" {
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
147 "Locking-Style" {
149 -DSQLITE_ENABLE_LOCKING_STYLE=1
151 "OS-X" {
152 -DSQLITE_OMIT_LOAD_EXTENSION=1
153 -DSQLITE_DEFAULT_MEMSTATUS=0
154 -DSQLITE_THREADSAFE=2
155 -DSQLITE_OS_UNIX=1
156 -DSQLITE_ENABLE_LOCKING_STYLE=1
157 -DUSE_PREAD=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
164 -DSQLITE_DEBUG=1
165 -DSQLITE_PREFER_PROXY_LOCKING=1
167 "Extra-Robustness" {
168 -DSQLITE_ENABLE_OVERSIZE_CELL_CHECK=1
169 -DSQLITE_MAX_ATTACHED=62
171 "Devkit" {
172 -DSQLITE_DEFAULT_FILE_FORMAT=4
173 -DSQLITE_MAX_ATTACHED=30
174 -DSQLITE_ENABLE_COLUMN_METADATA
175 -DSQLITE_ENABLE_FTS4
176 -DSQLITE_ENABLE_FTS4_PARENTHESIS
177 -DSQLITE_DISABLE_FTS4_DEFERRED
178 -DSQLITE_ENABLE_RTREE
181 "No-lookaside" {
182 -DSQLITE_TEST_REALLOC_STRESS=1
183 -DSQLITE_OMIT_LOOKASIDE=1
184 -DHAVE_USLEEP=1
188 array set ::Platforms {
189 Linux-x86_64 {
190 "Check-Symbols" checksymbols
191 "Debug-One" test
192 "Secure-Delete" test
193 "Unlock-Notify" "QUICKTEST_INCLUDE=notify2.test test"
194 "Update-Delete-Limit" test
195 "Extra-Robustness" test
196 "Device-Two" test
197 "Ftrapv" test
198 "No-lookaside" test
199 "Devkit" test
200 "Default" "threadtest fulltest"
201 "Device-One" fulltest
203 Linux-i686 {
204 "Devkit" test
205 "Unlock-Notify" "QUICKTEST_INCLUDE=notify2.test test"
206 "Device-One" test
207 "Device-Two" test
208 "Default" "threadtest fulltest"
210 Darwin-i386 {
211 "Locking-Style" test
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\""
225 exit -1
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.
237 set cflags ""
238 set opts ""
239 foreach arg $config {
240 if {[string match -D* $arg]} {
241 lappend opts $arg
242 } else {
243 lappend cflags $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"
257 } else {
258 append opts " -DSQLITE_OS_UNIX=1"
261 # Run the test.
263 set makefile [file normalize $::MAKEFILE]
264 file mkdir $dir
265 puts -nonewline "Testing configuration \"$name\" (logfile=$dir/test.log)..."
266 flush stdout
268 set makecmd [concat \
269 [list exec make -C $dir -f $makefile clean] \
270 $testtarget \
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]
281 if {$rc} {
282 puts "FAILED."
283 } else {
284 puts "Ok."
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
292 # option.
294 proc process_options {argv} {
295 set ::MAKEFILE releasetest.mk ;# Default value
296 set ::QUICK 0 ;# Default value
297 set config {}
298 set platform $::tcl_platform(os)-$::tcl_platform(machine)
300 for {set i 0} {$i < [llength $argv]} {incr i} {
301 switch -- [lindex $argv $i] {
302 -makefile {
303 incr i
304 set ::MAKEFILE [lindex $argv $i]
307 -platform {
308 incr i
309 set platform [lindex $argv $i]
312 -quick {
313 incr i
314 set ::QUICK [lindex $argv $i]
317 -config {
318 incr i
319 set config [lindex $argv $i]
322 default {
323 puts stderr ""
324 puts stderr [string trim $::USAGE_MESSAGE]
325 exit -1
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 "
335 set print [list]
336 foreach p [array names ::Platforms] {
337 lappend print "\"$p\""
339 lset print end "or [lindex $print end]"
340 puts "[join $print {, }]."
341 exit
344 if {$config!=""} {
345 if {[llength $config]==1} {lappend config fulltest}
346 set ::CONFIGLIST $config
347 } else {
348 set ::CONFIGLIST $::Platforms($platform)
350 puts "Running the following configurations for $platform:"
351 puts " [string trim $::CONFIGLIST]"
354 # Main routine.
356 proc main {argv} {
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
376 } else {
377 run_test_suite "${zConfig}_ndebug" test [
378 lreplace $config_options $debug_idx $debug_idx
386 main $argv