sw:vec: test_runner: grab elf return code
Grab the return code from the log string. Ideally we would like to grab
the result from CSR or a register, but QEMU doesn't have the register
access hooked up. :(
With this change, test_runner.py will tunnel the main return code, and
can be used in CI or ctest.
Change-Id: I6dfbf9cb1b4f4911bcfb230936c67f255178ee7c
diff --git a/scripts/test_runner.py b/scripts/test_runner.py
index f603d40..f9e3c72 100755
--- a/scripts/test_runner.py
+++ b/scripts/test_runner.py
@@ -129,6 +129,12 @@
failure_strings = ["FAILED", "Exception occurred"]
if any(x in output for x in failure_strings):
sys.exit(1)
+ # Grab the return code from the output string with regex
+ # Syntax: "main returned: ", <code> (<hex_code>)
+ return_string = re.compile(
+ r"\"main returned:\s\",(?P<ret_code>\s[0-9]+\s*)")
+ code = return_string.search(output)
+ sys.exit(int(code.group(1)))
if __name__ == "__main__":