diff --git a/manifest b/manifest
index 695a399135..937b016c05 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Changes\sto\sgive\sa\swarning-free\sbuild\swith\sSQLITE_OMIT_INCRBLOB\sand\nSQLITE_OMIT_SHARED_CACHE.
-D 2016-09-10T19:51:40.868
+C Have\sreleasetest.tcl\sdelete\sall\stest\sfiles\sexcept\sfor\s"testfixture",\s"testfixture.exe",\s"sqlite3",\s"sqlite3.exe",\s"test.log"\sand\s"test-out.txt"\safter\seach\stest\srun\sis\sfinished.\sPassing\sthe\s"--keep"\soption\srestores\sthe\sold\sbehaviour.
+D 2016-09-12T09:28:21.479
 F Makefile.in 6fd48ffcf7c2deea7499062d1f3747f986c19678
 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
 F Makefile.msc e1aa788e84f926e42239ee167c53f785bedacacd
@@ -1015,7 +1015,7 @@ F test/rdonly.test 64e2696c322e3538df0b1ed624e21f9a23ed9ff8
 F test/regexp1.test 497ea812f264d12b6198d6e50a76be4a1973a9d8
 F test/regexp2.test aa7ffcc21350007a78361b82bcf3b74d12227144
 F test/reindex.test 44edd3966b474468b823d481eafef0c305022254
-F test/releasetest.tcl ce72fb81a76beb81dab4d83e20ada2d68a078361 x
+F test/releasetest.tcl cb06c4df0de4872e65b178316f8a87ccf7624d59 x
 F test/resolver01.test f4022acafda7f4d40eca94dbf16bc5fc4ac30ceb
 F test/rollback.test 458fe73eb3ffdfdf9f6ba3e9b7350a6220414dea
 F test/rollback2.test 8435d6ff0f13f51d2a4181c232e706005fa90fc5
@@ -1525,7 +1525,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
 F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
 F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P 8a9d128119fde36c175735be56876d30e5c8586f
-R 2ee1cf2f5a2187396df115af39b9bf82
-U drh
-Z cef02d90fc649c97d5e20753bc980470
+P 711c59171b22df04224183a713e6c36e0bb3bba8
+R 37a1645525cbcb2689722b270f6e3aaf
+U dan
+Z e67cc646551efb1e3646dc171a703649
diff --git a/manifest.uuid b/manifest.uuid
index 5896145178..ac97cfec54 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-711c59171b22df04224183a713e6c36e0bb3bba8
\ No newline at end of file
+e0e042dca98f29c060f76db079afecb3200ffae5
\ No newline at end of file
diff --git a/test/releasetest.tcl b/test/releasetest.tcl
index 82d695b038..99823e3b1c 100755
--- a/test/releasetest.tcl
+++ b/test/releasetest.tcl
@@ -15,6 +15,7 @@ optional) are:
     -f|--force                         (Run even if uncommitted changes)
     --info                             (Show diagnostic info)
     --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)
@@ -467,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}
@@ -498,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
@@ -597,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
     }
@@ -776,6 +781,7 @@ proc process_options {argv} {
   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)
 
@@ -874,6 +880,10 @@ proc process_options {argv} {
         lappend ::EXTRACONFIG [lindex $argv $i]
       }
 
+      -keep {
+        set ::KEEPFILES 1
+      }
+
       -with-tcl=* {
         set ::WITHTCL -$x
       }
@@ -953,6 +963,28 @@ proc check_uncommitted {} {
   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.
 #