changeset 19871:6e74632170d3

run-tests: place the .t shell script next to $TESTTMP and with a useful name --keep can thus keep it around - very convenient for debugging.
author Mads Kiilerich <madski@unity3d.com>
date Thu, 03 Oct 2013 14:50:47 +0200
parents 055d5b3f83b1
children 681f7b9213a4
files tests/run-tests.py
diffstat 1 files changed, 12 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/tests/run-tests.py	Thu Oct 03 14:50:46 2013 +0200
+++ b/tests/run-tests.py	Thu Oct 03 14:50:47 2013 +0200
@@ -762,21 +762,19 @@
     addsalt(n + 1, False)
 
     # Write out the script and execute it
-    fd, name = tempfile.mkstemp(suffix='hg-tst')
-    try:
-        for l in script:
-            os.write(fd, l)
-        os.close(fd)
+    name = wd + '.sh'
+    f = open(name, 'w')
+    for l in script:
+        f.write(l)
+    f.close()
 
-        cmd = '%s "%s"' % (options.shell, name)
-        vlog("# Running", cmd)
-        exitcode, output = run(cmd, wd, options, replacements, env)
-        # do not merge output if skipped, return hghave message instead
-        # similarly, with --debug, output is None
-        if exitcode == SKIPPED_STATUS or output is None:
-            return exitcode, output
-    finally:
-        os.remove(name)
+    cmd = '%s "%s"' % (options.shell, name)
+    vlog("# Running", cmd)
+    exitcode, output = run(cmd, wd, options, replacements, env)
+    # do not merge output if skipped, return hghave message instead
+    # similarly, with --debug, output is None
+    if exitcode == SKIPPED_STATUS or output is None:
+        return exitcode, output
 
     # Merge the script output back into a unified test