/ Check-in [1deb00ec]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Merge the new and improved releasetest.tcl script into trunk. Add a "make releasetest" target to the autoconf makefile.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 1deb00ec758c6d213da71ef64294cc816e204338
User & Date: drh 2014-12-23 21:17:58
Context
2014-12-24
17:17
When building the amalgamation with SQLITE_ENABLE_IOTRACE defined, do not mark symbol sqlite3IoTrace as static. check-in: 5b7ca013 user: dan tags: trunk
2014-12-23
21:17
Merge the new and improved releasetest.tcl script into trunk. Add a "make releasetest" target to the autoconf makefile. check-in: 1deb00ec user: drh tags: trunk
21:10
Remove 'threadtest' as a target on Windows, due to lack of pthreads. Also, change 'fulltest' to 'fulltestonly'. Closed-Leaf check-in: a010c404 user: mistachkin tags: releasetest-refactor
20:42
Permit sqlite3_shutdown() to be called with OMIT_WSD enabled and without having called sqlite3_initialize() first. check-in: 3f7dbdb5 user: mistachkin tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to Makefile.in.

   964    964   	$(LTLINK) -I. -o $@ $(TOP)/tool/logest.c
   965    965   
   966    966   wordcount$(TEXE):	$(TOP)/test/wordcount.c sqlite3.c
   967    967   	$(LTLINK) -o $@ $(TOP)/test/wordcount.c sqlite3.c $(TLIBS)
   968    968   
   969    969   speedtest1$(TEXE):	$(TOP)/test/wordcount.c sqlite3.lo
   970    970   	$(LTLINK) -o $@ $(TOP)/test/speedtest1.c sqlite3.lo $(TLIBS)
          971  +
          972  +# This target will fail if the SQLite amalgamation contains any exported
          973  +# symbols that do not begin with "sqlite3_". It is run as part of the
          974  +# releasetest.tcl script.
          975  +#
          976  +checksymbols: sqlite3.lo
          977  +	nm -g --defined-only sqlite3.lo | grep -v " sqlite3_" ; test $$? -ne 0
          978  +
          979  +# The next two rules are used to support the "threadtest" target. Building
          980  +# threadtest runs a few thread-safety tests that are implemented in C. This
          981  +# target is invoked by the releasetest.tcl script.
          982  +# 
          983  +THREADTEST3_SRC = $(TOP)/test/threadtest3.c    \
          984  +                  $(TOP)/test/tt3_checkpoint.c \
          985  +                  $(TOP)/test/tt3_index.c      \
          986  +                  $(TOP)/test/tt3_vacuum.c      \
          987  +                  $(TOP)/test/tt3_stress.c      \
          988  +                  $(TOP)/test/tt3_lookaside1.c
          989  +
          990  +threadtest3$(TEXE): sqlite3.lo $(THREADTEST3_SRC)
          991  +	$(LTLINK) $(TOP)/test/threadtest3.c sqlite3.lo -o $@ $(TLIBS)
          992  +
          993  +threadtest: threadtest3$(TEXE)
          994  +	./threadtest3$(TEXE)
          995  +
          996  +releasetest:	
          997  +	$(TCLSH_CMD) $(TOP)/test/releasetest.tcl
   971    998   
   972    999   # Standard install and cleanup targets
   973   1000   #
   974   1001   lib_install:	libsqlite3.la
   975   1002   	$(INSTALL) -d $(DESTDIR)$(libdir)
   976   1003   	$(LTINSTALL) libsqlite3.la $(DESTDIR)$(libdir)
   977   1004   	

Deleted test/releasetest.mk.

     1         -########################################################
     2         -TOP=/home/drh/sqlite/sqlite
     3         -
     4         -TCL_FLAGS=-I/home/drh/tcltk/86linux
     5         -LIBTCL=/home/drh/tcltk/86linux/libtcl8.6.a -lm -ldl -lpthread
     6         -
     7         -BCC = gcc
     8         -TCC = gcc -ansi -g $(CFLAGS)
     9         -NAWK   = awk
    10         -AR     = ar cr
    11         -RANLIB = ranlib
    12         -THREADLIB = -lpthread -ldl -lz
    13         -include $(TOP)/main.mk
    14         -########################################################

