/ Check-in [375dfe28]
Login

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

Overview
Comment:Merge updates from trunk.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | toTypeFuncs
Files: files | file ages | folders
SHA1: 375dfe288fd0c4eb3c343a3cb23a7e3851903805
User & Date: mistachkin 2013-08-29 01:11:45
Context
2013-08-29
01:17
Prevent the implementation of the toreal() SQL function from being 'optimized' by MSVC. check-in: 047bd1c2 user: mistachkin tags: toTypeFuncs
01:11
Merge updates from trunk. check-in: 375dfe28 user: mistachkin tags: toTypeFuncs
01:09
Small enhancements to unit testing infrastructure. check-in: 9229aeb3 user: mistachkin tags: trunk
01:01
Fix boundary case for the toreal() SQL function. check-in: abe82c63 user: mistachkin tags: toTypeFuncs
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to Makefile.msc.

    89     89   # 3 == SQLITE_WIN32_MALLOC_VALIDATE: Validate the Win32 native heap per call.
    90     90   # 4 == SQLITE_DEBUG_OS_TRACE: Enables output from the OSTRACE() macros.
    91     91   # 5 == SQLITE_ENABLE_IOTRACE: Enables output from the IOTRACE() macros.
    92     92   #
    93     93   !IFNDEF DEBUG
    94     94   DEBUG = 0
    95     95   !ENDIF
           96  +
           97  +# Enable use of available compiler optimizations?  Normally, this should be
           98  +# non-zero.  Setting this to zero, thus disabling all compiler optimizations,
           99  +# can be useful for testing.
          100  +#
          101  +!IFNDEF OPTIMIZATIONS
          102  +OPTIMIZATIONS = 2
          103  +!ENDIF
    96    104   
    97    105   # Check for the predefined command macro CC.  This should point to the compiler
    98    106   # binary for the target platform.  If it is not defined, simply define it to
    99    107   # the legacy default value 'cl.exe'.
   100    108   #
   101    109   !IFNDEF CC
   102    110   CC = cl.exe
................................................................................
   339    347   #
   340    348   !IFNDEF TCLSH_CMD
   341    349   TCLSH_CMD = tclsh85
   342    350   !ENDIF
   343    351   
   344    352   # Compiler options needed for programs that use the readline() library.
   345    353   #
          354  +!IFNDEF READLINE_FLAGS
   346    355   READLINE_FLAGS = -DHAVE_READLINE=0
          356  +!ENDIF
   347    357   
   348    358   # The library that programs using readline() must link against.
   349    359   #
          360  +!IFNDEF LIBREADLINE
   350    361   LIBREADLINE =
          362  +!ENDIF
   351    363   
   352    364   # Should the database engine be compiled threadsafe
   353    365   #
   354    366   TCC = $(TCC) -DSQLITE_THREADSAFE=1
   355    367   RCC = $(RCC) -DSQLITE_THREADSAFE=1
   356    368   
   357    369   # Do threads override each others locks by default (1), or do we test (-1)
................................................................................
   393    405   RCC = $(RCC) $(OPT_FEATURE_FLAGS)
   394    406   
   395    407   # Add in any optional parameters specified on the make commane line
   396    408   # ie.  make "OPTS=-DSQLITE_ENABLE_FOO=1 -DSQLITE_OMIT_FOO=1".
   397    409   TCC = $(TCC) $(OPTS)
   398    410   RCC = $(RCC) $(OPTS)
   399    411   
   400         -# If symbols are enabled, enable PDBs.
   401         -# If debugging is enabled, disable all optimizations and enable PDBs.
          412  +# If compiling for debugging, add some defines.
   402    413   !IF $(DEBUG)>0
   403         -TCC = $(TCC) -Od -D_DEBUG
   404         -BCC = $(BCC) -Od -D_DEBUG
          414  +TCC = $(TCC) -D_DEBUG
          415  +BCC = $(BCC) -D_DEBUG
   405    416   RCC = $(RCC) -D_DEBUG
   406         -!ELSE
          417  +!ENDIF
          418  +
          419  +# If optimizations are enabled or disabled (either implicitly or
          420  +# explicitly), add the necessary flags.
          421  +!IF $(DEBUG)>0 || $(OPTIMIZATIONS)==0
          422  +TCC = $(TCC) -Od
          423  +BCC = $(BCC) -Od
          424  +!ELSEIF $(OPTIMIZATIONS)>=3
          425  +TCC = $(TCC) -Ox
          426  +BCC = $(BCC) -Ox
          427  +!ELSEIF $(OPTIMIZATIONS)==2
   407    428   TCC = $(TCC) -O2
   408    429   BCC = $(BCC) -O2
          430  +!ELSEIF $(OPTIMIZATIONS)==1
          431  +TCC = $(TCC) -O1
          432  +BCC = $(BCC) -O1
   409    433   !ENDIF
   410    434   
          435  +# If symbols are enabled (or compiling for debugging), enable PDBs.
   411    436   !IF $(DEBUG)>0 || $(SYMBOLS)!=0
   412    437   TCC = $(TCC) -Zi
   413    438   BCC = $(BCC) -Zi
   414    439   !ENDIF
   415    440   
   416    441   # If ICU support is enabled, add the compiler options for it.
   417    442   !IF $(USE_ICU)!=0
