diff options
author | Nicolai Haehnle <nhaehnle@gmail.com> | 2008-09-28 17:39:54 +0200 |
---|---|---|
committer | Nicolai Haehnle <nhaehnle@gmail.com> | 2008-09-28 17:39:54 +0200 |
commit | 3f0804af2fbe826b1cf305b8ed2ae047e76125bf (patch) | |
tree | 2d60a203d2ba6616ba22acdefa9107577faffeaa /framework | |
parent | a6ee98404fbe63d19d9097641497d9e52e3d45e0 (diff) |
Measure time taken for tests
Diffstat (limited to 'framework')
-rw-r--r-- | framework/core.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/framework/core.py b/framework/core.py index 8d6482e0..3b87e8d3 100644 --- a/framework/core.py +++ b/framework/core.py @@ -160,7 +160,7 @@ class GroupResult(dict): class TestrunResult: def __init__(self, *args): self.name = '' - self.globalkeys = ['name', 'href', 'glxinfo', 'lspci'] + self.globalkeys = ['name', 'href', 'glxinfo', 'lspci', 'time'] self.results = GroupResult() def allTestResults(self): @@ -292,7 +292,11 @@ class Test: if env.execute: try: print "Test: %(path)s" % locals() + time_start = time.time() result = self.run() + time_end = time.time() + if 'time' not in result: + result['time'] = time_end - time_start if 'result' not in result: result['result'] = 'fail' if not isinstance(result, TestResult): @@ -353,7 +357,10 @@ class TestProfile: self.sleep = 0 def run(self, env): + time_start = time.time() self.tests.doRun(env, '') + time_end = time.time() + print >>env.file, "time:",(time_end-time_start) ############################################################################# ##### Loaders |