Commit dc3b525c authored by Pavel Emelyanov's avatar Pavel Emelyanov

zdtm.py: Print test output on screen when possible

Right now zdtm spawns test into a pseudo-container and redirects its
output in a temp file. This is done not to mix outputs of tests, running
in parallel, with each other.

But if we run tests one by one or there's only one test in the list
we can safely print the output right on the screen.
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
Acked-by: 's avatarAndrew Vagin <avagin@virtuozzo.com>
parent b94119b0
......@@ -816,11 +816,18 @@ class launcher:
nd = ('nocr', 'norst', 'pre', 'iters', 'page_server', 'sibling', \
'fault', 'keep_img', 'report', 'snaps', 'sat', 'dedup')
arg = repr((name, desc, flavor, { d: self.__opts[d] for d in nd }))
log = name.replace('/', '_') + ".log"
if self.__max > 1 and self.__total > 1:
logf = name.replace('/', '_') + ".log"
log = open(logf, "w")
else:
logf = None
log = None
sub = subprocess.Popen(["./zdtm_ct", "zdtm.py"], \
env = dict(os.environ, CR_CT_TEST_INFO = arg ), \
stdout = open(log, "w"), stderr = subprocess.STDOUT)
self.__subs[sub.pid] = { 'sub': sub, 'log': log }
stdout = log, stderr = subprocess.STDOUT)
self.__subs[sub.pid] = { 'sub': sub, 'log': logf }
if test_flag(desc, 'excl'):
self.wait()
......@@ -833,8 +840,10 @@ class launcher:
self.__fail = True
add_to_report(sub['log'], "output")
print open(sub['log']).read()
os.unlink(sub['log'])
if sub['log']:
print open(sub['log']).read()
os.unlink(sub['log'])
return True
return False
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment