/ Check-in [4de4480f]
Login

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

Overview
Comment:Avoid a sanitizer error in test1.c. Have releasetest.tcl/wapptest.tcl create a file called "makecommand.sh" that can be used to rerun a test from the command line.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 4de4480ffdea1e923c4b964692ccde92d713c8b6c056bb04bddf1ff55ee891ec
User & Date: dan 2019-04-16 10:51:29
Context
2019-04-16
11:21
Avoid a sanitizer error (pointer arithmatic overflow) in vdbesort.c. check-in: af61a2fc user: dan tags: trunk
10:51
Avoid a sanitizer error in test1.c. Have releasetest.tcl/wapptest.tcl create a file called "makecommand.sh" that can be used to rerun a test from the command line. check-in: 4de4480f user: dan tags: trunk
2019-04-15
19:17
Fix a bug in test module test_fs.c causing a segfault on OpenBSD. check-in: ee886600 user: dan tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/test1.c.

  4268   4268     }else{
  4269   4269       int n = (int)strlen(zSql) + 1;
  4270   4270       zCopy = malloc(n);
  4271   4271       memcpy(zCopy, zSql, n);
  4272   4272     }
  4273   4273     pzTail = objc>=5 ? &zTail : 0;
  4274   4274     rc = sqlite3_prepare_v2(db, zCopy, bytes, &pStmt, pzTail);
         4275  +  if( objc>=5 ){
         4276  +    zTail = &zSql[(zTail - zCopy)];
         4277  +  }
  4275   4278     free(zCopy);
  4276         -  zTail = &zSql[(zTail - zCopy)];
  4277   4279   
  4278   4280     assert(rc==SQLITE_OK || pStmt==0);
  4279   4281     Tcl_ResetResult(interp);
  4280   4282     if( sqlite3TestErrCode(interp, db, rc) ) return TCL_ERROR;
  4281         -  if( rc==SQLITE_OK && zTail && objc>=5 ){
         4283  +  if( rc==SQLITE_OK && objc>=5 && zTail ){
  4282   4284       if( bytes>=0 ){
  4283   4285         bytes = bytes - (int)(zTail-zSql);
  4284   4286       }
  4285   4287       Tcl_ObjSetVar2(interp, objv[4], 0, Tcl_NewStringObj(zTail, bytes), 0);
  4286   4288     }
  4287   4289     if( rc!=SQLITE_OK ){
  4288   4290       assert( pStmt==0 );

Changes to test/releasetest.tcl.

   497    497     if {!$rc} {
   498    498       if {[info exists ::env(TCLSH_CMD)]} {
   499    499         set savedEnv(TCLSH_CMD) $::env(TCLSH_CMD)
   500    500       } else {
   501    501         unset -nocomplain savedEnv(TCLSH_CMD)
   502    502       }
   503    503       set ::env(TCLSH_CMD) [file nativename [info nameofexecutable]]
   504         -    set rc [catch [makeCommand $testtarget $makeOpts $cflags $opts]]
          504  +
          505  +    # Create a file called "makecommand.sh" containing the text of
          506  +    # the make command line.
          507  +    catch {
          508  +      set cmd [makeCommand $testtarget $makeOpts $cflags $opts]
          509  +      set fd [open makecommand.sh w]
          510  +      foreach e $cmd { 
          511  +        if {[string first " " $e]>=0} {
          512  +          puts -nonewline $fd "\"$e\""
          513  +        } else {
          514  +          puts -nonewline $fd $e
          515  +        }
          516  +        puts -nonewline $fd " "
          517  +      }
          518  +      puts $fd ""
          519  +      close $fd
          520  +    } msg
          521  +
          522  +    # Run the make command.
          523  +    set rc [catch {trace_cmd exec {*}$cmd >>& test.log} msg]
   505    524       if {[info exists savedEnv(TCLSH_CMD)]} {
   506    525         set ::env(TCLSH_CMD) $savedEnv(TCLSH_CMD)
   507    526       } else {
   508    527         unset -nocomplain ::env(TCLSH_CMD)
   509    528       }
   510    529     }
   511    530   
................................................................................
   733    752     lappend result >& test.log
   734    753   }
   735    754   
   736    755   # The following procedure returns the "make" command to be executed for the
   737    756   # specified targets, compiler flags, and options.
   738    757   #
   739    758   proc makeCommand { targets makeOpts cflags opts } {
   740         -  set result [list trace_cmd exec]
          759  +  set result [list]
   741    760     if {$::MSVC} {
   742    761       set nmakeDir [file nativename $::SRCDIR]
   743    762       set nmakeFile [file nativename [file join $nmakeDir Makefile.msc]]
   744    763       lappend result nmake /f $nmakeFile TOP=$nmakeDir
   745    764       set tclDir [file nativename [file normalize \
   746    765           [file dirname [file dirname [info nameofexecutable]]]]]
   747    766       lappend result "TCLDIR=$tclDir"
................................................................................
   754    773     foreach makeOpt $makeOpts {
   755    774       lappend result $makeOpt
   756    775     }
   757    776     lappend result clean
   758    777     foreach target $targets {
   759    778       lappend result $target
   760    779     }
   761         -  lappend result CFLAGS=$cflags OPTS=$opts >>& test.log
          780  +  lappend result CFLAGS=$cflags OPTS=$opts
   762    781   }
   763    782   
   764    783   # The following procedure prints its arguments if ::TRACE is true.
   765    784   # And it executes the command of its arguments in the calling context
   766    785   # if ::DRYRUN is false.
   767    786   #
   768    787   proc trace_cmd {args} {