/ Check-in [4ae96d6d]
Login

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

Overview
Comment:Attempt to centralize and simplify the MSVC handling.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | mp-releasetest
Files: files | file ages | folders
SHA1: 4ae96d6dde7fc0a913d7719ec498686f9a1e3b98
User & Date: mistachkin 2015-11-02 23:29:58
Context
2015-11-03
02:47
Use the native name for the MSVC makefile as well. check-in: e457c615 user: mistachkin tags: mp-releasetest
2015-11-02
23:29
Attempt to centralize and simplify the MSVC handling. check-in: 4ae96d6d user: mistachkin tags: mp-releasetest
23:21
Fix the backcompat.test module so that it does not try to compare against itself on windows. check-in: f625bce8 user: drh tags: mp-releasetest
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to test/releasetest.tcl.

   282    282   }]
   283    283   
   284    284   
   285    285   # End of configuration section.
   286    286   #########################################################################
   287    287   #########################################################################
   288    288   
   289         -# Configuration verification: Check that each entry in the list of configs 
          289  +# Configuration verification: Check that each entry in the list of configs
   290    290   # specified for each platforms exists.
   291    291   #
   292    292   foreach {key value} [array get ::Platforms] {
   293    293     foreach {v t} $value {
   294    294       if {0==[info exists ::Configs($v)]} {
   295    295         puts stderr "No such configuration: \"$v\""
   296    296         exit -1
................................................................................
   388    388         append errmsg " - core file exists"
   389    389       }
   390    390     }
   391    391   }
   392    392   
   393    393   #--------------------------------------------------------------------------
   394    394   # This command is invoked as the [main] routine for scripts run with the
   395         -# "--slave" option. 
          395  +# "--slave" option.
   396    396   #
   397    397   # For each test (i.e. "configure && make test" execution), the master
   398    398   # process spawns a process with the --slave option. It writes two lines
   399         -# to the slaves stdin. The first contains a single boolean value - the 
   400         -# value of ::TRACE to use in the slave script. The second line contains a 
          399  +# to the slaves stdin. The first contains a single boolean value - the
          400  +# value of ::TRACE to use in the slave script. The second line contains a
   401    401   # list in the same format as each element of the list passed to the
   402    402   # [run_all_test_suites] command in the master process.
   403    403   #
   404    404   # The slave then runs the "configure && make test" commands specified. It
   405    405   # exits successfully if the tests passes, or with a non-zero error code
   406    406   # otherwise.
   407    407   #
