| Index: third_party/sqlite/src/test/releasetest.tcl
 | 
| diff --git a/third_party/sqlite/src/test/releasetest.tcl b/third_party/sqlite/src/test/releasetest.tcl
 | 
| old mode 100644
 | 
| new mode 100755
 | 
| index bb902eec3eac98c8b97c6e824af2c65934802136..99823e3b1c3f458e14f1c5c6704ee1ac6c99ec9d
 | 
| --- a/third_party/sqlite/src/test/releasetest.tcl
 | 
| +++ b/third_party/sqlite/src/test/releasetest.tcl
 | 
| @@ -9,21 +9,19 @@ This Tcl script is used to test the various configurations required
 | 
|  before releasing a new version. Supported command line options (all
 | 
|  optional) are:
 | 
|  
 | 
| -    --srcdir   TOP-OF-SQLITE-TREE      (see below)
 | 
| -    --platform PLATFORM                (see below)
 | 
| -    --config   CONFIGNAME              (Run only CONFIGNAME)
 | 
| -    --quick                            (Run "veryquick.test" only)
 | 
| -    --veryquick                        (Run "make smoketest" only)
 | 
| -    --msvc                             (Use MSVC as the compiler)
 | 
|      --buildonly                        (Just build testfixture - do not run)
 | 
| +    --config   CONFIGNAME              (Run only CONFIGNAME)
 | 
|      --dryrun                           (Print what would have happened)
 | 
| +    -f|--force                         (Run even if uncommitted changes)
 | 
|      --info                             (Show diagnostic info)
 | 
| -    --with-tcl=DIR                     (Use TCL build at DIR)
 | 
|      --jobs     N                       (Use N processes - default 1)
 | 
| +    --keep                             (Delete no files after each test run)
 | 
| +    --msvc                             (Use MSVC as the compiler)
 | 
| +    --platform PLATFORM                (see below)
 | 
|      --progress                         (Show progress messages)
 | 
| -
 | 
| -The default value for --srcdir is the parent of the directory holding
 | 
| -this script.
 | 
| +    --quick                            (Run "veryquick.test" only)
 | 
| +    --veryquick                        (Run "make smoketest" only)
 | 
| +    --with-tcl=DIR                     (Use TCL build at DIR)
 | 
|  
 | 
|  The script determines the default value for --platform using the
 | 
|  $tcl_platform(os) and $tcl_platform(machine) variables.  Supported
 | 
