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