/ Check-in [f7b2c703]
Login

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

Overview
Comment:Add the --output=$file and --verbose=(0|1|file) options to tester.tcl.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: f7b2c70362f10ee0347c1d2318918ffefa53243d
User & Date: dan 2015-06-09 15:58:28
Context
2015-06-10
14:27
Avoid passing constraints that are unusable due to LEFT or CROSS joins to virtual table xBestIndex() methods. check-in: 7b446771 user: dan tags: trunk
2015-06-09
15:58
Add the --output=$file and --verbose=(0|1|file) options to tester.tcl. check-in: f7b2c703 user: dan tags: trunk
2015-06-08
19:15
Add the valgrindfuzz target to unix makefile. check-in: e62aed01 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to test/tester.tcl.

    77     77   #
    78     78   #      wal_is_wal_mode
    79     79   #      wal_set_journal_mode   ?DB?
    80     80   #      wal_check_journal_mode TESTNAME?DB?
    81     81   #      permutation
    82     82   #      presql
    83     83   #
           84  +# Command to test whether or not --verbose=1 was specified on the command
           85  +# line (returns 0 for not-verbose, 1 for verbose and 2 for "verbose in the
           86  +# output file only").
           87  +#
           88  +#      verbose
           89  +#
    84     90   
    85     91   # Set the precision of FP arithmatic used by the interpreter. And
    86     92   # configure SQLite to take database file locks on the page that begins
    87     93   # 64KB into the database file instead of the one 1GB in. This means
    88     94   # the code that handles that special case can be tested without creating
    89     95   # very large database files.
    90     96   #
................................................................................
   384    390     #   --backtrace=N
   385    391     #   --binarylog=N
   386    392     #   --soak=N
   387    393     #   --file-retries=N
   388    394     #   --file-retry-delay=N
   389    395     #   --start=[$permutation:]$testfile
   390    396     #   --match=$pattern
          397  +  #   --verbose=$val
          398  +  #   --output=$filename
          399  +  #   --help
   391    400     #
   392    401     set cmdlinearg(soft-heap-limit)    0
   393    402     set cmdlinearg(maxerror)        1000
   394    403     set cmdlinearg(malloctrace)        0
   395    404     set cmdlinearg(backtrace)         10
   396    405     set cmdlinearg(binarylog)          0
   397    406     set cmdlinearg(soak)               0
   398    407     set cmdlinearg(file-retries)       0
   399    408     set cmdlinearg(file-retry-delay)   0
   400    409     set cmdlinearg(start)             ""
   401    410     set cmdlinearg(match)             ""
          411  +  set cmdlinearg(verbose)           ""
          412  +  set cmdlinearg(output)            ""
   402    413   
   403    414     set leftover [list]
   404    415     foreach a $argv {
   405    416       switch -regexp -- $a {
   406    417         {^-+pause$} {
   407    418           # Wait for user input before continuing. This is to give the user an
   408    419           # opportunity to connect profiling tools to the process.
................................................................................
   453    464         }
   454    465         {^-+match=.+$} {
   455    466           foreach {dummy cmdlinearg(match)} [split $a =] break
   456    467   
   457    468           set ::G(match) $cmdlinearg(match)
   458    469           if {$::G(match) == ""} {unset ::G(match)}
   459    470         }
          471  +
          472  +      {^-+output=.+$} {
          473  +        foreach {dummy cmdlinearg(output)} [split $a =] break
          474  +        if {$cmdlinearg(verbose)==""} {
          475  +          set cmdlinearg(verbose) 2
          476  +        }
          477  +      }
          478  +      {^-+verbose=.+$} {
          479  +        foreach {dummy cmdlinearg(verbose)} [split $a =] break
          480  +        if {$cmdlinearg(verbose)=="file"} {
          481  +          set cmdlinearg(verbose) 2
          482  +        } elseif {[string is boolean -strict $cmdlinearg(verbose)]==0} {
          483  +          error "option --verbose= must be set to a boolean or to \"file\""
          484  +        }
          485  +      }
          486  +
   460    487         default {
   461    488           lappend leftover $a
   462    489         }
   463    490       }
   464    491     }
   465    492     set argv $leftover
   466    493   
