changeset 6208:c88b9e597588

tests: add --keep-tmp to run-tests.py to debug test environment When set, you can find the working dir of the test run as a uniquely named subdirectory of --tmpdir so you can inspect it.
author Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
date Wed, 05 Mar 2008 08:00:05 +0100
parents 03b13d853dc6
children 4e8cd15240bf
files tests/run-tests.py
diffstat 1 files changed, 8 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/tests/run-tests.py	Wed Mar 05 09:20:57 2008 -0800
+++ b/tests/run-tests.py	Wed Mar 05 08:00:05 2008 +0100
@@ -38,6 +38,8 @@
     help="prompt to accept changed output")
 parser.add_option("-j", "--jobs", type="int",
     help="number of jobs to run in parallel")
+parser.add_option("--keep-tmpdir", action="store_true",
+    help="keep temporary directory after running tests (best used with --tmpdir)")
 parser.add_option("-R", "--restart", action="store_true",
     help="restart at last error")
 parser.add_option("-p", "--port", type="int",
@@ -133,9 +135,10 @@
             print "WARNING: Did not find prerequisite tool: "+p
 
 def cleanup_exit():
-    if verbose:
-        print "# Cleaning up HGTMP", HGTMP
-    shutil.rmtree(HGTMP, True)
+    if not options.keep_tmpdir:
+        if verbose:
+            print "# Cleaning up HGTMP", HGTMP
+        shutil.rmtree(HGTMP, True)
 
 def use_correct_python():
     # some tests run python interpreter. they must use same
@@ -398,7 +401,8 @@
         pass
 
     os.chdir(TESTDIR)
-    shutil.rmtree(tmpd, True)
+    if not options.keep_tmpdir:
+	    shutil.rmtree(tmpd, True)
     if skipped:
         return None
     return ret == 0