dexter submitted this change.
pySim-shell_test/utils: print logfile on all types of errors
When pySim-shell has problems starting up, it exits with an error
code. This is detected by the testsuite, but it also causes an
early exit, so that the log file content are not printed.
Change-Id: Ic0f34eda32a7c557810abcb05a84e343741fdb8a
---
M tests/pySim-shell_test/utils.py
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/tests/pySim-shell_test/utils.py b/tests/pySim-shell_test/utils.py
index 348c9b1..c3cf7a2 100644
--- a/tests/pySim-shell_test/utils.py
+++ b/tests/pySim-shell_test/utils.py
@@ -265,11 +265,9 @@
# Execute commandline
cmdline += " > " + logfile_name + " 2>&1"
print("Executing: " + cmdline)
- rc = os.system(cmdline)
- if rc:
- raise RuntimeError("pySim-shell exits with error code %u" % rc)
+ py_sim_shell_rc = os.system(cmdline)
- # Check for exceptions
+ # Read logfile
logfile = open(logfile_name)
logfile_content = logfile.read()
if self.print_content:
@@ -278,6 +276,12 @@
print(logfile_content)
print("-----------------------8<-----------------------")
logfile.close()
+
+ # Exit early in case pySim-shell ran into a fundamental error
+ if py_sim_shell_rc:
+ raise RuntimeError("pySim-shell exits with error code %u" % py_sim_shell_rc)
+
+ # Check log for exceptions
exception_regex_compiled = re.compile('.*EXCEPTION.*')
exceptions_strings = re.findall(exception_regex_compiled, logfile_content)
if exceptions_strings != []:
To view, visit change 38603. To unsubscribe, or for help writing mail filters, visit settings.