| @@ -51,10 +49,16 @@ array set ::Configs [strip_comments {
 | 
|    "Default" {
 | 
|      -O2
 | 
|      --disable-amalgamation --disable-shared
 | 
| +    --enable-session
 | 
|    }
 | 
|    "Sanitize" {
 | 
|      CC=clang -fsanitize=undefined
 | 
|      -DSQLITE_ENABLE_STAT4
 | 
| +    --enable-session
 | 
| +  }
 | 
| +  "Stdcall" {
 | 
| +    -DUSE_STDCALL=1
 | 
| +    -O2
 | 
|    }
 | 
|    "Have-Not" {
 | 
|      # The "Have-Not" configuration sets all possible -UHAVE_feature options
 | 
| @@ -106,7 +110,7 @@ array set ::Configs [strip_comments {
 | 
|      -DSQLITE_ENABLE_OVERSIZE_CELL_CHECK=1
 | 
|      -DSQLITE_ENABLE_STAT4
 | 
|      -DSQLITE_ENABLE_STMT_SCANSTATUS
 | 
| -    --enable-json1 --enable-fts5
 | 
| +    --enable-json1 --enable-fts5 --enable-session
 | 
|    }
 | 
|    "Debug-One" {
 | 
|      --disable-shared
 | 
| @@ -118,7 +122,6 @@ array set ::Configs [strip_comments {
 | 
|      -DSQLITE_ENABLE_FTS3=1
 | 
|      -DSQLITE_ENABLE_RTREE=1
 | 
|      -DSQLITE_ENABLE_MEMSYS5=1
 | 
| -    -DSQLITE_ENABLE_MEMSYS3=1
 | 
|      -DSQLITE_ENABLE_COLUMN_METADATA=1
 | 
|      -DSQLITE_ENABLE_STAT4
 | 
|      -DSQLITE_ENABLE_HIDDEN_COLUMNS
 | 
| @@ -132,6 +135,7 @@ array set ::Configs [strip_comments {
 | 
|      -DSQLITE_ENABLE_RBU
 | 
|      -DSQLITE_MAX_ATTACHED=125
 | 
|      -DLONGDOUBLE_TYPE=double
 | 
| +    --enable-session
 | 
|    }
 | 
|    "Device-One" {
 | 
|      -O2
 | 
| @@ -168,30 +172,53 @@ array set ::Configs [strip_comments {
 | 
|      -DSQLITE_OMIT_TRACE=1
 | 
|      -DSQLITE_TEMP_STORE=3
 | 
|      -DSQLITE_THREADSAFE=2
 | 
| -    --enable-json1 --enable-fts5
 | 
| +    --enable-json1 --enable-fts5 --enable-session
 | 
|    }
 | 
|    "Locking-Style" {
 | 
|      -O2
 | 
|      -DSQLITE_ENABLE_LOCKING_STYLE=1
 | 
|    }
 | 
| -  "OS-X" {
 | 
| +  "Apple" {
 | 
|      -O1   # Avoid a compiler bug in gcc 4.2.1 build 5658
 | 
| -    -DSQLITE_OMIT_LOAD_EXTENSION=1
 | 
| -    -DSQLITE_DEFAULT_MEMSTATUS=0
 | 
| -    -DSQLITE_THREADSAFE=2
 | 
| -    -DSQLITE_OS_UNIX=1
 | 
| -    -DSQLITE_ENABLE_JSON1=1
 | 
| -    -DSQLITE_ENABLE_LOCKING_STYLE=1
 | 
| -    -DUSE_PREAD=1
 | 
| -    -DSQLITE_ENABLE_RTREE=1
 | 
| +    -DHAVE_GMTIME_R=1
 | 
| +    -DHAVE_ISNAN=1
 | 
| +    -DHAVE_LOCALTIME_R=1
 | 
| +    -DHAVE_PREAD=1
 | 
| +    -DHAVE_PWRITE=1
 | 
| +    -DHAVE_USLEEP=1
 | 
| +    -DHAVE_USLEEP=1
 | 
| +    -DHAVE_UTIME=1
 | 
| +    -DSQLITE_DEFAULT_CACHE_SIZE=1000
 | 
| +    -DSQLITE_DEFAULT_CKPTFULLFSYNC=1
 | 
| +    -DSQLITE_DEFAULT_MEMSTATUS=1
 | 
| +    -DSQLITE_DEFAULT_PAGE_SIZE=1024
 | 
| +    -DSQLITE_DISABLE_PAGECACHE_OVERFLOW_STATS=1
 | 
| +    -DSQLITE_ENABLE_API_ARMOR=1
 | 
| +    -DSQLITE_ENABLE_AUTO_PROFILE=1
 | 
| +    -DSQLITE_ENABLE_FLOCKTIMEOUT=1
 | 
|      -DSQLITE_ENABLE_FTS3=1
 | 
|      -DSQLITE_ENABLE_FTS3_PARENTHESIS=1
 | 
| -    -DSQLITE_DEFAULT_CACHE_SIZE=1000
 | 
| +    -DSQLITE_ENABLE_FTS3_TOKENIZER=1
 | 
| +    if:os=="Darwin" -DSQLITE_ENABLE_LOCKING_STYLE=1
 | 
| +    -DSQLITE_ENABLE_PERSIST_WAL=1
 | 
| +    -DSQLITE_ENABLE_PURGEABLE_PCACHE=1
 | 
| +    -DSQLITE_ENABLE_RTREE=1
 | 
| +    -DSQLITE_ENABLE_SNAPSHOT=1
 | 
| +    # -DSQLITE_ENABLE_SQLLOG=1
 | 
| +    -DSQLITE_ENABLE_UPDATE_DELETE_LIMIT=1
 | 
|      -DSQLITE_MAX_LENGTH=2147483645
 | 
|      -DSQLITE_MAX_VARIABLE_NUMBER=500000
 | 
| -    -DSQLITE_DEBUG=1
 | 
| +    # -DSQLITE_MEMDEBUG=1
 | 
| +    -DSQLITE_NO_SYNC=1
 | 
| +    -DSQLITE_OMIT_AUTORESET=1
 | 
| +    -DSQLITE_OMIT_LOAD_EXTENSION=1
 | 
|      -DSQLITE_PREFER_PROXY_LOCKING=1
 | 
| -    -DSQLITE_ENABLE_API_ARMOR=1
 | 
| +    -DSQLITE_SERIES_CONSTRAINT_VERIFY=1
 | 
| +    -DSQLITE_THREADSAFE=2
 | 
| +    -DSQLITE_USE_URI=1
 | 
| +    -DSQLITE_WRITE_WALFRAME_PREBUFFERED=1
 | 
| +    -DUSE_GUARDED_FD=1
 | 
| +    -DUSE_PREAD=1
 | 
|      --enable-json1 --enable-fts5
 | 
|    }
 | 
|    "Extra-Robustness" {
 | 
| @@ -203,6 +230,7 @@ array set ::Configs [strip_comments {
 | 
|      -DSQLITE_MAX_ATTACHED=30
 | 
|      -DSQLITE_ENABLE_COLUMN_METADATA
 | 
|      -DSQLITE_ENABLE_FTS4
 | 
| +    -DSQLITE_ENABLE_FTS5
 | 
|      -DSQLITE_ENABLE_FTS4_PARENTHESIS
 | 
|      -DSQLITE_DISABLE_FTS4_DEFERRED
 | 
|      -DSQLITE_ENABLE_RTREE
 | 
| @@ -247,6 +275,7 @@ array set ::Platforms [strip_comments {
 | 
|      "Device-Two"              test
 | 
|      "No-lookaside"            test
 | 
|      "Devkit"                  test
 | 
| +    "Apple"                   test
 | 
|      "Sanitize"                {QUICKTEST_OMIT=func4.test,nan.test test}
 | 
|      "Device-One"              fulltest
 | 
|      "Default"                 "threadtest fulltest"
 | 
| @@ -263,18 +292,20 @@ array set ::Platforms [strip_comments {
 | 
|    Darwin-i386 {
 | 
|      "Locking-Style"           "mptest test"
 | 
|      "Have-Not"                test
 | 
| -    "OS-X"                    "threadtest fulltest"
 | 
| +    "Apple"                   "threadtest fulltest"
 | 
|    }
 | 
|    Darwin-x86_64 {
 | 
|      "Locking-Style"           "mptest test"
 | 
|      "Have-Not"                test
 | 
| -    "OS-X"                    "threadtest fulltest"
 | 
| +    "Apple"                   "threadtest fulltest"
 | 
|    }
 | 
|    "Windows NT-intel" {
 | 
| +    "Stdcall"                 test
 | 
|      "Have-Not"                test
 | 
|      "Default"                 "mptest fulltestonly"
 | 
|    }
 | 
|    "Windows NT-amd64" {
 | 
| +    "Stdcall"                 test
 | 
|      "Have-Not"                test
 | 
|      "Default"                 "mptest fulltestonly"
 | 
|    }
 | 
| @@ -437,14 +468,15 @@ proc count_tests_and_errors {logfile rcVar errmsgVar} {
 | 
|  proc run_slave_test {} {
 | 
|    # Read global vars configuration from stdin.
 | 
|    set V [gets stdin]
 | 
| -  foreach {::TRACE ::MSVC ::DRYRUN} $V {}
 | 
| +  foreach {::TRACE ::MSVC ::DRYRUN ::KEEPFILES} $V {}
 | 
|  
 | 
|    # Read the test-suite configuration from stdin.
 | 
|    set T [gets stdin]
 | 
|    foreach {title dir configOpts testtarget makeOpts cflags opts} $T {}
 | 
|  
 | 
|    # Create and switch to the test directory.
 | 
| -  set ::env(SQLITE_TMPDIR) [file normalize $dir]
 | 
| +  set normaldir [file normalize $dir]
 | 
| +  set ::env(SQLITE_TMPDIR) $normaldir
 | 
|    trace_cmd file mkdir $dir
 | 
|    trace_cmd cd $dir
 | 
|    catch {file delete core}
 | 
| @@ -468,6 +500,9 @@ proc run_slave_test {} {
 | 
|      }
 | 
|    }
 | 
|  
 | 
| +  # Clean up lots of extra files if --keep was not specified.
 | 
| +  if {$::KEEPFILES==0} { cleanup $normaldir }
 | 
| +
 | 
|    # Exis successfully if the test passed, or with a non-zero error code
 | 
|    # otherwise.
 | 
|    exit $rc
 | 
| @@ -567,7 +602,7 @@ proc run_all_test_suites {alltests} {
 | 
|        set fd [open "|[info nameofexecutable] $script --slave" r+]
 | 
|        fconfigure $fd -blocking 0
 | 
|        fileevent $fd readable [list slave_fileevent $fd $T $tm1]
 | 
| -      puts $fd [list $::TRACE $::MSVC $::DRYRUN]
 | 
| +      puts $fd [list $::TRACE $::MSVC $::DRYRUN $::KEEPFILES]
 | 
|        puts $fd [list {*}$T]
 | 
|        flush $fd
 | 
|      }
 | 
| @@ -587,13 +622,23 @@ proc add_test_suite {listvar name testtarget config} {
 | 
|    set opts ""
 | 
|    set title ${name}($testtarget)
 | 
|    set configOpts $::WITHTCL
 | 
| +  set skip 0
 | 
|  
 | 
|    regsub -all {#[^\n]*\n} $config \n config
 | 
|    foreach arg $config {
 | 
| +    if {$skip} {
 | 
| +      set skip 0
 | 
| +      continue
 | 
| +    }
 | 
|      if {[regexp {^-[UD]} $arg]} {
 | 
|        lappend opts $arg
 | 
|      } elseif {[regexp {^[A-Z]+=} $arg]} {
 | 
|        lappend testtarget $arg
 | 
| +    } elseif {[regexp {^if:([a-z]+)(.*)} $arg all key tail]} {
 | 
| +      # Arguments of the form 'if:os=="Linux"' will cause the subsequent
 | 
| +      # argument to be skipped if the $tcl_platform(os) is not "Linux", for
 | 
| +      # example...
 | 
| +      set skip [expr !(\$::tcl_platform($key)$tail)]
 | 
|      } elseif {[regexp {^--(enable|disable)-} $arg]} {
 | 
|        if {$::MSVC} {
 | 
|          if {$arg eq "--disable-amalgamation"} {
 | 
| @@ -688,6 +733,9 @@ proc makeCommand { targets makeOpts cflags opts } {
 | 
|      set nmakeDir [file nativename $::SRCDIR]
 | 
|      set nmakeFile [file nativename [file join $nmakeDir Makefile.msc]]
 | 
|      lappend result nmake /f $nmakeFile TOP=$nmakeDir
 | 
| +    if {[regexp {USE_STDCALL=1} $cflags]} {
 | 
| +      lappend result USE_STDCALL=1
 | 
| +    }
 | 
|    } else {
 | 
|      lappend result make
 | 
|    }
 | 
| @@ -732,6 +780,8 @@ proc process_options {argv} {
 | 
|    set ::JOBS           1
 | 
|    set ::PROGRESS_MSGS  0
 | 
|    set ::WITHTCL        {}
 | 
| +  set ::FORCE          0
 | 
| +  set ::KEEPFILES      0          ;# Keep extra files after test run
 | 
|    set config {}
 | 
|    set platform $::tcl_platform(os)-$::tcl_platform(machine)
 | 
|  
 | 
| @@ -744,6 +794,12 @@ proc process_options {argv} {
 | 
|          exit
 | 
|        }
 | 
|  
 | 
| +      # Undocumented legacy option: --srcdir DIRECTORY
 | 
| +      #
 | 
| +      # DIRECTORY is the root of the SQLite checkout.  This sets the
 | 
| +      # SRCDIR global variable.  But that variable is already set
 | 
| +      # automatically so there really is no reason to have this option.
 | 
| +      #
 | 
|        -srcdir {
 | 
|          incr i
 | 
|          set ::SRCDIR [file normalize [lindex $argv $i]]
 | 
| @@ -787,6 +843,11 @@ proc process_options {argv} {
 | 
|          set ::DRYRUN 1
 | 
|        }
 | 
|  
 | 
| +      -force -
 | 
| +      -f {
 | 
| +        set ::FORCE 1
 | 
| +      }
 | 
| +
 | 
|        -trace {
 | 
|          set ::TRACE 1
 | 
|        }
 | 
| @@ -819,6 +880,10 @@ proc process_options {argv} {
 | 
|          lappend ::EXTRACONFIG [lindex $argv $i]
 | 
|        }
 | 
|  
 | 
| +      -keep {
 | 
| +        set ::KEEPFILES 1
 | 
| +      }
 | 
| +
 | 
|        -with-tcl=* {
 | 
|          set ::WITHTCL -$x
 | 
|        }
 | 
| @@ -880,6 +945,47 @@ proc process_options {argv} {
 | 
|    PUTS ""
 | 
|  }
 | 
|  
 | 
| +# Check to see if there are uncommitted changes in the SQLite source
 | 
| +# checkout.  Exit if there are.  Except:  Do nothing if the --force
 | 
| +# flag is used.  Also, ignore this test if the fossil binary is
 | 
| +# unavailable, or if the source tree is not a valid fossil checkout.
 | 
| +#
 | 
| +proc check_uncommitted {} {
 | 
| +  if {$::FORCE} return
 | 
| +  set pwd [pwd]
 | 
| +  cd $::SRCDIR
 | 
| +  if {[catch {exec fossil changes} res]==0 && [string trim $res]!=""} {
 | 
| +    puts "ERROR: The check-out contains uncommitted changes:"
 | 
| +    puts $res
 | 
| +    puts "Use the -f or --force options to override"
 | 
| +    exit 1
 | 
| +  }
 | 
| +  cd $pwd
 | 
| +}
 | 
| +
 | 
| +# A test run has just finished in directory $dir. This command deletes all
 | 
| +# non-essential files from the directory. Specifically, everything except
 | 
| +#
 | 
| +#   * The "testfixture" and "sqlite3" binaries,
 | 
| +#   * The "test-out.log" and "test.log" log files.
 | 
| +#
 | 
| +proc cleanup {dir} {
 | 
| +  set K(testfixture) 1
 | 
| +  set K(testfixture.exe) 1
 | 
| +  set K(sqlite3) 1
 | 
| +  set K(sqlite3.exe) 1
 | 
| +  set K(test-out.txt) 1
 | 
| +  set K(test.log) 1
 | 
| +
 | 
| +  foreach f [glob -nocomplain [file join $dir *]] {
 | 
| +    set tail [file tail $f]
 | 
| +    if {[info exists K($tail)]==0} { 
 | 
| +      file delete -force $f
 | 
| +    }
 | 
| +  }
 | 
| +}
 | 
| +
 | 
| +
 | 
|  # Main routine.
 | 
|  #
 | 
|  proc main {argv} {
 | 
| @@ -887,6 +993,7 @@ proc main {argv} {
 | 
|    # Process any command line options.
 | 
|    set ::EXTRACONFIG {}
 | 
|    process_options $argv
 | 
| +  if {!$::DRYRUN} check_uncommitted
 | 
|    PUTS [string repeat * 79]
 | 
|  
 | 
|    set ::NERR 0
 | 
| 
 |