Commit 9640d0fe authored by Kirill Smelkov's avatar Kirill Smelkov

Fix status to be always defined

Previously, if --master_url was not provided, the program would crash
with UnboundLocalError for status, since for that case list of tests was
empty. Fix it by moving status initialization higher by one level.

See next patch where we'll add meaning for nxdtest run with no
--master_url set.
parent f9a78f97
......@@ -140,6 +140,15 @@ def main():
t = tenv.byname[test_result_line.name]
tstart = time()
# default status dict
status = {
'test_count': 1,
'error_count': 0,
'failure_count': 0,
'skip_count': 0,
#html_test_result
}
try:
# Run t.argv in t.kw['env'] environment.
# In addition to kw['env'], kw['envadj'] allows users to define
......@@ -155,7 +164,7 @@ def main():
except:
stdout, stderr = '', traceback.format_exc()
sys.stderr.write(stderr)
ok = False
status['error_count'] += 1
else:
# tee >stdout,stderr so we can also see in testnode logs
# (explicit teeing instead of p.communicate() to be able to see incremental progress)
......@@ -169,16 +178,9 @@ def main():
tout.join(); stdout = ''.join(buf_out)
terr.join(); stderr = ''.join(buf_err)
p.wait()
ok = (p.returncode == 0)
# default status dict just by exit code
status = {
'test_count': 1,
'error_count': (0 if ok else 1),
'failure_count': 0,
'skip_count': 0,
#html_test_result
}
if p.returncode != 0:
status['error_count'] += 1
# postprocess output, if we can
if t.summaryf is not 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