Changes to test/releasetest.tcl.

     1         -
     2         -set rcsid {$Id: $}
     3         -
            1  +#!/usr/bin/tclsh
            2  +#
     4      3   # Documentation for this script. This may be output to stderr
     5      4   # if the script is invoked incorrectly. See the [process_options]
     6      5   # proc below.
     7      6   #
     8      7   set ::USAGE_MESSAGE {
     9      8   This Tcl script is used to test the various configurations required
    10         -before releasing a new version. Supported command line options (all 
            9  +before releasing a new version. Supported command line options (all
    11     10   optional) are:
    12     11   
    13         -    -makefile PATH-TO-MAKEFILE           (default "releasetest.mk")
    14         -    -platform PLATFORM                   (see below)
    15         -    -quick    BOOLEAN                    (default "0")
    16         -    -config   CONFIGNAME                 (Run only CONFIGNAME)
           12  +    --srcdir   TOP-OF-SQLITE-TREE      (see below)
           13  +    --platform PLATFORM                (see below)
           14  +    --config   CONFIGNAME              (Run only CONFIGNAME)
           15  +    --quick                            (Run "veryquick.test" only)
           16  +    --buildonly                        (Just build testfixture - do not run)
           17  +    --dryrun                           (Print what would have happened)
           18  +    --info                             (Show diagnostic info)
    17     19   
    18         -The default value for -makefile is "./releasetest.mk".
           20  +The default value for --srcdir is the parent of the directory holding
           21  +this script.
    19     22   
    20         -The script determines the default value for -platform using the
    21         -$tcl_platform(os) and $tcl_platform(machine) variables. Supported 
           23  +The script determines the default value for --platform using the
           24  +$tcl_platform(os) and $tcl_platform(machine) variables. Supported
    22     25   platforms are "Linux-x86", "Linux-x86_64" and "Darwin-i386".
    23     26   
    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".
    27         -
    28         -Almost any SQLite makefile (except those generated by configure - see below)
    29         -should work. The following properties are required:
    30         -
    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.
    34         -
    35         -More precisely, the following invocation must be supported:
    36         -
    37         -  make -f $::MAKEFILE fulltest OPTS="-DSQLITE_SECURE_DELETE=1 -DSQLITE_DEBUG=1"
    38         -
    39         -Makefiles generated by the sqlite configure program cannot be used as
    40         -they do not respect the OPTS variable.
    41         -
    42         -Example Makefile contents:
    43         -
    44         -  ########################################################
    45         -  TOP=/home/dan/work/sqlite/sqlite
    46         -
    47         -  TCL_FLAGS=-I/home/dan/tcl/include
    48         -  LIBTCL=-L/home/dan/tcl/lib -ltcl
    49         -
    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         -  ########################################################
           27  +Every test begins with a fresh run of the configure script at the top
           28  +of the SQLite source tree.
    58     29   }
    59     30   
    60     31   array set ::Configs {
    61     32     "Default" {
    62     33       -O2
    63     34     }
    64     35     "Ftrapv" {
................................................................................
   157    128       -DUSE_PREAD=1
   158    129       -DSQLITE_ENABLE_RTREE=1
   159    130       -DSQLITE_ENABLE_FTS3=1
   160    131       -DSQLITE_ENABLE_FTS3_PARENTHESIS=1
   161    132       -DSQLITE_DEFAULT_CACHE_SIZE=1000
   162    133       -DSQLITE_MAX_LENGTH=2147483645
   163    134       -DSQLITE_MAX_VARIABLE_NUMBER=500000
   164         -    -DSQLITE_DEBUG=1 
          135  +    -DSQLITE_DEBUG=1
   165    136       -DSQLITE_PREFER_PROXY_LOCKING=1
   166    137     }
   167    138     "Extra-Robustness" {
   168    139       -DSQLITE_ENABLE_OVERSIZE_CELL_CHECK=1
   169    140       -DSQLITE_MAX_ATTACHED=62
   170    141     }
   171    142     "Devkit" {
................................................................................
   207    178       "Device-Two"              test
   208    179       "Default"                 "threadtest fulltest"
   209    180     }
   210    181     Darwin-i386 {
   211    182       "Locking-Style"           test
   212    183       "OS-X"                    "threadtest fulltest"
   213    184     }
          185  +  "Windows NT-intel" {
          186  +    "Default"                 "fulltestonly"
          187  +  }
   214    188   }
   215    189   
   216    190   
   217    191   # End of configuration section.
   218    192   #########################################################################
   219    193   #########################################################################
   220    194   
................................................................................
   224    198         puts stderr "No such configuration: \"$v\""
   225    199         exit -1
   226    200       }
   227    201     }
   228    202   }
   229    203   
   230    204   proc run_test_suite {name testtarget config} {
   231         -  
   232         -  # Tcl variable $opts is used to build up the value used to set the 
          205  +  # Tcl variable $opts is used to build up the value used to set the
   233    206     # OPTS Makefile variable. Variable $cflags holds the value for
   234    207     # CFLAGS. The makefile will pass OPTS to both gcc and lemon, but
   235    208     # CFLAGS is only passed to gcc.
   236    209     #
   237         -  set cflags ""
          210  +  set cflags "-g"
   238    211     set opts ""
   239    212     foreach arg $config {
   240    213       if {[string match -D* $arg]} {
   241    214         lappend opts $arg
   242    215       } else {
   243    216         lappend cflags $arg
   244    217       }
................................................................................
   254    227   
   255    228     if {$::tcl_platform(platform)=="windows"} {
   256    229       append opts " -DSQLITE_OS_WIN=1"
   257    230     } else {
   258    231       append opts " -DSQLITE_OS_UNIX=1"
   259    232     }
   260    233   
   261         -  # Run the test.
   262         -  #
   263         -  set makefile [file normalize $::MAKEFILE]
   264         -  file mkdir $dir
   265         -  puts -nonewline "Testing configuration \"$name\" (logfile=$dir/test.log)..."
   266         -  flush stdout
          234  +  dryrun file mkdir $dir
          235  +  if {!$::DRYRUN} {
          236  +    set title ${name}($testtarget)
          237  +    set n [string length $title]
          238  +    puts -nonewline "${title}[string repeat . [expr {54-$n}]]"
          239  +    flush stdout
          240  +  }
   267    241   
   268         -  set makecmd [concat                                  \
   269         -    [list exec make -C $dir -f $makefile clean]        \
   270         -    $testtarget                                        \
   271         -    [list CFLAGS=$cflags OPTS=$opts >& $dir/test.log]  \
   272         -  ]
   273         -
   274         -  set tm1 [clock seconds] 
   275         -  set rc [catch $makecmd]
          242  +  set tm1 [clock seconds]
          243  +  set origdir [pwd]
          244  +  dryrun cd $dir
          245  +  set rc [catch [configureCommand]]
          246  +  if {!$rc} {
          247  +    set rc [catch [makeCommand $testtarget $cflags $opts]]
          248  +  }
   276    249     set tm2 [clock seconds]
          250  +  dryrun cd $origdir
   277    251   
   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."
          252  +  if {!$::DRYRUN} {
          253  +    set hours [expr {($tm2-$tm2)/3600}]
          254  +    set minutes [expr {(($tm2-$tm1)/60)%60}]
          255  +    set seconds [expr {($tm2-$tm1)%60}]
          256  +    set tm [format (%02d:%02d:%02d) $hours $minutes $seconds]
          257  +    if {$rc} {
          258  +      puts " FAIL $tm"
          259  +      incr ::NERR
          260  +    } else {
          261  +      puts " Ok   $tm"
          262  +    }
          263  +  }
          264  +}
          265  +
          266  +# The following procedure returns the "configure" command to be exectued for
          267  +# the current platform, which may be Windows (via MinGW, etc).
          268  +#
          269  +proc configureCommand {} {
          270  +  set result [list dryrun exec]
          271  +  if {$::tcl_platform(platform)=="windows"} {
          272  +    lappend result sh
          273  +  }
          274  +  lappend result $::SRCDIR/configure -enable-load-extension >& test.log
          275  +}
          276  +
          277  +# The following procedure returns the "make" command to be executed for the
          278  +# specified targets, compiler flags, and options.
          279  +#
          280  +proc makeCommand { targets cflags opts } {
          281  +  set result [list dryrun exec make clean]
          282  +  foreach target $targets {
          283  +    lappend result $target
          284  +  }
          285  +  lappend result CFLAGS=$cflags OPTS=$opts >>& test.log
          286  +}
          287  +
          288  +# The following procedure either prints its arguments (if ::DRYRUN is true)
          289  +# or executes the command of its arguments in the calling context
          290  +# (if ::DRYRUN is false).
          291  +#
          292  +proc dryrun {args} {
          293  +  if {$::DRYRUN} {
          294  +    puts $args
   283    295     } else {
   284         -    puts "Ok."
          296  +    uplevel 1 $args
   285    297     }
   286    298   }
   287    299   
   288    300   
   289    301   # This proc processes the command line options passed to this script.
   290    302   # Currently the only option supported is "-makefile", default
   291    303   # "releasetest.mk". Set the ::MAKEFILE variable to the value of this
   292    304   # option.
   293    305   #
   294    306   proc process_options {argv} {
   295         -  set ::MAKEFILE releasetest.mk                       ;# Default value
   296         -  set ::QUICK    0                                    ;# Default value
          307  +  set ::SRCDIR    [file normalize [file dirname [file dirname $::argv0]]]
          308  +  set ::QUICK     0
          309  +  set ::BUILDONLY 0
          310  +  set ::DRYRUN    0
          311  +  set ::EXEC      exec
   297    312     set config {}
   298    313     set platform $::tcl_platform(os)-$::tcl_platform(machine)
   299    314   
   300    315     for {set i 0} {$i < [llength $argv]} {incr i} {
   301         -    switch -- [lindex $argv $i] {
   302         -      -makefile {
          316  +    set x [lindex $argv $i]
          317  +    if {[regexp {^--[a-z]} $x]} {set x [string range $x 1 end]}
          318  +    switch -- $x {
          319  +      -srcdir {
   303    320           incr i
   304         -        set ::MAKEFILE [lindex $argv $i]
          321  +        set ::SRCDIR [file normalize [lindex $argv $i]]
   305    322         }
   306    323   
   307    324         -platform {
   308    325           incr i
   309    326           set platform [lindex $argv $i]
   310    327         }
   311    328   
   312    329         -quick {
   313         -        incr i
   314         -        set ::QUICK [lindex $argv $i]
          330  +        set ::QUICK 1
   315    331         }
   316    332   
   317    333         -config {
   318    334           incr i
   319    335           set config [lindex $argv $i]
   320    336         }
   321         -  
          337  +
          338  +      -buildonly {
          339  +        set ::BUILDONLY 1
          340  +      }
          341  +
          342  +      -dryrun {
          343  +        set ::DRYRUN 1
          344  +      }
          345  +
          346  +      -info {
          347  +        puts "Command-line Options:"
          348  +        puts "   --srcdir $::SRCDIR"
          349  +        puts "   --platform [list $platform]"
          350  +        puts "   --config [list $config]"
          351  +        if {$::QUICK}     {puts "   --quick"}
          352  +        if {$::BUILDONLY} {puts "   --buildonly"}
          353  +        if {$::DRYRUN}    {puts "   --dryrun"}
          354  +        puts "\nAvailable --platform options:"
          355  +        foreach y [lsort [array names ::Platforms]] {
          356  +          puts "   [list $y]"
          357  +        }
          358  +        puts "\nAvailable --config options:"
          359  +        foreach y [lsort [array names ::Configs]] {
          360  +          puts "   [list $y]"
          361  +        }
          362  +        exit
          363  +      }
          364  +
   322    365         default {
   323    366           puts stderr ""
   324    367           puts stderr [string trim $::USAGE_MESSAGE]
   325    368           exit -1
   326    369         }
   327    370       }
   328    371     }
   329    372   
   330         -  set ::MAKEFILE [file normalize $::MAKEFILE]
   331         -
   332    373     if {0==[info exists ::Platforms($platform)]} {
   333    374       puts "Unknown platform: $platform"
   334    375       puts -nonewline "Set the -platform option to "
   335    376       set print [list]
   336    377       foreach p [array names ::Platforms] {
   337    378         lappend print "\"$p\""
   338    379       }
................................................................................
   343    384   
   344    385     if {$config!=""} {
   345    386       if {[llength $config]==1} {lappend config fulltest}
   346    387       set ::CONFIGLIST $config
   347    388     } else {
   348    389       set ::CONFIGLIST $::Platforms($platform)
   349    390     }
   350         -  puts "Running the following configurations for $platform:"
          391  +  puts "Running the following test configurations for $platform:"
   351    392     puts "    [string trim $::CONFIGLIST]"
          393  +  puts -nonewline "Flags:"
          394  +  if {$::DRYRUN} {puts -nonewline " --dryrun"}
          395  +  if {$::BUILDONLY} {puts -nonewline " --buildonly"}
          396  +  if {$::QUICK} {puts -nonewline " --quick"}
          397  +  puts ""
   352    398   }
   353    399   
   354    400   # Main routine.
   355    401   #
   356    402   proc main {argv} {
   357    403   
   358    404     # Process any command line options.
   359    405     process_options $argv
          406  +  puts [string repeat * 70]
   360    407   
          408  +  set NERR 0
          409  +  set NTEST 0
          410  +  set STARTTIME [clock seconds]
   361    411     foreach {zConfig target} $::CONFIGLIST {
   362    412       if {$::QUICK} {set target test}
          413  +    if {$::BUILDONLY} {set target testfixture}
   363    414       set config_options $::Configs($zConfig)
   364    415   
          416  +    incr NTEST
   365    417       run_test_suite $zConfig $target $config_options
   366    418   
   367    419       # If the configuration included the SQLITE_DEBUG option, then remove
   368    420       # it and run veryquick.test. If it did not include the SQLITE_DEBUG option
   369    421       # add it and run veryquick.test.
   370         -    if {$target!="checksymbols"} {
          422  +    if {$target!="checksymbols" && !$::BUILDONLY} {
   371    423         set debug_idx [lsearch -glob $config_options -DSQLITE_DEBUG*]
   372    424         if {$debug_idx < 0} {
          425  +        incr NTEST
   373    426           run_test_suite "${zConfig}_debug" test [
   374    427             concat $config_options -DSQLITE_DEBUG=1
   375    428           ]
   376    429         } else {
          430  +        incr NTEST
   377    431           run_test_suite "${zConfig}_ndebug" test [
   378    432             lreplace $config_options $debug_idx $debug_idx
   379    433           ]
   380    434         }
   381    435       }
   382         -
   383    436     }
          437  +
          438  +  set elapsetime [expr {[clock seconds]-$STARTTIME}]
          439  +  puts [string repeat * 70]
          440  +  puts "$NERR failures of $NTEST test suites run in $elapsetime seconds"
   384    441   }
   385    442   
   386    443   main $argv