Commit a129b560 authored by Jérome Perrin's avatar Jérome Perrin

Flush output right after printing running test name

If test program output on stderr (which is unbuffered), the
output of the test program will appear before output from nxdtest
advertising the program that is about to be executed, because nxdtest
stdout is buffered (testnode does not set PYTHONUNBUFFERED, and eventhough
nxdtest sets PYTHONUNBUFFERED in its own environ, this only applies to sub
parent bca50060
......@@ -101,6 +101,12 @@ class TestEnv:
self.byname[name] = t
def emit(*message):
"""Emit a message on stdout and flush output.
def main():
# testnode executes us giving URL to master results collecting instance and other details
......@@ -136,7 +142,7 @@ def main():
# --list
if args.list:
for t in tenv.testv:
# master_url provided -> run tests under master control
......@@ -185,8 +191,8 @@ def main():
t = tenv.byname[]
tstart = time()
print('\n>>> %s' %
print('$ %s' % t.command_str())
emit('\n>>> %s' %
emit('$ %s' % t.command_str())
# default status dict
status = {
......@@ -256,7 +262,7 @@ def main():
print(_test_result_summary(, tres))
emit(_test_result_summary(, tres))
# tee, similar to tee(1) utility, copies data from fin to fout appending them to buf.
......@@ -304,11 +310,11 @@ def _test_result_summary(name, kw):
# system_info prints information about local computer.
def system_info():
print('date:\t%s' % (strftime("%a, %d %b %Y %H:%M:%S %Z", localtime())))
emit('date:\t%s' % (strftime("%a, %d %b %Y %H:%M:%S %Z", localtime())))
whoami = pwd.getpwuid(os.getuid()).pw_name
print('xnode:\t%s@%s' % (whoami, socket.getfqdn()))
print('uname:\t%s' % ' '.join(os.uname()))
print('cpu:\t%s' % get1('/proc/cpuinfo', 'model name'))
emit('xnode:\t%s@%s' % (whoami, socket.getfqdn()))
emit('uname:\t%s' % ' '.join(os.uname()))
emit('cpu:\t%s' % get1('/proc/cpuinfo', 'model name'))
# get1 returns first entry from file @path prefixed with ^<field>\s*:
def get1(path, field, default=None):
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