Rework the test/releasetest.tcl script so that it uses the autoconf makefile

instead of the test/releasetest.mk makefile.  Also add options like --dryrun
and --buildonly.  Omit the --makefile option and replace it with --srcdir
with the default computed relative to the releasetest.tcl script itself.

FossilOrigin-Name: 7c85e831153f9aef2afaf981d53db38a28091be5
This commit is contained in:
drh 2014-12-23 19:40:51 +00:00
parent 4a86d00162
commit d477eee312
4 changed files with 118 additions and 99 deletions

View File

@ -1,5 +1,5 @@
C Fix\sa\stypo\sin\san\sevidence\smark\son\sa\stest\sscript.\s\sNo\schanges\sto\scode.
D 2014-12-22T22:02:20.146
C Rework\sthe\stest/releasetest.tcl\sscript\sso\sthat\sit\suses\sthe\sautoconf\smakefile\ninstead\sof\sthe\stest/releasetest.mk\smakefile.\s\sAlso\sadd\soptions\slike\s--dryrun\nand\s--buildonly.\s\sOmit\sthe\s--makefile\soption\sand\sreplace\sit\swith\s--srcdir\nwith\sthe\sdefault\scomputed\srelative\sto\sthe\sreleasetest.tcl\sscript\sitself.
D 2014-12-23T19:40:51.746
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in 6c4f961fa91d0b4fa121946a19f9e5eac2f2f809
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@ -801,8 +801,7 @@ F test/randexpr1.test eda062a97e60f9c38ae8d806b03b0ddf23d796df
F test/rdonly.test dd30a4858d8e0fbad2304c2bd74a33d4df36412a
F test/regexp1.test 497ea812f264d12b6198d6e50a76be4a1973a9d8
F test/reindex.test 44edd3966b474468b823d481eafef0c305022254
F test/releasetest.mk 2eced2f9ae701fd0a29e714a241760503ccba25a
F test/releasetest.tcl a4279c890698584feb2ffc86735857a4e4474180
F test/releasetest.tcl b57a20ccc7aa64be8b52906d211b1ed4c0998cc2
F test/resolver01.test 33abf37ff8335e6bf98f2b45a0af3e06996ccd9a
F test/rollback.test 458fe73eb3ffdfdf9f6ba3e9b7350a6220414dea
F test/rollback2.test fc14cf6d1a2b250d2735ef16124b971bce152f14
@ -1234,7 +1233,10 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
P 7a97826f33460f3b4f3890c9cf97116c3355eeda
R 75921305dcdb8922f71566b00cf9fa0c
P a08b0c7512287ce5ae3fffe02c092d0eb25b3a25
R d1cf8fd2536e09346a06ad4dd6ebb5ea
T *branch * releasetest-refactor
T *sym-releasetest-refactor *
T -sym-trunk *
U drh
Z 6c9fa3fa92317b5bccccc5c856a1593a
Z 1d662dddfc70aa251729f355b7103297

View File

@ -1 +1 @@
a08b0c7512287ce5ae3fffe02c092d0eb25b3a25
7c85e831153f9aef2afaf981d53db38a28091be5

View File

@ -1,14 +0,0 @@
########################################################
TOP=/home/drh/sqlite/sqlite
TCL_FLAGS=-I/home/drh/tcltk/86linux
LIBTCL=/home/drh/tcltk/86linux/libtcl8.6.a -lm -ldl -lpthread
BCC = gcc
TCC = gcc -ansi -g $(CFLAGS)
NAWK = awk
AR = ar cr
RANLIB = ranlib
THREADLIB = -lpthread -ldl -lz
include $(TOP)/main.mk
########################################################

View File

