/ Check-in [4de4480ffd]
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: af61a2fc45 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: 4de4480ffd 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: ee88660029 user: dan tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/test1.c.

4268
4269
4270
4271
4272
4273
4274
4275
4276


4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
  }else{
    int n = (int)strlen(zSql) + 1;
    zCopy = malloc(n);
    memcpy(zCopy, zSql, n);
  }
  pzTail = objc>=5 ? &zTail : 0;
  rc = sqlite3_prepare_v2(db, zCopy, bytes, &pStmt, pzTail);
  free(zCopy);
  zTail = &zSql[(zTail - zCopy)];



  assert(rc==SQLITE_OK || pStmt==0);
  Tcl_ResetResult(interp);
  if( sqlite3TestErrCode(interp, db, rc) ) return TCL_ERROR;
  if( rc==SQLITE_OK && zTail && objc>=5 ){
    if( bytes>=0 ){
      bytes = bytes - (int)(zTail-zSql);
    }
    Tcl_ObjSetVar2(interp, objv[4], 0, Tcl_NewStringObj(zTail, bytes), 0);
  }
  if( rc!=SQLITE_OK ){
    assert( pStmt==0 );







|
|
>
>




|







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

  assert(rc==SQLITE_OK || pStmt==0);
  Tcl_ResetResult(interp);
  if( sqlite3TestErrCode(interp, db, rc) ) return TCL_ERROR;
  if( rc==SQLITE_OK && objc>=5 && zTail ){
    if( bytes>=0 ){
      bytes = bytes - (int)(zTail-zSql);
    }
    Tcl_ObjSetVar2(interp, objv[4], 0, Tcl_NewStringObj(zTail, bytes), 0);
  }
  if( rc!=SQLITE_OK ){
    assert( pStmt==0 );

Changes to test/releasetest.tcl.

497
498
499
500
501
502
503




504















505
506
507
508
509
510
511
...
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
...
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
  if {!$rc} {
    if {[info exists ::env(TCLSH_CMD)]} {
      set savedEnv(TCLSH_CMD) $::env(TCLSH_CMD)
    } else {
      unset -nocomplain savedEnv(TCLSH_CMD)
    }
    set ::env(TCLSH_CMD) [file nativename [info nameofexecutable]]




    set rc [catch [makeCommand $testtarget $makeOpts $cflags $opts]]















    if {[info exists savedEnv(TCLSH_CMD)]} {
      set ::env(TCLSH_CMD) $savedEnv(TCLSH_CMD)
    } else {
      unset -nocomplain ::env(TCLSH_CMD)
    }
  }

................................................................................
  lappend result >& test.log
}

# The following procedure returns the "make" command to be executed for the
# specified targets, compiler flags, and options.
#
proc makeCommand { targets makeOpts cflags opts } {
  set result [list trace_cmd exec]
  if {$::MSVC} {
    set nmakeDir [file nativename $::SRCDIR]
    set nmakeFile [file nativename [file join $nmakeDir Makefile.msc]]
    lappend result nmake /f $nmakeFile TOP=$nmakeDir
    set tclDir [file nativename [file normalize \
        [file dirname [file dirname [info nameofexecutable]]]]]
    lappend result "TCLDIR=$tclDir"
................................................................................
  foreach makeOpt $makeOpts {
    lappend result $makeOpt
  }
  lappend result clean
  foreach target $targets {
    lappend result $target
  }
  lappend result CFLAGS=$cflags OPTS=$opts >>& test.log
}

# The following procedure prints its arguments if ::TRACE is true.
# And it executes the command of its arguments in the calling context
# if ::DRYRUN is false.
#
proc trace_cmd {args} {







>
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







|







 







|







497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
...
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
...
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
  if {!$rc} {
    if {[info exists ::env(TCLSH_CMD)]} {
      set savedEnv(TCLSH_CMD) $::env(TCLSH_CMD)
    } else {
      unset -nocomplain savedEnv(TCLSH_CMD)
    }
    set ::env(TCLSH_CMD) [file nativename [info nameofexecutable]]

    # Create a file called "makecommand.sh" containing the text of
    # the make command line.
    catch {
      set cmd [makeCommand $testtarget $makeOpts $cflags $opts]
      set fd [open makecommand.sh w]
      foreach e $cmd { 
        if {[string first " " $e]>=0} {
          puts -nonewline $fd "\"$e\""
        } else {
          puts -nonewline $fd $e
        }
        puts -nonewline $fd " "
      }
      puts $fd ""
      close $fd
    } msg

    # Run the make command.
    set rc [catch {trace_cmd exec {*}$cmd >>& test.log} msg]
    if {[info exists savedEnv(TCLSH_CMD)]} {
      set ::env(TCLSH_CMD) $savedEnv(TCLSH_CMD)
    } else {
      unset -nocomplain ::env(TCLSH_CMD)
    }
  }

................................................................................
  lappend result >& test.log
}

# The following procedure returns the "make" command to be executed for the
# specified targets, compiler flags, and options.
#
proc makeCommand { targets makeOpts cflags opts } {
  set result [list]
  if {$::MSVC} {
    set nmakeDir [file nativename $::SRCDIR]
    set nmakeFile [file nativename [file join $nmakeDir Makefile.msc]]
    lappend result nmake /f $nmakeFile TOP=$nmakeDir
    set tclDir [file nativename [file normalize \
        [file dirname [file dirname [info nameofexecutable]]]]]
    lappend result "TCLDIR=$tclDir"
................................................................................
  foreach makeOpt $makeOpts {
    lappend result $makeOpt
  }
  lappend result clean
  foreach target $targets {
    lappend result $target
  }
  lappend result CFLAGS=$cflags OPTS=$opts
}

# The following procedure prints its arguments if ::TRACE is true.
# And it executes the command of its arguments in the calling context
# if ::DRYRUN is false.
#
proc trace_cmd {args} {