Skip to content

Commit 48ae8f3

Browse files
committed
Arm backend: Improve error logging when running Corstone FVP
Instead of putting the whole FVP runtime command and log in the runtime error text only a condensed error is used, the command and the full log is outputed in the log instead. As we now always log the command and log, you can now look and compare FVP output logs also on passed test by running run pytests with "-rP". Signed-off-by: Zingo Andersen <[email protected]> Change-Id: I43ebcb235c935265ffd44fa39229e78852f2d4be
1 parent 7d4db45 commit 48ae8f3

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

backends/arm/test/runner_utils.py

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -477,10 +477,25 @@ def run_corstone(
477477
# Regex to check for error or fault messages in stdout from FVP
478478
result_stdout = result.stdout.decode()
479479
error_regex = r"(^[EF][: ].*$)|(^.*Hard fault.*$)|(^.*Assertion.*$)"
480-
if re.compile(error_regex, re.MULTILINE).search(result_stdout):
481-
raise RuntimeError(
480+
pattern = re.compile(error_regex, re.MULTILINE)
481+
regex_matches = [m.group(0) for m in pattern.finditer(result_stdout)]
482+
483+
if regex_matches:
484+
logger.error(
482485
f"Corstone simulation failed:\ncmd: {' '.join(command_args)}\nlog: \n {result_stdout}\n{result.stderr.decode()}"
483486
)
487+
# Pretty-print regex matches
488+
pretty_matches = "\n".join(f"{m.strip()}" for i, m in enumerate(regex_matches))
489+
logger.error(
490+
f"Corstone simulation failed. Problems: {len(regex_matches)} found:\n{pretty_matches}"
491+
)
492+
raise RuntimeError(
493+
f"Corstone simulation failed. Problems: {len(regex_matches)} found:\n{pretty_matches}"
494+
)
495+
else:
496+
logger.info(
497+
f"Corstone simulation:\ncmd: {' '.join(command_args)}\nlog: \n {result_stdout}\n{result.stderr.decode()}"
498+
)
484499

485500
return get_output_from_file(exported_program, intermediate_path, output_base_name)
486501

0 commit comments

Comments
 (0)