................................................................................
   408    408   proc run_slave_test {} {
   409    409     # Read global vars configuration from stdin.
   410    410     set V [gets stdin]
   411    411     foreach {::TRACE ::MSVC ::DRYRUN} $V {}
   412    412   
   413    413     # Read the test-suite configuration from stdin.
   414    414     set T [gets stdin]
   415         -  foreach {title dir configOpts testtarget cflags opts} $T {}
          415  +  foreach {title dir configOpts testtarget makeOpts cflags opts} $T {}
   416    416   
   417    417     # Create and switch to the test directory.
   418    418     trace_cmd file mkdir $dir
   419    419     trace_cmd cd $dir
   420    420     catch {file delete core}
   421    421     catch {file delete test.log}
   422    422   
................................................................................
   426    426     if {!$rc} {
   427    427       if {[info exists ::env(TCLSH_CMD)]} {
   428    428         set savedEnv(TCLSH_CMD) $::env(TCLSH_CMD)
   429    429       } else {
   430    430         unset -nocomplain savedEnv(TCLSH_CMD)
   431    431       }
   432    432       set ::env(TCLSH_CMD) [file nativename [info nameofexecutable]]
   433         -    set rc [catch [makeCommand $testtarget $cflags $opts]]
          433  +    set rc [catch [makeCommand $testtarget $makeOpts $cflags $opts]]
   434    434       if {[info exists savedEnv(TCLSH_CMD)]} {
   435    435         set ::env(TCLSH_CMD) $savedEnv(TCLSH_CMD)
   436    436       } else {
   437    437         unset -nocomplain ::env(TCLSH_CMD)
   438    438       }
   439    439     }
   440    440   
   441    441     # Exis successfully if the test passed, or with a non-zero error code
   442    442     # otherwise.
   443    443     exit $rc
   444    444   }
   445    445   
   446         -# This command is invoked in the master process each time a slave 
          446  +# This command is invoked in the master process each time a slave
   447    447   # file-descriptor is readable.
   448    448   #
   449    449   proc slave_fileevent {fd T tm1} {
   450    450     global G
   451         -  foreach {title dir configOpts testtarget cflags opts} $T {}
          451  +  foreach {title dir configOpts testtarget makeOpts cflags opts} $T {}
   452    452   
   453    453     if {[eof $fd]} {
   454    454       fconfigure $fd -blocking 1
   455    455       set rc [catch { close $fd }]
   456    456   
   457    457       set errmsg {}
   458    458       set logfile [file join $dir test.log]
................................................................................
   499    499   #
   500    500   #   * Test title (for display).
   501    501   #   * The name of the directory to run the test in.
   502    502   #   * The argument for [configureCommand]
   503    503   #   * The first argument for [makeCommand]
   504    504   #   * The second argument for [makeCommand]
   505    505   #   * The third argument for [makeCommand]
   506         -#   
          506  +#
   507    507   proc run_all_test_suites {alltests} {
   508    508     global G
   509    509     set tests $alltests
   510    510   
   511    511     set G(nJob) 0
   512    512   
   513    513     while {[llength $tests]>0 || $G(nJob)>0} {
................................................................................
   514    514       if {$G(nJob)>=$::JOBS || [llength $tests]==0} {
   515    515         vwait G(nJob)
   516    516       }
   517    517   
   518    518       if {[llength $tests]>0} {
   519    519         set T [lindex $tests 0]
   520    520         set tests [lrange $tests 1 end]
   521         -      foreach {title dir configOpts testtarget cflags opts} $T {}
          521  +      foreach {title dir configOpts testtarget makeOpts cflags opts} $T {}
   522    522         if {!$::TRACE} {
   523    523           set n [string length $title]
   524    524           PUTS "starting: ${title}"
   525    525           flush stdout
   526    526         }
   527    527   
   528    528         # Run the job.
................................................................................
   544    544     upvar $listvar alltests
   545    545   
   546    546     # Tcl variable $opts is used to build up the value used to set the
   547    547     # OPTS Makefile variable. Variable $cflags holds the value for
   548    548     # CFLAGS. The makefile will pass OPTS to both gcc and lemon, but
   549    549     # CFLAGS is only passed to gcc.
   550    550     #
          551  +  set makeOpts ""
   551    552     set cflags [expr {$::MSVC ? "-Zi" : "-g"}]
   552    553     set opts ""
   553    554     set title ${name}($testtarget)
   554    555     set configOpts $::WITHTCL
   555    556   
   556    557     regsub -all {#[^\n]*\n} $config \n config
   557    558     foreach arg $config {
   558    559       if {[regexp {^-[UD]} $arg]} {
   559    560         lappend opts $arg
   560    561       } elseif {[regexp {^[A-Z]+=} $arg]} {
   561    562         lappend testtarget $arg
   562    563       } elseif {[regexp {^--(enable|disable)-} $arg]} {
          564  +      if {$::MSVC} {
          565  +        if {$arg eq "--disable-amalgamation"} {
          566  +          lappend makeOpts USE_AMALGAMATION=0
          567  +          continue
          568  +        }
          569  +        if {$arg eq "--disable-shared"} {
          570  +          lappend makeOpts USE_CRT_DLL=0 DYNAMIC_SHELL=0
          571  +          continue
          572  +        }
          573  +        if {$arg eq "--enable-fts5"} {
          574  +          lappend opts -DSQLITE_ENABLE_FTS5
          575  +          continue
          576  +        }
          577  +        if {$arg eq "--enable-json1"} {
          578  +          lappend opts -DSQLITE_ENABLE_JSON1
          579  +          continue
          580  +        }
          581  +      }
   563    582         lappend configOpts $arg
   564    583       } else {
          584  +      if {$::MSVC} {
          585  +        if {$arg eq "-g"} {
          586  +          lappend cflags -Zi
          587  +          continue
          588  +        }
          589  +        if {[regexp -- {^-O(\d+)$} $arg all level]} then {
          590  +          lappend makeOpts OPTIMIZATIONS=$level
          591  +          continue
          592  +        }
          593  +      }
   565    594         lappend cflags $arg
   566    595       }
   567    596     }
   568    597   
   569         -  set cflags [join $cflags " "]
   570         -  set opts   [join $opts " "]
   571         -  append opts " -DSQLITE_NO_SYNC=1"
          598  +  # Disable sync to make testing faster.
          599  +  #
          600  +  lappend opts -DSQLITE_NO_SYNC=1
   572    601   
   573    602     # Some configurations already set HAVE_USLEEP; in that case, skip it.
   574    603     #
   575         -  if {![regexp { -DHAVE_USLEEP$} $opts]
   576         -         && ![regexp { -DHAVE_USLEEP[ =]+} $opts]} {
   577         -    append opts " -DHAVE_USLEEP=1"
          604  +  if {[lsearch -regexp $opts {^-DHAVE_USLEEP(?:=|$)}]==-1} {
          605  +    lappend opts -DHAVE_USLEEP=1
          606  +  }
          607  +
          608  +  # Add the define for this platform.
          609  +  #
          610  +  if {$::tcl_platform(platform)=="windows"} {
          611  +    lappend opts -DSQLITE_OS_WIN=1
          612  +  } else {
          613  +    lappend opts -DSQLITE_OS_UNIX=1
   578    614     }
   579    615   
   580    616     # Set the sub-directory to use.
   581    617     #
   582    618     set dir [string tolower [string map {- _ " " _} $name]]
   583    619   
   584         -  if {$::tcl_platform(platform)=="windows"} {
   585         -    append opts " -DSQLITE_OS_WIN=1"
   586         -  } else {
   587         -    append opts " -DSQLITE_OS_UNIX=1"
   588         -  }
          620  +  # Join option lists into strings, using space as delimiter.
          621  +  #
          622  +  set makeOpts [join $makeOpts " "]
          623  +  set cflags   [join $cflags " "]
          624  +  set opts     [join $opts " "]
   589    625   
   590         -  lappend alltests [list $title $dir $configOpts $testtarget $cflags $opts]
          626  +  lappend alltests [list \
          627  +      $title $dir $configOpts $testtarget $makeOpts $cflags $opts]
   591    628   }
   592    629   
   593    630   # The following procedure returns the "configure" command to be exectued for
   594    631   # the current platform, which may be Windows (via MinGW, etc).
   595    632   #
   596    633   proc configureCommand {opts} {
   597    634     if {$::MSVC} return [list]; # This is not needed for MSVC.
................................................................................
   603    640     foreach x $opts {lappend result $x}
   604    641     lappend result >& test.log
   605    642   }
   606    643   
   607    644   # The following procedure returns the "make" command to be executed for the
   608    645   # specified targets, compiler flags, and options.
   609    646   #
   610         -proc makeCommand { targets cflags opts } {
          647  +proc makeCommand { targets makeOpts cflags opts } {
   611    648     set result [list trace_cmd exec]
   612    649     if {$::MSVC} {
   613    650       set nmakeDir [file nativename $::SRCDIR]
   614    651       set nmakeFile [file join $nmakeDir Makefile.msc]
   615         -    lappend result nmake /f $nmakeFile TOP=$nmakeDir clean
          652  +    lappend result nmake /f $nmakeFile TOP=$nmakeDir
   616    653     } else {
   617         -    lappend result make clean
          654  +    lappend result make
          655  +  }
          656  +  foreach makeOpt $makeOpts {
          657  +    lappend result $makeOpt
   618    658     }
          659  +  lappend result clean
   619    660     foreach target $targets {
   620    661       lappend result $target
   621    662     }
   622    663     lappend result CFLAGS=$cflags OPTS=$opts >>& test.log
   623    664   }
   624    665   
   625    666   # The following procedure prints its arguments if ::TRACE is true.
................................................................................
   729    770           foreach y [lsort [array names ::Configs]] {
   730    771             PUTS "   [list $y]"
   731    772           }
   732    773           exit
   733    774         }
   734    775   
   735    776         -g {
   736         -        if {$::MSVC} {
   737         -          lappend ::EXTRACONFIG -Zi
   738         -        } else {
   739         -          lappend ::EXTRACONFIG [lindex $argv $i]
   740         -        }
          777  +        lappend ::EXTRACONFIG [lindex $argv $i]
   741    778         }
   742    779   
   743    780         -with-tcl=* {
   744    781           set ::WITHTCL -$x
   745    782         }
   746    783   
   747    784         -D* -