@ -1,6 +1,5 @@
set rcsid {$Id: $}
#!/usr/bin/tclsh
#
# Documentation for this script. This may be output to stderr
# if the script is invoked incorrectly. See the [process_options]
# proc below.
@ -10,51 +9,23 @@ This Tcl script is used to test the various configurations required
before releasing a new version. Supported command line options (all
optional) are:
-makefile PATH-TO-MAKEFILE (default "releasetest.mk")
-platform PLATFORM (see below)
-quick BOOLEAN (default "0")
-config CONFIGNAME (Run only CONFIGNAME)
--srcdir TOP-OF-SQLITE-TREE (see below)
--platform PLATFORM (see below)
--config CONFIGNAME (Run only CONFIGNAME)
--quick (Run "veryquick.test" only)
--buildonly (Just build testfixture - do not run)
--dryrun (Print what would have happened)
--info (Show diagnostic info)
The default value for -makefile is "./releasetest.mk".
The default value for --srcdir is the parent of the directory holding
this script.
The script determines the default value for -platform using the
The script determines the default value for --platform using the
$tcl_platform(os) and $tcl_platform(machine) variables. Supported
platforms are "Linux-x86", "Linux-x86_64" and "Darwin-i386".
If the -quick option is set to true, then the "veryquick.test" script
is run for all compilation configurations. Otherwise, sometimes "all.test"
is run, sometimes "veryquick.test".
Almost any SQLite makefile (except those generated by configure - see below)
should work. The following properties are required:
* The makefile should support the "fulltest" target.
* The makefile should support the variable "OPTS" as a way to pass
options from the make command line to lemon and the C compiler.
More precisely, the following invocation must be supported:
make -f $::MAKEFILE fulltest OPTS="-DSQLITE_SECURE_DELETE=1 -DSQLITE_DEBUG=1"
Makefiles generated by the sqlite configure program cannot be used as
they do not respect the OPTS variable.
Example Makefile contents:
########################################################
TOP=/home/dan/work/sqlite/sqlite
TCL_FLAGS=-I/home/dan/tcl/include
LIBTCL=-L/home/dan/tcl/lib -ltcl
BCC = gcc
TCC = gcc -ansi -g $(CFLAGS)
NAWK = awk
AR = ar cr
RANLIB = ranlib
THREADLIB = -lpthread -ldl
include $(TOP)/main.mk
########################################################
Every test begins with a fresh run of the configure script at the top
of the SQLite source tree.
}
array set ::Configs {
@ -228,13 +199,12 @@ foreach {key value} [array get ::Platforms] {
}
proc run_test_suite {name testtarget config} {
# Tcl variable $opts is used to build up the value used to set the
# OPTS Makefile variable. Variable $cflags holds the value for
# CFLAGS. The makefile will pass OPTS to both gcc and lemon, but
# CFLAGS is only passed to gcc.
#
set cflags ""
set cflags "-g"
set opts ""
foreach arg $config {
if {[string match -D* $arg]} {
@ -258,30 +228,46 @@ proc run_test_suite {name testtarget config} {
append opts " -DSQLITE_OS_UNIX=1"
}
# Run the test.
#
set makefile [file normalize $::MAKEFILE]
file mkdir $dir
puts -nonewline "Testing configuration \"$name\" (logfile=$dir/test.log)..."
flush stdout
dryrun file mkdir $dir
if {!$::DRYRUN} {
set n [string length $name]
puts -nonewline "${name}[string repeat . [expr {40-$n}]]"
flush stdout
}
set makecmd [concat \
[list exec make -C $dir -f $makefile clean] \
$testtarget \
[list CFLAGS=$cflags OPTS=$opts >& $dir/test.log] \
]
set tm1 [clock seconds]
set rc [catch $makecmd]
set tm1 [clock seconds]
set origdir [pwd]
dryrun cd $dir
set rc [catch [list dryrun exec $::SRCDIR/configure >& test.log]]
if {!$rc} {
set rc [catch [list dryrun exec make clean $testtarget \
CFLAGS=$cflags OPTS=$opts >>& test.log]]
}
set tm2 [clock seconds]
dryrun cd $origdir
set minutes [expr {($tm2-$tm1)/60}]
set seconds [expr {($tm2-$tm1)%60}]
puts -nonewline [format " (%d:%.2d) " $minutes $seconds]
if {$rc} {
puts "FAILED."
if {!$::DRYRUN} {
set minutes [expr {($tm2-$tm1)/60}]
set seconds [expr {($tm2-$tm1)%60}]
set tm [format (%02d:%02d) $minutes $seconds]
if {$rc} {
puts " FAIL $tm"
incr ::NERR
} else {
puts " Ok $tm"
}
}
}
# The following procedure either prints its arguments (if ::DRYRUN is true)
# or executes the command of its arguments in the calling context
# (if ::DRYRUN is false).
#
proc dryrun {args} {
if {$::DRYRUN} {
puts $args
} else {
puts "Ok."
uplevel 1 $args
}
}
@ -292,16 +278,21 @@ proc run_test_suite {name testtarget config} {
# option.
#
proc process_options {argv} {
set ::MAKEFILE releasetest.mk ;# Default value
set ::QUICK 0 ;# Default value
set ::SRCDIR [file normalize [file dirname [file dirname $::argv0]]]
set ::QUICK 0
set ::BUILDONLY 0
set ::DRYRUN 0
set ::EXEC exec
set config {}
set platform $::tcl_platform(os)-$::tcl_platform(machine)
for {set i 0} {$i < [llength $argv]} {incr i} {
switch -- [lindex $argv $i] {
-makefile {
set x [lindex $argv $i]
if {[regexp {^--[a-z]} $x]} {set x [string range $x 1 end]}
switch -- $x {
-srcdir {
incr i
set ::MAKEFILE [lindex $argv $i]
set ::SRCDIR [file normalize [lindex $argv $i]]
}
-platform {
@ -310,14 +301,40 @@ proc process_options {argv} {
}
-quick {
incr i
set ::QUICK [lindex $argv $i]
set ::QUICK 1
}
-config {
incr i
set config [lindex $argv $i]
}
-buildonly {
set ::BUILDONLY 1
}
-dryrun {
set ::DRYRUN 1
}
-info {
puts "Command-line Options:"
puts " --srcdir $::SRCDIR"
puts " --platform [list $platform]"
puts " --config [list $config]"
if {$::QUICK} {puts " --quick"}
if {$::BUILDONLY} {puts " --buildonly"}
if {$::DRYRUN} {puts " --dryrun"}
puts "\nAvailable --platform options:"
foreach y [lsort [array names ::Platforms]] {
puts " [list $y]"
}
puts "\nAvailable --config options:"
foreach y [lsort [array names ::Configs]] {
puts " [list $y]"
}
exit
}
default {
puts stderr ""
@ -327,8 +344,6 @@ proc process_options {argv} {
}
}
set ::MAKEFILE [file normalize $::MAKEFILE]
if {0==[info exists ::Platforms($platform)]} {
puts "Unknown platform: $platform"
puts -nonewline "Set the -platform option to "
@ -347,8 +362,13 @@ proc process_options {argv} {
} else {
set ::CONFIGLIST $::Platforms($platform)
}
puts "Running the following configurations for $platform:"
puts "Running the following test configurations for $platform:"
puts " [string trim $::CONFIGLIST]"
puts -nonewline "Flags:"
if {$::DRYRUN} {puts -nonewline " --dryrun"}
if {$::BUILDONLY} {puts -nonewline " --buildonly"}
if {$::QUICK} {puts -nonewline " --quick"}
puts ""
}
# Main routine.
@ -357,30 +377,41 @@ proc main {argv} {
# Process any command line options.
process_options $argv
puts [string repeat * 70]
set NERR 0
set NTEST 0
set STARTTIME [clock seconds]
foreach {zConfig target} $::CONFIGLIST {
if {$::QUICK} {set target test}
if {$::BUILDONLY} {set target testfixture}
set config_options $::Configs($zConfig)
incr NTEST
run_test_suite $zConfig $target $config_options
# If the configuration included the SQLITE_DEBUG option, then remove
# it and run veryquick.test. If it did not include the SQLITE_DEBUG option
# add it and run veryquick.test.
if {$target!="checksymbols"} {
if {$target!="checksymbols" && !$::BUILDONLY} {
set debug_idx [lsearch -glob $config_options -DSQLITE_DEBUG*]
if {$debug_idx < 0} {
incr NTEST
run_test_suite "${zConfig}_debug" test [
concat $config_options -DSQLITE_DEBUG=1
]
} else {
incr NTEST
run_test_suite "${zConfig}_ndebug" test [
lreplace $config_options $debug_idx $debug_idx
]
}
}
}
set elapsetime [expr {[clock seconds]-$STARTTIME}]
puts [string repeat * 70]
puts "$NERR failures of $NTEST test suites run in $elapsetime seconds"
}
main $argv