summaryrefslogtreecommitdiff
path: root/framework
diff options
context:
space:
mode:
authorU. Artie Eoff <ullysses.a.eoff@intel.com>2011-02-07 18:55:00 -0800
committerChad Versace <chad.versace@intel.com>2011-02-10 13:38:24 -0800
commit4d87ef44973e30b073f62e63ebfdd31197aaf18f (patch)
treebf509a6b7f05d5bd2a8327129353991dec2baec9 /framework
parentccdef3127a815fa5cc7cb6e5686a9f0f4a7e4d9c (diff)
Add SyncFileWriter for write/close synchronization on results file.
Add SyncFileWriter class to synchronize writes to the 'main' results file from multiple threads. This helps to ensure that writes to this file are not intermingled.
Diffstat (limited to 'framework')
-rw-r--r--framework/core.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/framework/core.py b/framework/core.py
index 0e0aca99..ce388aa8 100644
--- a/framework/core.py
+++ b/framework/core.py
@@ -123,8 +123,7 @@ class TestResult(dict):
else:
print >> result, k + ": " + encode(str(v))
print >> result, "!"
- print >> file, result.getvalue(),
-
+ file.write(result.getvalue())
class GroupResult(dict):
def __init__(self, *args):
@@ -282,9 +281,9 @@ class Environment:
def collectData(self):
if platform.system() != 'Windows':
- print >>self.file, "glxinfo:", '@@@' + encode(self.run('glxinfo'))
+ self.file.write("glxinfo:", '@@@' + encode(self.run('glxinfo')), "\n")
if platform.system() == 'Linux':
- print >>self.file, "lspci:", '@@@' + encode(self.run('lspci'))
+ self.file.write("lspci:", '@@@' + encode(self.run('lspci')), "\n")
class Test:
@@ -343,7 +342,7 @@ class Test:
if Test.sleep:
time.sleep(Test.sleep)
else:
- print "Dry-run: %(path)s" % locals()
+ status("dry-run")
# Returns True iff the given error message should be ignored
def isIgnored(self, error):
@@ -389,7 +388,7 @@ class TestProfile:
self.tests.doRun(env, '')
ThreadPools().joinAll()
time_end = time.time()
- print >>env.file, "time:",(time_end-time_start)
+ env.file.write("time:", time_end-time_start, "\n")
#############################################################################
##### Loaders