tests/run-tests.py
changeset 1271 181e420ff0ac
parent 1270 79e0df6ffaad
child 1272 4a224ed7e923
--- a/tests/run-tests.py	Thu Jun 06 22:36:18 2013 +0100
+++ b/tests/run-tests.py	Sat Jun 08 13:46:05 2013 +0100
@@ -256,10 +256,6 @@
             sys.stderr.write(
                 'warning: --timeout option ignored with --debug\n')
         options.timeout = 0
-        if options.time:
-            sys.stderr.write(
-                'warning: --time option ignored with --debug\n')
-        options.time = False
     if options.py3k_warnings:
         if sys.version_info[:2] < (2, 6) or sys.version_info[:2] >= (3, 0):
             parser.error('--py3k-warnings can only be used on Python 2.6+')
@@ -333,7 +329,7 @@
 
 def createhgrc(path, options):
     # create a fresh hgrc
-    hgrc = open(path, 'w+')
+    hgrc = open(path, 'w')
     hgrc.write('[ui]\n')
     hgrc.write('slash = True\n')
     hgrc.write('interactive = False\n')
@@ -960,12 +956,15 @@
     env = createenv(options, testtmp, threadtmp, port)
     createhgrc(env['HGRCPATH'], options)
 
-    if options.time:
-        starttime = time.time()
-    ret, out = runner(testpath, testtmp, options, replacements, env)
-    if options.time:
+    starttime = time.time()
+    try:
+        ret, out = runner(testpath, testtmp, options, replacements, env)
+    except KeyboardInterrupt:
         endtime = time.time()
-        times.append((test, endtime - starttime))
+        log('INTERRUPTED: %s (after %d seconds)' % (test, endtime - starttime))
+        raise
+    endtime = time.time()
+    times.append((test, endtime - starttime))
     vlog("# Ret was:", ret)
 
     killdaemons(env['DAEMON_PIDS'])