Skip to content

Commit

Permalink
Handle exceptions that occur while doing comparison
Browse files Browse the repository at this point in the history
Signed-off-by: mulhern <[email protected]>
  • Loading branch information
mulkieran committed Jul 2, 2024
1 parent b2cb358 commit 38197f5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
6 changes: 5 additions & 1 deletion scripts/monitor_dbus_signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -731,7 +731,11 @@ def _check():
print(os.linesep.join(_CALLBACK_ERRORS))
sys.exit(3)

result = _check()
try:
result = _check()
except Exception as exco: # pylint: disable=broad-except
print(f"{exco}")
sys.exit(4)

assert isinstance(result, list)
if not result:
Expand Down
7 changes: 7 additions & 0 deletions testlib/infra.py
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,13 @@ def run_check(self, stop_time):
f'stdout: {stdoutdata.decode("utf-8")}'
)

if self.trace.returncode == 4:
raise RuntimeError(
"Failure while comparing D-Bus states: "
f'stderr: {stderrdata.decode("utf-8")}, '
f'stdout: {stdoutdata.decode("utf-8")}'
)

msg = stdoutdata.decode("utf-8")
self.assertEqual(
self.trace.returncode,
Expand Down

0 comments on commit 38197f5

Please sign in to comment.