................................................................................
   461    486   # If ICU support is enabled, add the linker options for it.
   462    487   !IF $(USE_ICU)!=0
   463    488   LTLIBPATHS = $(LTLIBPATHS) /LIBPATH:$(ICULIBDIR)
   464    489   LTLIBS = $(LTLIBS) $(LIBICU)
   465    490   !ENDIF
   466    491   
   467    492   # nawk compatible awk.
          493  +!IFNDEF NAWK
   468    494   NAWK = gawk.exe
          495  +!ENDIF
   469    496   
   470    497   # You should not have to change anything below this line
   471    498   ###############################################################################
   472    499   
   473    500   # Object files for the SQLite library (non-amalgamation).
   474    501   #
   475    502   LIBOBJS0 = vdbe.lo parse.lo alter.lo analyze.lo attach.lo auth.lo \

Changes to test/tester.tcl.

    10     10   #***********************************************************************
    11     11   # This file implements some common TCL routines used for regression
    12     12   # testing the SQLite library
    13     13   #
    14     14   # $Id: tester.tcl,v 1.143 2009/04/09 01:23:49 drh Exp $
    15     15   
    16     16   #-------------------------------------------------------------------------
    17         -# The commands provided by the code in this file to help with creating 
           17  +# The commands provided by the code in this file to help with creating
    18     18   # test cases are as follows:
    19     19   #
    20     20   # Commands to manipulate the db and the file-system at a high level:
    21     21   #
    22     22   #      is_relative_file
    23     23   #      test_pwd
    24     24   #      get_pwd
................................................................................
    38     38   #
    39     39   #      dbcksum                DB DBNAME
    40     40   #      allcksum               ?DB?
    41     41   #      cksum                  ?DB?
    42     42   #
    43     43   # Commands to execute/explain SQL statements:
    44     44   #
           45  +#      memdbsql               SQL
    45     46   #      stepsql                DB SQL
    46     47   #      execsql2               SQL
    47     48   #      explain_no_trace       SQL
    48     49   #      explain                SQL ?DB?
    49     50   #      catchsql               SQL ?DB?
    50     51   #      execsql                SQL ?DB?
    51     52   #
................................................................................
    76     77   #      wal_is_wal_mode
    77     78   #      wal_set_journal_mode   ?DB?
    78     79   #      wal_check_journal_mode TESTNAME?DB?
    79     80   #      permutation
    80     81   #      presql
    81     82   #
    82     83   
    83         -# Set the precision of FP arithmatic used by the interpreter. And 
           84  +# Set the precision of FP arithmatic used by the interpreter. And
    84     85   # configure SQLite to take database file locks on the page that begins
    85     86   # 64KB into the database file instead of the one 1GB in. This means
    86     87   # the code that handles that special case can be tested without creating
    87     88   # very large database files.
    88     89   #
    89     90   set tcl_precision 15
    90     91   sqlite3_test_control_pending_byte 0x0010000
    91     92   
    92     93   
    93         -# If the pager codec is available, create a wrapper for the [sqlite3] 
           94  +# If the pager codec is available, create a wrapper for the [sqlite3]
    94     95   # command that appends "-key {xyzzy}" to the command line. i.e. this:
    95     96   #
    96     97   #     sqlite3 db test.db
    97     98   #
    98     99   # becomes
    99    100   #
   100    101   #     sqlite3 db test.db -key {xyzzy}
