dexter has submitted this change. ( https://gerrit.osmocom.org/c/pysim/+/38603?usp=email )
Change subject: pySim-shell_test/utils: print logfile on all types of errors ......................................................................
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(-)
Approvals: Jenkins Builder: Verified fixeria: Looks good to me, approved laforge: Looks good to me, but someone else must approve
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 != []: