[commit: testsuite] master: Test driver: Print total time spent at the end (472075f)

git at git.haskell.org git at git.haskell.org
Fri Sep 20 13:16:57 CEST 2013


Repository : ssh://git@git.haskell.org/testsuite

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/472075f758c753ac410f25ddc5347d86d96ac254/testsuite

>---------------------------------------------------------------

commit 472075f758c753ac410f25ddc5347d86d96ac254
Author: Joachim Breitner <mail at joachim-breitner.de>
Date:   Fri Sep 20 13:16:53 2013 +0200

    Test driver: Print total time spent at the end


>---------------------------------------------------------------

472075f758c753ac410f25ddc5347d86d96ac254
 driver/runtests.py    |    7 ++-----
 driver/testglobals.py |    2 +-
 driver/testlib.py     |    7 ++++++-
 3 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/driver/runtests.py b/driver/runtests.py
index 1b8ddb1..f4a28b9 100644
--- a/driver/runtests.py
+++ b/driver/runtests.py
@@ -232,12 +232,9 @@ print 'Found', len(t_files), '.T files...'
 t = getTestRun()
 
 # Avoid cmd.exe built-in 'date' command on Windows
-if not windows:
-    t.start_time = chop(os.popen('date').read())
-else:
-    t.start_time = 'now'
+t.start_time = time.localtime()
 
-print 'Beginning test run at', t.start_time
+print 'Beginning test run at', time.strftime("%c %Z",t.start_time)
 
 # set stdout to unbuffered (is this the best way to do it?)
 sys.stdout.flush()
diff --git a/driver/testglobals.py b/driver/testglobals.py
index a959557..686fd1d 100644
--- a/driver/testglobals.py
+++ b/driver/testglobals.py
@@ -123,7 +123,7 @@ def getConfig():
 
 class TestRun:
    def __init__(self):
-       self.start_time = ''
+       self.start_time = None
        self.total_tests = 0
        self.total_test_cases = 0
        self.n_framework_failures = 0
diff --git a/driver/testlib.py b/driver/testlib.py
index d9a4905..a163f00 100644
--- a/driver/testlib.py
+++ b/driver/testlib.py
@@ -12,6 +12,8 @@ import errno
 import string
 import re
 import traceback
+import time
+import datetime
 import copy
 import glob
 import types
@@ -2114,7 +2116,10 @@ def summary(t, file):
     file.write('\n')
     printUnexpectedTests(file, [t.unexpected_passes, t.unexpected_failures])
     file.write('OVERALL SUMMARY for test run started at '
-               + t.start_time + '\n'
+               + time.strftime("%c %Z", t.start_time) + '\n'
+               + string.rjust(str(datetime.timedelta(seconds=
+                    round(time.time() - time.mktime(t.start_time)))), 8)
+               + ' spent to go through\n'
                + string.rjust(`t.total_tests`, 8)
                + ' total tests, which gave rise to\n'
                + string.rjust(`t.total_test_cases`, 8)




More information about the ghc-commits mailing list