................................................................................
   118    119         }
   119    120         if {[info exists ::G(perm:dbconfig)]} {
   120    121           set ::dbhandle [lindex $args 0]
   121    122           uplevel #0 $::G(perm:dbconfig)
   122    123         }
   123    124         set res
   124    125       } else {
   125         -      # This command is not opening a new database connection. Pass the 
          126  +      # This command is not opening a new database connection. Pass the
   126    127         # arguments through to the C implementation as the are.
   127    128         #
   128    129         uplevel 1 sqlite_orig $args
   129    130       }
   130    131     }
   131    132   }
   132    133   
................................................................................
   286    287           file delete -force $filename
   287    288         } else {
   288    289           file delete $filename
   289    290         }
   290    291       }
   291    292     }
   292    293   }
          294  +
          295  +if {$::tcl_platform(platform) eq "windows"} {
          296  +  proc do_remove_win32_dir {args} {
          297  +    set nRetry [getFileRetries]     ;# Maximum number of retries.
          298  +    set nDelay [getFileRetryDelay]  ;# Delay in ms before retrying.
          299  +
          300  +    foreach dirName $args {
          301  +      # On windows, sometimes even a [remove_win32_dir] can fail just after
          302  +      # a directory is emptied. The cause is usually "tag-alongs" - programs
          303  +      # like anti-virus software, automatic backup tools and various explorer
          304  +      # extensions that keep a file open a little longer than we expect,
          305  +      # causing the delete to fail.
          306  +      #
          307  +      # The solution is to wait a short amount of time before retrying the
          308  +      # removal.
          309  +      #
          310  +      if {$nRetry > 0} {
          311  +        for {set i 0} {$i < $nRetry} {incr i} {
          312  +          set rc [catch {
          313  +            remove_win32_dir $dirName
          314  +          } msg]
          315  +          if {$rc == 0} break
          316  +          if {$nDelay > 0} { after $nDelay }
          317  +        }
          318  +        if {$rc} { error $msg }
          319  +      } else {
          320  +        remove_win32_dir $dirName
          321  +      }
          322  +    }
          323  +  }
          324  +
          325  +  proc do_delete_win32_file {args} {
          326  +    set nRetry [getFileRetries]     ;# Maximum number of retries.
          327  +    set nDelay [getFileRetryDelay]  ;# Delay in ms before retrying.
          328  +
          329  +    foreach fileName $args {
          330  +      # On windows, sometimes even a [delete_win32_file] can fail just after
          331  +      # a file is closed. The cause is usually "tag-alongs" - programs like
          332  +      # anti-virus software, automatic backup tools and various explorer
          333  +      # extensions that keep a file open a little longer than we expect,
          334  +      # causing the delete to fail.
          335  +      #
          336  +      # The solution is to wait a short amount of time before retrying the
          337  +      # delete.
          338  +      #
          339  +      if {$nRetry > 0} {
          340  +        for {set i 0} {$i < $nRetry} {incr i} {
          341  +          set rc [catch {
          342  +            delete_win32_file $fileName
          343  +          } msg]
          344  +          if {$rc == 0} break
          345  +          if {$nDelay > 0} { after $nDelay }
          346  +        }
          347  +        if {$rc} { error $msg }
          348  +      } else {
          349  +        delete_win32_file $fileName
          350  +      }
          351  +    }
          352  +  }
          353  +}
   293    354   
   294    355   proc execpresql {handle args} {
   295    356     trace remove execution $handle enter [list execpresql $handle]
   296    357     if {[info exists ::G(perm:presql)]} {
   297    358       $handle eval $::G(perm:presql)
   298    359     }
   299    360   }
