OLD | NEW |
(Empty) | |
| 1 |
| 2 set rcsid {$Id: $} |
| 3 |
| 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. |
| 7 # |
| 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: |
| 12 |
| 13 -makefile PATH-TO-MAKEFILE (default "releasetest.mk") |
| 14 -platform PLATFORM (see below) |
| 15 -quick BOOLEAN (default "0") |
| 16 |
| 17 The default value for -makefile is "./releasetest.mk". |
| 18 |
| 19 The script determines the default value for -platform using the |
| 20 $tcl_platform(os) and $tcl_platform(machine) variables. Supported |
| 21 platforms are "Linux-x86", "Linux-x86_64" and "Darwin-i386". |
| 22 |
| 23 If the -quick option is set to true, then the "veryquick.test" script |
| 24 is run for all compilation configurations. Otherwise, sometimes "all.test" |
| 25 is run, sometimes "veryquick.test". |
| 26 |
| 27 Almost any SQLite makefile (except those generated by configure - see below) |
| 28 should work. The following properties are required: |
| 29 |
| 30 * The makefile should support the "fulltest" target. |
| 31 * The makefile should support the variable "OPTS" as a way to pass |
| 32 options from the make command line to lemon and the C compiler. |
| 33 |
| 34 More precisely, the following invocation must be supported: |
| 35 |
| 36 make -f $::MAKEFILE fulltest OPTS="-DSQLITE_SECURE_DELETE=1 -DSQLITE_DEBUG=1" |
| 37 |
| 38 Makefiles generated by the sqlite configure program cannot be used as |
| 39 they do not respect the OPTS variable. |
| 40 |
| 41 Example Makefile contents: |
| 42 |
| 43 ######################################################## |
| 44 TOP=/home/dan/work/sqlite/sqlite |
| 45 |
| 46 TCL_FLAGS=-I/home/dan/tcl/include |
| 47 LIBTCL=-L/home/dan/tcl/lib -ltcl |
| 48 |
| 49 BCC = gcc |
| 50 TCC = gcc -ansi -g $(CFLAGS) |
| 51 NAWK = awk |
| 52 AR = ar cr |
| 53 RANLIB = ranlib |
| 54 THREADLIB = -lpthread -ldl |
| 55 include $(TOP)/main.mk |
| 56 ######################################################## |
| 57 } |
| 58 |
| 59 array set ::Configs { |
| 60 "Default" { |
| 61 -O2 |
| 62 } |
| 63 "Ftrapv" { |
| 64 -O2 -ftrapv |
| 65 -DSQLITE_MAX_ATTACHED=55 |
| 66 -DSQLITE_TCL_DEFAULT_FULLMUTEX=1 |
| 67 } |
| 68 "Unlock-Notify" { |
| 69 -O2 |
| 70 -DSQLITE_ENABLE_UNLOCK_NOTIFY |
| 71 -DSQLITE_THREADSAFE |
| 72 -DSQLITE_TCL_DEFAULT_FULLMUTEX=1 |
| 73 } |
| 74 "Secure-Delete" { |
| 75 -O2 |
| 76 -DSQLITE_SECURE_DELETE=1 |
| 77 -DSQLITE_SOUNDEX=1 |
| 78 } |
| 79 "Update-Delete-Limit" { |
| 80 -O2 |
| 81 -DSQLITE_DEFAULT_FILE_FORMAT=4 |
| 82 -DSQLITE_ENABLE_UPDATE_DELETE_LIMIT=1 |
| 83 } |
| 84 "Debug-One" { |
| 85 -O2 |
| 86 -DSQLITE_DEBUG=1 |
| 87 -DSQLITE_MEMDEBUG=1 |
| 88 -DSQLITE_MUTEX_NOOP=1 |
| 89 -DSQLITE_TCL_DEFAULT_FULLMUTEX=1 |
| 90 -DSQLITE_ENABLE_FTS3=1 |
| 91 -DSQLITE_ENABLE_RTREE=1 |
| 92 -DSQLITE_ENABLE_MEMSYS5=1 |
| 93 -DSQLITE_ENABLE_MEMSYS3=1 |
| 94 -DSQLITE_ENABLE_COLUMN_METADATA=1 |
| 95 } |
| 96 "Device-One" { |
| 97 -O2 |
| 98 -DSQLITE_DEBUG=1 |
| 99 -DSQLITE_DEFAULT_AUTOVACUUM=1 |
| 100 -DSQLITE_DEFAULT_CACHE_SIZE=64 |
| 101 -DSQLITE_DEFAULT_PAGE_SIZE=1024 |
| 102 -DSQLITE_DEFAULT_TEMP_CACHE_SIZE=32 |
| 103 -DSQLITE_DISABLE_LFS=1 |
| 104 -DSQLITE_ENABLE_ATOMIC_WRITE=1 |
| 105 -DSQLITE_ENABLE_IOTRACE=1 |
| 106 -DSQLITE_ENABLE_MEMORY_MANAGEMENT=1 |
| 107 -DSQLITE_MAX_PAGE_SIZE=4096 |
| 108 -DSQLITE_OMIT_LOAD_EXTENSION=1 |
| 109 -DSQLITE_OMIT_PROGRESS_CALLBACK=1 |
| 110 -DSQLITE_OMIT_VIRTUALTABLE=1 |
| 111 -DSQLITE_TEMP_STORE=3 |
| 112 } |
| 113 "Device-Two" { |
| 114 -DSQLITE_4_BYTE_ALIGNED_MALLOC=1 |
| 115 -DSQLITE_DEFAULT_AUTOVACUUM=1 |
| 116 -DSQLITE_DEFAULT_CACHE_SIZE=1000 |
| 117 -DSQLITE_DEFAULT_LOCKING_MODE=0 |
| 118 -DSQLITE_DEFAULT_PAGE_SIZE=1024 |
| 119 -DSQLITE_DEFAULT_TEMP_CACHE_SIZE=1000 |
| 120 -DSQLITE_DISABLE_LFS=1 |
| 121 -DSQLITE_ENABLE_FTS3=1 |
| 122 -DSQLITE_ENABLE_MEMORY_MANAGEMENT=1 |
| 123 -DSQLITE_ENABLE_RTREE=1 |
| 124 -DSQLITE_MAX_COMPOUND_SELECT=50 |
| 125 -DSQLITE_MAX_PAGE_SIZE=32768 |
| 126 -DSQLITE_OMIT_TRACE=1 |
| 127 -DSQLITE_TEMP_STORE=3 |
| 128 -DSQLITE_THREADSAFE=2 |
| 129 } |
| 130 "Locking-Style" { |
| 131 -O2 |
| 132 -DSQLITE_ENABLE_LOCKING_STYLE=1 |
| 133 } |
| 134 "OS-X" { |
| 135 -DSQLITE_OMIT_LOAD_EXTENSION=1 |
| 136 -DSQLITE_DEFAULT_MEMSTATUS=0 |
| 137 -DSQLITE_THREADSAFE=2 |
| 138 -DSQLITE_OS_UNIX=1 |
| 139 -DSQLITE_ENABLE_LOCKING_STYLE=1 |
| 140 -DUSE_PREAD=1 |
| 141 -DSQLITE_ENABLE_RTREE=1 |
| 142 -DSQLITE_ENABLE_FTS3=1 |
| 143 -DSQLITE_ENABLE_FTS3_PARENTHESIS=1 |
| 144 -DSQLITE_DEFAULT_CACHE_SIZE=1000 |
| 145 -DSQLITE_MAX_LENGTH=2147483645 |
| 146 -DSQLITE_MAX_VARIABLE_NUMBER=500000 |
| 147 -DSQLITE_DEBUG=1 |
| 148 -DSQLITE_PREFER_PROXY_LOCKING=1 |
| 149 } |
| 150 "Extra-Robustness" { |
| 151 -DSQLITE_ENABLE_OVERSIZE_CELL_CHECK=1 |
| 152 -DSQLITE_MAX_ATTACHED=62 |
| 153 } |
| 154 } |
| 155 |
| 156 array set ::Platforms { |
| 157 Linux-x86_64 { |
| 158 "Secure-Delete" test |
| 159 "Unlock-Notify" "QUICKTEST_INCLUDE=notify2.test test" |
| 160 "Update-Delete-Limit" test |
| 161 "Debug-One" test |
| 162 "Extra-Robustness" test |
| 163 "Device-Two" test |
| 164 "Ftrapv" test |
| 165 "Default" "threadtest test" |
| 166 "Device-One" fulltest |
| 167 } |
| 168 Linux-i686 { |
| 169 "Unlock-Notify" "QUICKTEST_INCLUDE=notify2.test test" |
| 170 "Device-One" test |
| 171 "Device-Two" test |
| 172 "Default" "threadtest fulltest" |
| 173 } |
| 174 Darwin-i386 { |
| 175 "Locking-Style" test |
| 176 "OS-X" "threadtest fulltest" |
| 177 } |
| 178 } |
| 179 |
| 180 # End of configuration section. |
| 181 ######################################################################### |
| 182 ######################################################################### |
| 183 |
| 184 foreach {key value} [array get ::Platforms] { |
| 185 foreach {v t} $value { |
| 186 if {0==[info exists ::Configs($v)]} { |
| 187 puts stderr "No such configuration: \"$v\"" |
| 188 exit -1 |
| 189 } |
| 190 } |
| 191 } |
| 192 |
| 193 proc run_test_suite {name testtarget config} { |
| 194 |
| 195 # Tcl variable $opts is used to build up the value used to set the |
| 196 # OPTS Makefile variable. Variable $cflags holds the value for |
| 197 # CFLAGS. The makefile will pass OPTS to both gcc and lemon, but |
| 198 # CFLAGS is only passed to gcc. |
| 199 # |
| 200 set cflags "" |
| 201 set opts "" |
| 202 foreach arg $config { |
| 203 if {[string match -D* $arg]} { |
| 204 lappend opts $arg |
| 205 } else { |
| 206 lappend cflags $arg |
| 207 } |
| 208 } |
| 209 |
| 210 set cflags [join $cflags " "] |
| 211 set opts [join $opts " "] |
| 212 append opts " -DSQLITE_NO_SYNC=1 -DHAVE_USLEEP" |
| 213 |
| 214 # Set the sub-directory to use. |
| 215 # |
| 216 set dir [string tolower [string map {- _ " " _} $name]] |
| 217 |
| 218 if {$::tcl_platform(platform)=="windows"} { |
| 219 append opts " -DSQLITE_OS_WIN=1" |
| 220 } elseif {$::tcl_platform(platform)=="os2"} { |
| 221 append opts " -DSQLITE_OS_OS2=1" |
| 222 } else { |
| 223 append opts " -DSQLITE_OS_UNIX=1" |
| 224 } |
| 225 |
| 226 # Run the test. |
| 227 # |
| 228 set makefile [file normalize $::MAKEFILE] |
| 229 file mkdir $dir |
| 230 puts -nonewline "Testing configuration \"$name\" (logfile=$dir/test.log)..." |
| 231 flush stdout |
| 232 |
| 233 set makecmd [concat \ |
| 234 [list exec make -C $dir -f $makefile clean] \ |
| 235 $testtarget \ |
| 236 [list CFLAGS=$cflags OPTS=$opts >& $dir/test.log] \ |
| 237 ] |
| 238 |
| 239 set tm1 [clock seconds] |
| 240 set rc [catch $makecmd] |
| 241 set tm2 [clock seconds] |
| 242 |
| 243 set minutes [expr {($tm2-$tm1)/60}] |
| 244 set seconds [expr {($tm2-$tm1)%60}] |
| 245 puts -nonewline [format " (%d:%.2d) " $minutes $seconds] |
| 246 if {$rc} { |
| 247 puts "FAILED." |
| 248 } else { |
| 249 puts "Ok." |
| 250 } |
| 251 } |
| 252 |
| 253 |
| 254 # This proc processes the command line options passed to this script. |
| 255 # Currently the only option supported is "-makefile", default |
| 256 # "releasetest.mk". Set the ::MAKEFILE variable to the value of this |
| 257 # option. |
| 258 # |
| 259 proc process_options {argv} { |
| 260 set ::MAKEFILE releasetest.mk ;# Default value |
| 261 set ::QUICK 0 ;# Default value |
| 262 set platform $::tcl_platform(os)-$::tcl_platform(machine) |
| 263 |
| 264 for {set i 0} {$i < [llength $argv]} {incr i} { |
| 265 switch -- [lindex $argv $i] { |
| 266 -makefile { |
| 267 incr i |
| 268 set ::MAKEFILE [lindex $argv $i] |
| 269 } |
| 270 |
| 271 -platform { |
| 272 incr i |
| 273 set platform [lindex $argv $i] |
| 274 } |
| 275 |
| 276 -quick { |
| 277 incr i |
| 278 set ::QUICK [lindex $argv $i] |
| 279 } |
| 280 |
| 281 default { |
| 282 puts stderr "" |
| 283 puts stderr [string trim $::USAGE_MESSAGE] |
| 284 exit -1 |
| 285 } |
| 286 } |
| 287 } |
| 288 |
| 289 set ::MAKEFILE [file normalize $::MAKEFILE] |
| 290 |
| 291 if {0==[info exists ::Platforms($platform)]} { |
| 292 puts "Unknown platform: $platform" |
| 293 puts -nonewline "Set the -platform option to " |
| 294 set print [list] |
| 295 foreach p [array names ::Platforms] { |
| 296 lappend print "\"$p\"" |
| 297 } |
| 298 lset print end "or [lindex $print end]" |
| 299 puts "[join $print {, }]." |
| 300 exit |
| 301 } |
| 302 |
| 303 set ::CONFIGLIST $::Platforms($platform) |
| 304 puts "Running the following configurations for $platform:" |
| 305 puts " [string trim $::CONFIGLIST]" |
| 306 } |
| 307 |
| 308 # Main routine. |
| 309 # |
| 310 proc main {argv} { |
| 311 |
| 312 # Process any command line options. |
| 313 process_options $argv |
| 314 |
| 315 foreach {zConfig target} $::CONFIGLIST { |
| 316 if {$::QUICK} {set target test} |
| 317 set config_options $::Configs($zConfig) |
| 318 |
| 319 run_test_suite $zConfig $target $config_options |
| 320 |
| 321 # If the configuration included the SQLITE_DEBUG option, then remove |
| 322 # it and run veryquick.test. If it did not include the SQLITE_DEBUG option |
| 323 # add it and run veryquick.test. |
| 324 set debug_idx [lsearch -glob $config_options -DSQLITE_DEBUG*] |
| 325 if {$debug_idx < 0} { |
| 326 run_test_suite "${zConfig}_debug" test [ |
| 327 concat $config_options -DSQLITE_DEBUG=1 |
| 328 ] |
| 329 } else { |
| 330 run_test_suite "${zConfig}_ndebug" test [ |
| 331 lreplace $config_options $debug_idx $debug_idx |
| 332 ] |
| 333 } |
| 334 |
| 335 } |
| 336 } |
| 337 |
| 338 main $argv |
OLD | NEW |