sanitycheck: return build.log when we think we crashed

In some cases sanitycheck handles a build error that started with 'make
run' as a handler crash when it actually failed during building. Right
now we try to attach the handler.log to the XML output even if it did
not exist. Check for the file and if it was not found, go back to the
build.log

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit is contained in:
Anas Nashif 2019-02-05 07:38:32 -05:00
parent d75495709d
commit c96c90acf7

View file

@ -2382,11 +2382,16 @@ class TestSuite:
message=goal.reason)
p = ("%s/%s/%s" % (options.outdir, i.platform.name, i.test.name))
bl = os.path.join(p, "build.log")
hl = os.path.join(p, "handler.log")
log_file = bl
if goal.reason != 'build_error':
bl = os.path.join(p, "handler.log")
if os.path.exists(hl):
log_file = hl
else:
log_file = bl
if os.path.exists(bl):
with open(bl, "rb") as f:
if os.path.exists(log_file):
with open(log_file, "rb") as f:
log = f.read().decode("utf-8")
filtered_string = ''.join(filter(lambda x: x in string.printable, log))
failure.text = filtered_string