................................................................................
   308    369   
   309    370   # The following block only runs the first time this file is sourced. It
   310    371   # does not run in slave interpreters (since the ::cmdlinearg array is
   311    372   # populated before the test script is run in slave interpreters).
   312    373   #
   313    374   if {[info exists cmdlinearg]==0} {
   314    375   
   315         -  # Parse any options specified in the $argv array. This script accepts the 
   316         -  # following options: 
          376  +  # Parse any options specified in the $argv array. This script accepts the
          377  +  # following options:
   317    378     #
   318    379     #   --pause
   319    380     #   --soft-heap-limit=NN
   320    381     #   --maxerror=NN
   321    382     #   --malloctrace=N
   322    383     #   --backtrace=N
   323    384     #   --binarylog=N
................................................................................
   338    399     set cmdlinearg(start)             ""
   339    400     set cmdlinearg(match)             ""
   340    401   
   341    402     set leftover [list]
   342    403     foreach a $argv {
   343    404       switch -regexp -- $a {
   344    405         {^-+pause$} {
   345         -        # Wait for user input before continuing. This is to give the user an 
          406  +        # Wait for user input before continuing. This is to give the user an
   346    407           # opportunity to connect profiling tools to the process.
   347    408           puts -nonewline "Press RETURN to begin..."
   348    409           flush stdout
   349    410           gets stdin
   350    411         }
   351    412         {^-+soft-heap-limit=.+$} {
   352    413           foreach {dummy cmdlinearg(soft-heap-limit)} [split $a =] break
................................................................................
   401    462       }
   402    463     }
   403    464     set argv $leftover
   404    465   
   405    466     # Install the malloc layer used to inject OOM errors. And the 'automatic'
   406    467     # extensions. This only needs to be done once for the process.
   407    468     #
   408         -  sqlite3_shutdown 
   409         -  install_malloc_faultsim 1 
          469  +  sqlite3_shutdown
          470  +  install_malloc_faultsim 1
   410    471     sqlite3_initialize
   411    472     autoinstall_test_functions
   412    473   
   413    474     # If the --binarylog option was specified, create the logging VFS. This
   414    475     # call installs the new VFS as the default for all SQLite connections.
   415    476     #
   416    477     if {$cmdlinearg(binarylog)} {
................................................................................
   512    573   # Increment the number of tests run
   513    574   #
   514    575   proc incr_ntest {} {
   515    576     set_test_counter count [expr [set_test_counter count] + 1]
   516    577   }
   517    578   
   518    579   
   519         -# Invoke the do_test procedure to run a single test 
          580  +# Invoke the do_test procedure to run a single test
   520    581   #
   521    582   proc do_test {name cmd expected} {
   522    583     global argv cmdlinearg
   523    584   
   524    585     fix_testname name
   525    586   
   526    587     sqlite3_memdebug_settitle $name
   527    588   
   528         -#  if {[llength $argv]==0} { 
          589  +#  if {[llength $argv]==0} {
   529    590   #    set go 1
   530    591   #  } else {
   531    592   #    set go 0
   532    593   #    foreach pattern $argv {
   533    594   #      if {[string match $pattern $name]} {
   534    595   #        set go 1
   535    596   #        break
................................................................................
   624    685     uplevel [list do_test $name [
   625    686       subst -nocommands { realnum_normalize [ $cmd ] }
   626    687     ] [realnum_normalize $expected]]
   627    688   }
   628    689   
   629    690   proc fix_testname {varname} {
   630    691     upvar $varname testname
   631         -  if {[info exists ::testprefix] 
          692  +  if {[info exists ::testprefix]
   632    693      && [string is digit [string range $testname 0 0]]
   633    694     } {
   634    695       set testname "${::testprefix}-$testname"
   635    696     }
   636    697   }
   637         -    
          698  +
   638    699   proc do_execsql_test {testname sql {result {}}} {
   639    700     fix_testname testname
   640    701     uplevel do_test [list $testname] [list "execsql {$sql}"] [list [list {*}$result]]
   641    702   }
   642    703   proc do_catchsql_test {testname sql result} {
   643    704     fix_testname testname
   644    705     uplevel do_test [list $testname] [list "catchsql {$sql}"] [list $result]
................................................................................
   716    777   
   717    778   proc delete_all_data {} {
   718    779     db eval {SELECT tbl_name AS t FROM sqlite_master WHERE type = 'table'} {
   719    780       db eval "DELETE FROM '[string map {' ''} $t]'"
   720    781     }
   721    782   }
   722    783   
   723         -# Run an SQL script.  
          784  +# Run an SQL script.
   724    785   # Return the number of microseconds per statement.
   725    786   #
   726    787   proc speed_trial {name numstmt units sql} {
   727    788     puts -nonewline [format {%-21.21s } $name...]
   728    789     flush stdout
   729    790     set speed [time {sqlite3_exec_nr db $sql}]
   730    791     set tm [lindex $speed 0]
................................................................................
   979   1040     db eval $sql data {
   980   1041       foreach f $data(*) {
   981   1042         lappend result $f $data($f)
   982   1043       }
   983   1044     }
   984   1045     return $result
   985   1046   }
         1047  +
         1048  +# Use a temporary in-memory database to execute SQL statements
         1049  +#
         1050  +proc memdbsql {sql} {
         1051  +  sqlite3 memdb :memory:
         1052  +  set result [memdb eval $sql]
         1053  +  memdb close
         1054  +  return $result
         1055  +}
   986   1056   
   987   1057   # Use the non-callback API to execute multiple SQL statements
   988   1058   #
   989   1059   proc stepsql {dbptr sql} {
   990   1060     set sql [string trim $sql]
   991   1061     set r 0
   992   1062     while {[string length $sql]>0} {
................................................................................
  1094   1164     set blocksize ""
  1095   1165     set crashdelay 1
  1096   1166     set prngseed 0
  1097   1167     set tclbody {}
  1098   1168     set crashfile ""
  1099   1169     set dc ""
  1100   1170     set sql [lindex $args end]
  1101         -  
         1171  +
  1102   1172     for {set ii 0} {$ii < [llength $args]-1} {incr ii 2} {
  1103   1173       set z [lindex $args $ii]
  1104   1174       set n [string length $z]
  1105   1175       set z2 [lindex $args [expr $ii+1]]
  1106   1176   
  1107   1177       if     {$n>1 && [string first $z -delay]==0}     {set crashdelay $z2} \
  1108   1178       elseif {$n>1 && [string first $z -seed]==0}      {set prngseed $z2} \
................................................................................
  1113   1183       else   { error "Unrecognized option: $z" }
  1114   1184     }
  1115   1185   
  1116   1186     if {$crashfile eq ""} {
  1117   1187       error "Compulsory option -file missing"
  1118   1188     }
  1119   1189   
  1120         -  # $crashfile gets compared to the native filename in 
         1190  +  # $crashfile gets compared to the native filename in
  1121   1191     # cfSync(), which can be different then what TCL uses by
  1122   1192     # default, so here we force it to the "nativename" format.
  1123   1193     set cfile [string map {\\ \\\\} [file nativename [file join [get_pwd] $crashfile]]]
  1124   1194   
  1125   1195     set f [open crash.tcl w]
  1126   1196     puts $f "sqlite3_crash_enable 1"
  1127   1197     puts $f "sqlite3_crashparams $blocksize $dc $crashdelay $cfile"
................................................................................
  1148   1218       puts $f   "$sql"
  1149   1219       puts $f "}"
  1150   1220     }
  1151   1221     close $f
  1152   1222     set r [catch {
  1153   1223       exec [info nameofexec] crash.tcl >@stdout
  1154   1224     } msg]
  1155         -  
         1225  +
  1156   1226     # Windows/ActiveState TCL returns a slightly different
  1157   1227     # error message.  We map that to the expected message
  1158   1228     # so that we don't have to change all of the test
  1159   1229     # cases.
  1160   1230     if {$::tcl_platform(platform)=="windows"} {
  1161   1231       if {$msg=="child killed: unknown signal"} {
  1162   1232         set msg "child process exited abnormally"
  1163   1233       }
  1164   1234     }
  1165         -  
         1235  +
  1166   1236     lappend r $msg
  1167   1237   }
  1168   1238   
  1169   1239   proc run_ioerr_prep {} {
  1170   1240     set ::sqlite_io_error_pending 0
  1171   1241     catch {db close}
  1172   1242     catch {db2 close}
................................................................................
  1184   1254     }
  1185   1255     expr 0
  1186   1256   }
  1187   1257   
  1188   1258   # Usage: do_ioerr_test <test number> <options...>
  1189   1259   #
  1190   1260   # This proc is used to implement test cases that check that IO errors
  1191         -# are correctly handled. The first argument, <test number>, is an integer 
         1261  +# are correctly handled. The first argument, <test number>, is an integer
  1192   1262   # used to name the tests executed by this proc. Options are as follows:
  1193   1263   #
  1194   1264   #     -tclprep          TCL script to run to prepare test.
  1195   1265   #     -sqlprep          SQL script to run to prepare test.
  1196   1266   #     -tclbody          TCL script to run with IO error simulation.
  1197   1267   #     -sqlbody          TCL script to run with IO error simulation.
  1198   1268   #     -exclude          List of 'N' values not to test.
................................................................................
  1213   1283     set ::ioerropts(-ckrefcount) 0
  1214   1284     set ::ioerropts(-restoreprng) 1
  1215   1285     array set ::ioerropts $args
  1216   1286   
  1217   1287     # TEMPORARY: For 3.5.9, disable testing of extended result codes. There are
  1218   1288     # a couple of obscure IO errors that do not return them.
  1219   1289     set ::ioerropts(-erc) 0
  1220         -  
         1290  +
  1221   1291     # Create a single TCL script from the TCL and SQL specified
  1222   1292     # as the body of the test.
  1223   1293     set ::ioerrorbody {}
  1224   1294     if {[info exists ::ioerropts(-tclbody)]} {
  1225   1295       append ::ioerrorbody "$::ioerropts(-tclbody)\n"
  1226   1296     }
  1227   1297     if {[info exists ::ioerropts(-sqlbody)]} {
................................................................................
  1237   1307   
  1238   1308     set ::go 1
  1239   1309     #reset_prng_state
  1240   1310     for {set n $::ioerropts(-start)} {$::go} {incr n} {
  1241   1311       set ::TN $n
  1242   1312       incr ::ioerropts(-count) -1
  1243   1313       if {$::ioerropts(-count)<0} break
  1244         - 
         1314  +
  1245   1315       # Skip this IO error if it was specified with the "-exclude" option.
  1246   1316       if {[info exists ::ioerropts(-exclude)]} {
  1247   1317         if {[lsearch $::ioerropts(-exclude) $n]!=-1} continue
  1248   1318       }
  1249   1319       if {$::ioerropts(-restoreprng)} {
  1250   1320         restore_prng_state
  1251   1321       }
  1252   1322   
  1253         -    # Delete the files test.db and test2.db, then execute the TCL and 
         1323  +    # Delete the files test.db and test2.db, then execute the TCL and
  1254   1324       # SQL (in that order) to prepare for the test case.
  1255   1325       do_test $testname.$n.1 {
  1256   1326         run_ioerr_prep
  1257   1327       } {0}
  1258   1328   
  1259   1329       # Read the 'checksum' of the database.
  1260   1330       if {$::ioerropts(-cksum)} {
................................................................................
  1264   1334       # Set the Nth IO error to fail.
  1265   1335       do_test $testname.$n.2 [subst {
  1266   1336         set ::sqlite_io_error_persist $::ioerropts(-persist)
  1267   1337         set ::sqlite_io_error_pending $n
  1268   1338       }] $n
  1269   1339   
  1270   1340       # Execute the TCL script created for the body of this test. If
  1271         -    # at least N IO operations performed by SQLite as a result of 
         1341  +    # at least N IO operations performed by SQLite as a result of
  1272   1342       # the script, the Nth will fail.
  1273   1343       do_test $testname.$n.3 {
  1274   1344         set ::sqlite_io_error_hit 0
  1275   1345         set ::sqlite_io_error_hardhit 0
  1276   1346         set r [catch $::ioerrorbody msg]
  1277   1347         set ::errseen $r
  1278   1348         set rc [sqlite3_errcode $::DB]
................................................................................
  1318   1388         #puts "s=$s r=$r q=$q"
  1319   1389         expr { ($s && !$r && !$q) || (!$s && $r && $q) }
  1320   1390       } {1}
  1321   1391   
  1322   1392       set ::sqlite_io_error_hit 0
  1323   1393       set ::sqlite_io_error_pending 0
  1324   1394   
  1325         -    # Check that no page references were leaked. There should be 
  1326         -    # a single reference if there is still an active transaction, 
         1395  +    # Check that no page references were leaked. There should be
         1396  +    # a single reference if there is still an active transaction,
  1327   1397       # or zero otherwise.
  1328   1398       #
  1329   1399       # UPDATE: If the IO error occurs after a 'BEGIN' but before any
  1330         -    # locks are established on database files (i.e. if the error 
         1400  +    # locks are established on database files (i.e. if the error
  1331   1401       # occurs while attempting to detect a hot-journal file), then
  1332   1402       # there may 0 page references and an active transaction according
  1333   1403       # to [sqlite3_get_autocommit].
  1334   1404       #
  1335   1405       if {$::go && $::sqlite_io_error_hardhit && $::ioerropts(-ckrefcount)} {
  1336   1406         do_test $testname.$n.4 {
  1337   1407           set bt [btree_from_db db]
................................................................................
  1339   1409           array set stats [btree_pager_stats $bt]
  1340   1410           db_leave db
  1341   1411           set nRef $stats(ref)
  1342   1412           expr {$nRef == 0 || ([sqlite3_get_autocommit db]==0 && $nRef == 1)}
  1343   1413         } {1}
  1344   1414       }
  1345   1415   
  1346         -    # If there is an open database handle and no open transaction, 
         1416  +    # If there is an open database handle and no open transaction,
  1347   1417       # and the pager is not running in exclusive-locking mode,
  1348   1418       # check that the pager is in "unlocked" state. Theoretically,
  1349   1419       # if a call to xUnlock() failed due to an IO error the underlying
  1350   1420       # file may still be locked.
  1351   1421       #
  1352   1422       ifcapable pragma {
  1353   1423         if { [info commands db] ne ""
................................................................................
  1443   1513       append txt $prag-[$db eval "PRAGMA $prag"]\n
  1444   1514     }
  1445   1515     # puts txt=$txt
  1446   1516     return [md5 $txt]
  1447   1517   }
  1448   1518   
  1449   1519   # Generate a checksum based on the contents of a single database with
  1450         -# a database connection.  The name of the database is $dbname.  
         1520  +# a database connection.  The name of the database is $dbname.
  1451   1521   # Examples of $dbname are "temp" or "main".
  1452   1522   #
  1453   1523   proc dbcksum {db dbname} {
  1454   1524     if {$dbname=="temp"} {
  1455   1525       set master sqlite_temp_master
  1456   1526     } else {
  1457   1527       set master $dbname.sqlite_master
................................................................................
  1537   1607     ifcapable trigger&&foreignkey {
  1538   1608       $db eval "PRAGMA foreign_keys = $pk"
  1539   1609     }
  1540   1610   }
  1541   1611   
  1542   1612   #-------------------------------------------------------------------------
  1543   1613   # If a test script is executed with global variable $::G(perm:name) set to
  1544         -# "wal", then the tests are run in WAL mode. Otherwise, they should be run 
  1545         -# in rollback mode. The following Tcl procs are used to make this less 
         1614  +# "wal", then the tests are run in WAL mode. Otherwise, they should be run
         1615  +# in rollback mode. The following Tcl procs are used to make this less
  1546   1616   # intrusive:
  1547   1617   #
  1548   1618   #   wal_set_journal_mode ?DB?
  1549   1619   #
  1550   1620   #     If running a WAL test, execute "PRAGMA journal_mode = wal" using
  1551   1621   #     connection handle DB. Otherwise, this command is a no-op.
  1552   1622   #
................................................................................
  1553   1623   #   wal_check_journal_mode TESTNAME ?DB?
  1554   1624   #
  1555   1625   #     If running a WAL test, execute a tests case that fails if the main
  1556   1626   #     database for connection handle DB is not currently a WAL database.
  1557   1627   #     Otherwise (if not running a WAL permutation) this is a no-op.
  1558   1628   #
  1559   1629   #   wal_is_wal_mode
  1560         -#   
         1630  +#
  1561   1631   #     Returns true if this test should be run in WAL mode. False otherwise.
  1562         -# 
         1632  +#
  1563   1633   proc wal_is_wal_mode {} {
  1564   1634     expr {[permutation] eq "wal"}
  1565   1635   }
  1566   1636   proc wal_set_journal_mode {{db db}} {
  1567   1637     if { [wal_is_wal_mode] } {
  1568   1638       $db eval "PRAGMA journal_mode = WAL"
  1569   1639     }
................................................................................
  1656   1726     # is not thread-safe.
  1657   1727     #
  1658   1728     if {[info exists ::run_thread_tests_called]==0} {
  1659   1729       do_test ${tail}-closeallfiles { expr {$::sqlite_open_file_count>0} } {0}
  1660   1730     }
  1661   1731     set ::sqlite_open_file_count 0
  1662   1732   
  1663         -  # Test that the global "shared-cache" setting was not altered by 
         1733  +  # Test that the global "shared-cache" setting was not altered by
  1664   1734     # the test script.
  1665   1735     #
  1666         -  ifcapable shared_cache { 
         1736  +  ifcapable shared_cache {
  1667   1737       set res [expr {[sqlite3_enable_shared_cache] == $scs}]
  1668   1738       do_test ${tail}-sharedcachesetting [list set {} $res] 1
  1669   1739     }
  1670   1740   
  1671   1741     # Add some info to the output.
  1672   1742     #
  1673   1743     puts "Time: $tail $ms ms"

Changes to test/wild001.test.

    38     38   # This test should work the same with and without SQLITE_ENABLE_STAT3
    39     39   #
    40     40   ###############################################################################
    41     41   
    42     42   set testdir [file dirname $argv0]
    43     43   source $testdir/tester.tcl
    44     44   
    45         -# TODO: Reenable this test.
    46         -  finish_test
    47         -  return
    48         -
    49     45   ifcapable !stat3 {
    50     46     finish_test
    51     47     return
    52     48   }
    53     49   
    54     50   do_execsql_test wild001.01 {
    55     51     CREATE TABLE "items" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "secid" integer, "parent_id" integer, "metadata_type" integer, "guid" varchar(255), "media_item_count" integer, "title" varchar(255), "title_sort" varchar(255) COLLATE NOCASE, "original_title" varchar(255), "studio" varchar(255), "rating" float, "rating_count" integer, "tagline" varchar(255), "summary" text, "trivia" text, "quotes" text, "content_rating" varchar(255), "content_rating_age" integer, "index" integer, "absolute_index" integer, "duration" integer, "user_thumb_url" varchar(255), "user_art_url" varchar(255), "user_banner_url" varchar(255), "user_music_url" varchar(255), "user_fields" varchar(255), "tags_genre" varchar(255), "tags_collection" varchar(255), "tags_director" varchar(255), "tags_writer" varchar(255), "tags_star" varchar(255), "originally_available_at" datetime, "available_at" datetime, "expires_at" datetime, "refreshed_at" datetime, "year" integer, "added_at" datetime, "created_at" datetime, "updated_at" datetime, "deleted_at" datetime, "tags_country" varchar(255), "extra_data" varchar(255), "hash" varchar(255));

Changes to test/win32longpath.test.

    15     15   
    16     16   if {$tcl_platform(platform)!="windows"} return
    17     17   
    18     18   set testdir [file dirname $argv0]
    19     19   source $testdir/tester.tcl
    20     20   set testprefix win32longpath
    21     21   
    22         -proc do_remove_win32_dir {args} {
    23         -  set nRetry [getFileRetries]     ;# Maximum number of retries.
    24         -  set nDelay [getFileRetryDelay]  ;# Delay in ms before retrying.
    25         -
    26         -  foreach dirName $args {
    27         -    # On windows, sometimes even a [remove_win32_dir] can fail just after
    28         -    # a directory is emptied. The cause is usually "tag-alongs" - programs
    29         -    # like anti-virus software, automatic backup tools and various explorer
    30         -    # extensions that keep a file open a little longer than we expect,
    31         -    # causing the delete to fail.
    32         -    #
    33         -    # The solution is to wait a short amount of time before retrying the
    34         -    # removal.
    35         -    #
    36         -    if {$nRetry > 0} {
    37         -      for {set i 0} {$i < $nRetry} {incr i} {
    38         -        set rc [catch {
    39         -          remove_win32_dir $dirName
    40         -        } msg]
    41         -        if {$rc == 0} break
    42         -        if {$nDelay > 0} { after $nDelay }
    43         -      }
    44         -      if {$rc} { error $msg }
    45         -    } else {
    46         -      remove_win32_dir $dirName
    47         -    }
    48         -  }
    49         -}
    50         -
    51         -proc do_delete_win32_file {args} {
    52         -  set nRetry [getFileRetries]     ;# Maximum number of retries.
    53         -  set nDelay [getFileRetryDelay]  ;# Delay in ms before retrying.
    54         -
    55         -  foreach fileName $args {
    56         -    # On windows, sometimes even a [delete_win32_file] can fail just after
    57         -    # a file is closed. The cause is usually "tag-alongs" - programs like
    58         -    # anti-virus software, automatic backup tools and various explorer
    59         -    # extensions that keep a file open a little longer than we expect,
    60         -    # causing the delete to fail.
    61         -    #
    62         -    # The solution is to wait a short amount of time before retrying the
    63         -    # delete.
    64         -    #
    65         -    if {$nRetry > 0} {
    66         -      for {set i 0} {$i < $nRetry} {incr i} {
    67         -        set rc [catch {
    68         -          delete_win32_file $fileName
    69         -        } msg]
    70         -        if {$rc == 0} break
    71         -        if {$nDelay > 0} { after $nDelay }
    72         -      }
    73         -      if {$rc} { error $msg }
    74         -    } else {
    75         -      delete_win32_file $fileName
    76         -    }
    77         -  }
    78         -}
    79         -
    80     22   db close
    81     23   set path [file nativename [get_pwd]]
    82     24   sqlite3 db [file join $path test.db] -vfs win32-longpath
    83     25   
    84     26   do_test 1.1 {
    85     27     db eval {
    86     28       BEGIN EXCLUSIVE;