Patchwork [2,of,2] run-tests: when interrupted report time in failure message

login
register
mail settings
Submitter Simon Heimberg
Date June 5, 2013, 9:14 p.m.
Message ID <e86d687ad178ce543d6b.1370466877@lapsi.heimberg.home>
Download mbox | patch
Permalink /patch/1703/
State Accepted
Commit f2dd00f1f6fb333b4c7f643f75b908acbb019a47
Headers show

Comments

Simon Heimberg - June 5, 2013, 9:14 p.m.
# HG changeset patch
# User Simon Heimberg <simohe@besonet.ch>
# Date 1370462729 -7200
# Node ID e86d687ad178ce543d6b263eefdcaed6ec8062bb
# Parent  227d4459ac24fc8a5083bf62a182c78f756e3bd7
run-tests: when interrupted report time in failure message

When --time is specified, the interruption message of an interrupted test is
extended with the time the test has run

INTERRUPTED: /path/to/tests/test-example.t (after 513 seconds)
Matt Mackall - June 7, 2013, 9:04 p.m.
On Wed, 2013-06-05 at 23:14 +0200, Simon Heimberg wrote:
> # HG changeset patch
> # User Simon Heimberg <simohe@besonet.ch>
> # Date 1370462729 -7200
> # Node ID e86d687ad178ce543d6b263eefdcaed6ec8062bb
> # Parent  227d4459ac24fc8a5083bf62a182c78f756e3bd7
> run-tests: when interrupted report time in failure message
> 
> When --time is specified, the interruption message of an interrupted test is
> extended with the time the test has run
> 
> INTERRUPTED: /path/to/tests/test-example.t (after 513 seconds)

These are queued, with Kevin's suggestion rolled in, thanks.

Patch

diff -r 227d4459ac24 -r e86d687ad178 tests/run-tests.py
--- a/tests/run-tests.py	Mit Jun 05 22:05:02 2013 +0200
+++ b/tests/run-tests.py	Mit Jun 05 22:05:29 2013 +0200
@@ -965,7 +965,11 @@ 
     try:
         ret, out = runner(testpath, testtmp, options, replacements, env)
     except KeyboardInterrupt:
-        log('INTERRUPTED:', testpath)
+        msg = ''
+        if options.time:
+            endtime = time.time()
+            msg = '(after %d seconds)' % (endtime - starttime)
+        log('INTERRUPTED:', testpath, msg)
         raise
     if options.time:
         endtime = time.time()