run-tests: remove files that we potentially create outside of $TMPDIR stable
authorSean Farley <sean.michael.farley@gmail.com>
Fri, 15 Nov 2013 22:57:11 -0500
branchstable
changeset 1305 d8b739c3d37a
parent 1304 366b3a1bfea9
child 1306 c8f3a433abe6
child 1307 164ed9bf157c
run-tests: remove files that we potentially create outside of $TMPDIR [ original upstream message ]
tests/run-tests.py
--- a/tests/run-tests.py	Fri Nov 15 22:56:08 2013 -0500
+++ b/tests/run-tests.py	Fri Nov 15 22:57:11 2013 -0500
@@ -103,6 +103,7 @@
 
 requiredtools = [os.path.basename(sys.executable), "diff", "grep", "unzip",
                  "gunzip", "bunzip2", "sed"]
+createdfiles = []
 
 defaults = {
     'jobs': ('HGTEST_JOBS', 1),
@@ -420,6 +421,11 @@
     if not options.keep_tmpdir:
         vlog("# Cleaning up HGTMP", HGTMP)
         shutil.rmtree(HGTMP, True)
+        for f in createdfiles:
+            try:
+                os.remove(f)
+            except OSError:
+                pass
 
 def usecorrectpython():
     # some tests run python interpreter. they must use same
@@ -439,6 +445,7 @@
         if findprogram(pyexename) != sys.executable:
             try:
                 os.symlink(sys.executable, mypython)
+                createdfiles.append(mypython)
             except OSError, err:
                 # child processes may race, which is harmless
                 if err.errno != errno.EEXIST: