Better error handling in Hafnium tests
When the emulator crashes/times out, instead of generating a json output, hftest
crashes when a json parsing exception is thrown. This patch handles the
exception and tries to print the error it encountered instead.
Change-Id: Ice353e6a53c64ecc2cfdc8045cbde0a1fed2077d
diff --git a/test/hftest/hftest.py b/test/hftest/hftest.py
index dcb4634..8f6dc6a 100755
--- a/test/hftest/hftest.py
+++ b/test/hftest/hftest.py
@@ -205,7 +205,11 @@
full_log.write(out)
full_log.write("\r\n\r\n")
hftest_json = "\n".join(hftest_lines(out))
- tests = json.loads(hftest_json)
+ try:
+ tests = json.loads(hftest_json)
+ except ValueError:
+ print(hftest_json)
+ return 2
# Run the selected tests.
tests_run = 0
failures = 0