................................................................................
   480    507     }
   481    508   
   482    509     # Set the backtrace depth, if malloc tracing is enabled.
   483    510     #
   484    511     if {$cmdlinearg(malloctrace)} {
   485    512       sqlite3_memdebug_backtrace $cmdlinearg(backtrace)
   486    513     }
          514  +
          515  +  if {$cmdlinearg(output)!=""} {
          516  +    puts "Copying output to file $cmdlinearg(output)"
          517  +    set ::G(output_fd) [open $cmdlinearg(output) w]
          518  +    fconfigure $::G(output_fd) -buffering line
          519  +  }
          520  +
          521  +  if {$cmdlinearg(verbose)==""} {
          522  +    set cmdlinearg(verbose) 1
          523  +  }
   487    524   }
   488    525   
   489    526   # Update the soft-heap-limit each time this script is run. In that
   490    527   # way if an individual test file changes the soft-heap-limit, it
   491    528   # will be reset at the start of the next test file.
   492    529   #
   493    530   sqlite3_soft_heap_limit $cmdlinearg(soft-heap-limit)
................................................................................
   550    587     set f [set_test_counter fail_list]
   551    588     lappend f $name
   552    589     set_test_counter fail_list $f
   553    590     set_test_counter errors [expr [set_test_counter errors] + 1]
   554    591   
   555    592     set nFail [set_test_counter errors]
   556    593     if {$nFail>=$::cmdlinearg(maxerror)} {
   557         -    puts "*** Giving up..."
          594  +    output2 "*** Giving up..."
   558    595       finalize_testing
   559    596     }
   560    597   }
   561    598   
   562    599   # Remember a warning message to be displayed at the conclusion of all testing
   563    600   #
   564    601   proc warning {msg {append 1}} {
   565         -  puts "Warning: $msg"
          602  +  output2 "Warning: $msg"
   566    603     set warnList [set_test_counter warn_list]
   567    604     if {$append} {
   568    605       lappend warnList $msg
   569    606     }
   570    607     set_test_counter warn_list $warnList
   571    608   }
   572    609   
   573    610   
   574    611   # Increment the number of tests run
   575    612   #
   576    613   proc incr_ntest {} {
   577    614     set_test_counter count [expr [set_test_counter count] + 1]
   578    615   }
          616  +
          617  +# Return true if --verbose=1 was specified on the command line. Otherwise,
          618  +# return false.
          619  +#
          620  +proc verbose {} {
          621  +  return $::cmdlinearg(verbose)
          622  +}
          623  +
          624  +# Use the following commands instead of [puts] for test output within
          625  +# this file. Test scripts can still use regular [puts], which is directed
          626  +# to stdout and, if one is open, the --output file.
          627  +#
          628  +# output1: output that should be printed if --verbose=1 was specified.
          629  +# output2: output that should be printed unconditionally.
          630  +# output2_if_no_verbose: output that should be printed only if --verbose=0.
          631  +#
          632  +proc output1 {args} {
          633  +  set v [verbose]
          634  +  if {$v==1} {
          635  +    uplevel output2 $args
          636  +  } elseif {$v==2} {
          637  +    uplevel puts [lrange $args 0 end-1] $::G(output_fd) [lrange $args end end]
          638  +  }
          639  +}
          640  +proc output2 {args} {
          641  +  set nArg [llength $args]
          642  +  uplevel puts $args
          643  +}
          644  +proc output2_if_no_verbose {args} {
          645  +  set v [verbose]
          646  +  if {$v==0} {
          647  +    uplevel output2 $args
          648  +  } elseif {$v==2} {
          649  +    uplevel puts [lrange $args 0 end-1] stdout [lrange $args end end]
          650  +  }
          651  +}
          652  +
          653  +# Override the [puts] command so that if no channel is explicitly 
          654  +# specified the string is written to both stdout and to the file 
          655  +# specified by "--output=", if any.
          656  +#
          657  +proc puts_override {args} {
          658  +  set nArg [llength $args]
          659  +  if {$nArg==1 || ($nArg==2 && [string first [lindex $args 0] -nonewline]==0)} {
          660  +    uplevel puts_original $args
          661  +    if {[info exists ::G(output_fd)]} {
          662  +      uplevel puts [lrange $args 0 end-1] $::G(output_fd) [lrange $args end end]
          663  +    }
          664  +  } else {
          665  +    # A channel was explicitly specified.
          666  +    uplevel puts_original $args
          667  +  }
          668  +}
          669  +rename puts puts_original
          670  +proc puts {args} { uplevel puts_override $args }
   579    671   
   580    672   
   581    673   # Invoke the do_test procedure to run a single test
   582    674   #
   583    675   proc do_test {name cmd expected} {
   584    676     global argv cmdlinearg
   585    677   
................................................................................
   600    692   #  }
   601    693   
   602    694     if {[info exists ::G(perm:prefix)]} {
   603    695       set name "$::G(perm:prefix)$name"
   604    696     }
   605    697   
   606    698     incr_ntest
   607         -  puts -nonewline $name...
          699  +  output1 -nonewline $name...
   608    700     flush stdout
   609    701   
   610    702     if {![info exists ::G(match)] || [string match $::G(match) $name]} {
   611    703       if {[catch {uplevel #0 "$cmd;\n"} result]} {
   612         -      puts "\nError: $result"
          704  +      output2_if_no_verbose -nonewline $name...
          705  +      output2 "\nError: $result"
   613    706         fail_test $name
   614    707       } else {
   615    708         if {[regexp {^~?/.*/$} $expected]} {
   616    709           # "expected" is of the form "/PATTERN/" then the result if correct if
   617    710           # regular expression PATTERN matches the result.  "~/PATTERN/" means
   618    711           # the regular expression must not match.
   619    712           if {[string index $expected 0]=="~"} {
................................................................................
   649    742         } else {
   650    743           set ok [expr {[string compare $result $expected]==0}]
   651    744         }
   652    745         if {!$ok} {
   653    746           # if {![info exists ::testprefix] || $::testprefix eq ""} {
   654    747           #   error "no test prefix"
   655    748           # }
   656         -        puts "\nExpected: \[$expected\]\n     Got: \[$result\]"
          749  +        output2_if_no_verbose -nonewline $name...
          750  +        output2 "\nExpected: \[$expected\]\n     Got: \[$result\]"
   657    751           fail_test $name
   658    752         } else {
   659         -        puts " Ok"
          753  +        output1 " Ok"
   660    754         }
   661    755       }
   662    756     } else {
   663         -    puts " Omitted"
          757  +    output1 " Omitted"
   664    758       omit_test $name "pattern mismatch" 0
   665    759     }
   666    760     flush stdout
   667    761   }
   668    762   
   669    763   proc dumpbytes {s} {
   670    764     set r ""
................................................................................
   833    927     }
   834    928   }
   835    929   
   836    930   # Run an SQL script.
   837    931   # Return the number of microseconds per statement.
   838    932   #
   839    933   proc speed_trial {name numstmt units sql} {
   840         -  puts -nonewline [format {%-21.21s } $name...]
          934  +  output2 -nonewline [format {%-21.21s } $name...]
   841    935     flush stdout
   842    936     set speed [time {sqlite3_exec_nr db $sql}]
   843    937     set tm [lindex $speed 0]
   844    938     if {$tm == 0} {
   845    939       set rate [format %20s "many"]
   846    940     } else {
   847    941       set rate [format %20.5f [expr {1000000.0*$numstmt/$tm}]]
   848    942     }
   849    943     set u2 $units/s
   850         -  puts [format {%12d uS %s %s} $tm $rate $u2]
          944  +  output2 [format {%12d uS %s %s} $tm $rate $u2]
   851    945     global total_time
   852    946     set total_time [expr {$total_time+$tm}]
   853    947     lappend ::speed_trial_times $name $tm
   854    948   }
   855    949   proc speed_trial_tcl {name numstmt units script} {
   856         -  puts -nonewline [format {%-21.21s } $name...]
          950  +  output2 -nonewline [format {%-21.21s } $name...]
   857    951     flush stdout
   858    952     set speed [time {eval $script}]
   859    953     set tm [lindex $speed 0]
   860    954     if {$tm == 0} {
   861    955       set rate [format %20s "many"]
   862    956     } else {
   863    957       set rate [format %20.5f [expr {1000000.0*$numstmt/$tm}]]
   864    958     }
   865    959     set u2 $units/s
   866         -  puts [format {%12d uS %s %s} $tm $rate $u2]
          960  +  output2 [format {%12d uS %s %s} $tm $rate $u2]
   867    961     global total_time
   868    962     set total_time [expr {$total_time+$tm}]
   869    963     lappend ::speed_trial_times $name $tm
   870    964   }
   871    965   proc speed_trial_init {name} {
   872    966     global total_time
   873    967     set total_time 0
   874    968     set ::speed_trial_times [list]
   875    969     sqlite3 versdb :memory:
   876    970     set vers [versdb one {SELECT sqlite_source_id()}]
   877    971     versdb close
   878         -  puts "SQLite $vers"
          972  +  output2 "SQLite $vers"
   879    973   }
   880    974   proc speed_trial_summary {name} {
   881    975     global total_time
   882         -  puts [format {%-21.21s %12d uS TOTAL} $name $total_time]
          976  +  output2 [format {%-21.21s %12d uS TOTAL} $name $total_time]
   883    977   
   884    978     if { 0 } {
   885    979       sqlite3 versdb :memory:
   886    980       set vers [lindex [versdb one {SELECT sqlite_source_id()}] 0]
   887    981       versdb close
   888         -    puts "CREATE TABLE IF NOT EXISTS time(version, script, test, us);"
          982  +    output2 "CREATE TABLE IF NOT EXISTS time(version, script, test, us);"
   889    983       foreach {test us} $::speed_trial_times {
   890         -      puts "INSERT INTO time VALUES('$vers', '$name', '$test', $us);"
          984  +      output2 "INSERT INTO time VALUES('$vers', '$name', '$test', $us);"
   891    985       }
   892    986     }
   893    987   }
   894    988   
   895    989   # Run this routine last
   896    990   #
   897    991   proc finish_test {} {
................................................................................
   927   1021       close $fd
   928   1022       foreach x $content {set known_error($x) 1}
   929   1023       foreach x [set_test_counter fail_list] {
   930   1024         if {[info exists known_error($x)]} {incr nKnown}
   931   1025       }
   932   1026     }
   933   1027     if {$nKnown>0} {
   934         -    puts "[expr {$nErr-$nKnown}] new errors and $nKnown known errors\
         1028  +    output2 "[expr {$nErr-$nKnown}] new errors and $nKnown known errors\
   935   1029            out of $nTest tests"
   936   1030     } else {
   937         -    puts "$nErr errors out of $nTest tests"
         1031  +    output2 "$nErr errors out of $nTest tests"
   938   1032     }
   939   1033     if {$nErr>$nKnown} {
   940         -    puts -nonewline "Failures on these tests:"
         1034  +    output2 -nonewline "Failures on these tests:"
   941   1035       foreach x [set_test_counter fail_list] {
   942         -      if {![info exists known_error($x)]} {puts -nonewline " $x"}
         1036  +      if {![info exists known_error($x)]} {output2 -nonewline " $x"}
   943   1037       }
   944         -    puts ""
         1038  +    output2 ""
   945   1039     }
   946   1040     foreach warning [set_test_counter warn_list] {
   947         -    puts "Warning: $warning"
         1041  +    output2 "Warning: $warning"
   948   1042     }
   949   1043     run_thread_tests 1
   950   1044     if {[llength $omitList]>0} {
   951         -    puts "Omitted test cases:"
         1045  +    output2 "Omitted test cases:"
   952   1046       set prec {}
   953   1047       foreach {rec} [lsort $omitList] {
   954   1048         if {$rec==$prec} continue
   955   1049         set prec $rec
   956         -      puts [format {  %-12s %s} [lindex $rec 0] [lindex $rec 1]]
         1050  +      output2 [format {  %-12s %s} [lindex $rec 0] [lindex $rec 1]]
   957   1051       }
   958   1052     }
   959   1053     if {$nErr>0 && ![working_64bit_int]} {
   960         -    puts "******************************************************************"
   961         -    puts "N.B.:  The version of TCL that you used to build this test harness"
   962         -    puts "is defective in that it does not support 64-bit integers.  Some or"
   963         -    puts "all of the test failures above might be a result from this defect"
   964         -    puts "in your TCL build."
   965         -    puts "******************************************************************"
         1054  +    output2 "******************************************************************"
         1055  +    output2 "N.B.:  The version of TCL that you used to build this test harness"
         1056  +    output2 "is defective in that it does not support 64-bit integers.  Some or"
         1057  +    output2 "all of the test failures above might be a result from this defect"
         1058  +    output2 "in your TCL build."
         1059  +    output2 "******************************************************************"
   966   1060     }
   967   1061     if {$::cmdlinearg(binarylog)} {
   968   1062       vfslog finalize binarylog
   969   1063     }
   970   1064     if {$sqlite_open_file_count} {
   971         -    puts "$sqlite_open_file_count files were left open"
         1065  +    output2 "$sqlite_open_file_count files were left open"
   972   1066       incr nErr
   973   1067     }
   974   1068     if {[lindex [sqlite3_status SQLITE_STATUS_MALLOC_COUNT 0] 1]>0 ||
   975   1069                 [sqlite3_memory_used]>0} {
   976         -    puts "Unfreed memory: [sqlite3_memory_used] bytes in\
         1070  +    output2 "Unfreed memory: [sqlite3_memory_used] bytes in\
   977   1071            [lindex [sqlite3_status SQLITE_STATUS_MALLOC_COUNT 0] 1] allocations"
   978   1072       incr nErr
   979   1073       ifcapable memdebug||mem5||(mem3&&debug) {
   980         -      puts "Writing unfreed memory log to \"./memleak.txt\""
         1074  +      output2 "Writing unfreed memory log to \"./memleak.txt\""
   981   1075         sqlite3_memdebug_dump ./memleak.txt
   982   1076       }
   983   1077     } else {
   984         -    puts "All memory allocations freed - no leaks"
         1078  +    output2 "All memory allocations freed - no leaks"
   985   1079       ifcapable memdebug||mem5 {
   986   1080         sqlite3_memdebug_dump ./memusage.txt
   987   1081       }
   988   1082     }
   989   1083     show_memstats
   990         -  puts "Maximum memory usage: [sqlite3_memory_highwater 1] bytes"
   991         -  puts "Current memory usage: [sqlite3_memory_highwater] bytes"
         1084  +  output2 "Maximum memory usage: [sqlite3_memory_highwater 1] bytes"
         1085  +  output2 "Current memory usage: [sqlite3_memory_highwater] bytes"
   992   1086     if {[info commands sqlite3_memdebug_malloc_count] ne ""} {
   993         -    puts "Number of malloc()  : [sqlite3_memdebug_malloc_count] calls"
         1087  +    output2 "Number of malloc()  : [sqlite3_memdebug_malloc_count] calls"
   994   1088     }
   995   1089     if {$::cmdlinearg(malloctrace)} {
   996         -    puts "Writing mallocs.sql..."
         1090  +    output2 "Writing mallocs.sql..."
   997   1091       memdebug_log_sql
   998   1092       sqlite3_memdebug_log stop
   999   1093       sqlite3_memdebug_log clear
  1000   1094   
  1001   1095       if {[sqlite3_memory_used]>0} {
  1002         -      puts "Writing leaks.sql..."
         1096  +      output2 "Writing leaks.sql..."
  1003   1097         sqlite3_memdebug_log sync
  1004   1098         memdebug_log_sql leaks.sql
  1005   1099       }
  1006   1100     }
  1007   1101     foreach f [glob -nocomplain test.db-*-journal] {
  1008   1102       forcedelete $f
  1009   1103     }
................................................................................
  1016   1110   # Display memory statistics for analysis and debugging purposes.
  1017   1111   #
  1018   1112   proc show_memstats {} {
  1019   1113     set x [sqlite3_status SQLITE_STATUS_MEMORY_USED 0]
  1020   1114     set y [sqlite3_status SQLITE_STATUS_MALLOC_SIZE 0]
  1021   1115     set val [format {now %10d  max %10d  max-size %10d} \
  1022   1116                 [lindex $x 1] [lindex $x 2] [lindex $y 2]]
  1023         -  puts "Memory used:          $val"
         1117  +  output1 "Memory used:          $val"
  1024   1118     set x [sqlite3_status SQLITE_STATUS_MALLOC_COUNT 0]
  1025   1119     set val [format {now %10d  max %10d} [lindex $x 1] [lindex $x 2]]
  1026         -  puts "Allocation count:     $val"
         1120  +  output1 "Allocation count:     $val"
  1027   1121     set x [sqlite3_status SQLITE_STATUS_PAGECACHE_USED 0]
  1028   1122     set y [sqlite3_status SQLITE_STATUS_PAGECACHE_SIZE 0]
  1029   1123     set val [format {now %10d  max %10d  max-size %10d} \
  1030   1124                 [lindex $x 1] [lindex $x 2] [lindex $y 2]]
  1031         -  puts "Page-cache used:      $val"
         1125  +  output1 "Page-cache used:      $val"
  1032   1126     set x [sqlite3_status SQLITE_STATUS_PAGECACHE_OVERFLOW 0]
  1033   1127     set val [format {now %10d  max %10d} [lindex $x 1] [lindex $x 2]]
  1034         -  puts "Page-cache overflow:  $val"
         1128  +  output1 "Page-cache overflow:  $val"
  1035   1129     set x [sqlite3_status SQLITE_STATUS_SCRATCH_USED 0]
  1036   1130     set val [format {now %10d  max %10d} [lindex $x 1] [lindex $x 2]]
  1037         -  puts "Scratch memory used:  $val"
         1131  +  output1 "Scratch memory used:  $val"
  1038   1132     set x [sqlite3_status SQLITE_STATUS_SCRATCH_OVERFLOW 0]
  1039   1133     set y [sqlite3_status SQLITE_STATUS_SCRATCH_SIZE 0]
  1040   1134     set val [format {now %10d  max %10d  max-size %10d} \
  1041   1135                  [lindex $x 1] [lindex $x 2] [lindex $y 2]]
  1042         -  puts "Scratch overflow:     $val"
         1136  +  output1 "Scratch overflow:     $val"
  1043   1137     ifcapable yytrackmaxstackdepth {
  1044   1138       set x [sqlite3_status SQLITE_STATUS_PARSER_STACK 0]
  1045   1139       set val [format {               max %10d} [lindex $x 2]]
  1046         -    puts "Parser stack depth:    $val"
         1140  +    output2 "Parser stack depth:    $val"
  1047   1141     }
  1048   1142   }
  1049   1143   
  1050   1144   # A procedure to execute SQL
  1051   1145   #
  1052   1146   proc execsql {sql {db db}} {
  1053   1147     # puts "SQL = $sql"
................................................................................
  1054   1148     uplevel [list $db eval $sql]
  1055   1149   }
  1056   1150   proc execsql_timed {sql {db db}} {
  1057   1151     set tm [time {
  1058   1152       set x [uplevel [list $db eval $sql]]
  1059   1153     } 1]
  1060   1154     set tm [lindex $tm 0]
  1061         -  puts -nonewline " ([expr {$tm*0.001}]ms) "
         1155  +  output1 -nonewline " ([expr {$tm*0.001}]ms) "
  1062   1156     set x
  1063   1157   }
  1064   1158   
  1065   1159   # Execute SQL and catch exceptions.
  1066   1160   #
  1067   1161   proc catchsql {sql {db db}} {
  1068   1162     # puts "SQL = $sql"
................................................................................
  1591   1685         do_test $testname.$n.6 {
  1592   1686           catch {db close}
  1593   1687           catch {db2 close}
  1594   1688           set ::DB [sqlite3 db test.db; sqlite3_connection_pointer db]
  1595   1689           set nowcksum [cksum]
  1596   1690           set res [expr {$nowcksum==$::checksum || $nowcksum==$::goodcksum}]
  1597   1691           if {$res==0} {
  1598         -          puts "now=$nowcksum"
  1599         -          puts "the=$::checksum"
  1600         -          puts "fwd=$::goodcksum"
         1692  +          output2 "now=$nowcksum"
         1693  +          output2 "the=$::checksum"
         1694  +          output2 "fwd=$::goodcksum"
  1601   1695           }
  1602   1696           set res
  1603   1697         } 1
  1604   1698       }
  1605   1699   
  1606   1700       set ::sqlite_io_error_hardhit 0
  1607   1701       set ::sqlite_io_error_pending 0
................................................................................
  1816   1910     foreach {var value} [list              \
  1817   1911       ::argv0 $::argv0                     \
  1818   1912       ::argv  {}                           \
  1819   1913       ::SLAVE 1                            \
  1820   1914     ] {
  1821   1915       interp eval tinterp [list set $var $value]
  1822   1916     }
         1917  +
         1918  +  # If output is being copied into a file, share the file-descriptor with
         1919  +  # the interpreter.
         1920  +  if {[info exists ::G(output_fd)]} {
         1921  +    interp share {} $::G(output_fd) tinterp
         1922  +  }
  1823   1923   
  1824   1924     # The alias used to access the global test counters.
  1825   1925     tinterp alias set_test_counter set_test_counter
  1826   1926   
  1827   1927     # Set up the ::cmdlinearg array in the slave.
  1828   1928     interp eval tinterp [list array set ::cmdlinearg [array get ::cmdlinearg]]
  1829   1929   
................................................................................
  1885   1985     ifcapable shared_cache {
  1886   1986       set res [expr {[sqlite3_enable_shared_cache] == $scs}]
  1887   1987       do_test ${tail}-sharedcachesetting [list set {} $res] 1
  1888   1988     }
  1889   1989   
  1890   1990     # Add some info to the output.
  1891   1991     #
  1892         -  puts "Time: $tail $ms ms"
         1992  +  output2 "Time: $tail $ms ms"
  1893   1993     show_memstats
  1894   1994   }
  1895   1995   
  1896   1996   # Open a new connection on database test.db and execute the SQL script
  1897   1997   # supplied as an argument. Before returning, close the new conection and
  1898   1998   # restore the 4 byte fields starting at header offsets 28, 92 and 96
  1899   1999   # to the values they held before the SQL was executed. This simulates