Skip to content

Commit

Permalink
[chiptests] Check the exit code of the subprocesses and raise a failu…
Browse files Browse the repository at this point in the history
…re if the exit code is not 0 AND if the process was responding (we ignore cases where the process is stuck)
  • Loading branch information
vivien-apple committed Sep 30, 2024
1 parent b7b429e commit eb12b29
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion scripts/tests/chiptest/test_definition.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,15 @@ def __terminateProcess(self):
if self.process:
self.process.terminate() # sends SIGTERM
try:
self.process.wait(10)
exit_code = self.process.wait(10)
if exit_code:
raise Exception('Subprocess failed with exit code: %d' % exit_code)
except subprocess.TimeoutExpired:
logging.debug('Subprocess did not terminate on SIGTERM, killing it now')
self.process.kill()
# The exit code when using Python subprocess will be the signal used to kill it.
# Ideally, we would recover the original exit code, but the process was already
# ignoring SIGTERM, indicating something was already wrong.
self.process.wait(10)
self.process = None
self.outpipe = None
Expand Down

0 comments on commit eb12b29

Please sign in to comment.