mirror of
https://gitea.osmocom.org/sim-card/pysim.git
synced 2026-03-16 18:38:32 +03:00
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
This commit is contained in:
@@ -265,11 +265,9 @@ class UnittestUtils(unittest.TestCase):
|
||||
# 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 @@ class UnittestUtils(unittest.TestCase):
|
||||
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 != []:
|
||||
|
||||
Reference in New Issue
Block a user