mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-31 14:25:49 +00:00
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: Pavel Emelyanov <xemul@parallels.com> Acked-by: Andrew Vagin <avagin@virtuozzo.com>
This commit is contained in:
19
test/zdtm.py
19
test/zdtm.py
@@ -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
|
||||
|
Reference in New Issue
Block a user