Skip to content

Commit

Permalink
twister: PyTest plugin's DUT release sequence change
Browse files Browse the repository at this point in the history
Change Twister PyTest plugin's test finalizing sequence to release
the DUT it is used as the very last operation, after the Test Instance
status becomes fully updated from the execution results.

This also fix a race condition possible when pytest plugin releases
the DUT and it becomes acquired by another test while the current test
is not yet finalized completely.

Signed-off-by: Dmitrii Golovanov <[email protected]>
  • Loading branch information
golowanow committed Aug 1, 2024
1 parent 3e11059 commit 9b9a000
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions scripts/pylib/twister/twisterlib/harness.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,10 +350,10 @@ def pytest_run(self, timeout):
self.state = 'failed'
self.instance.reason = str(pytest_exception)
finally:
self.instance.record(self.recording)
self._update_test_status()
if self.reserved_dut:
self.instance.handler.make_dut_available(self.reserved_dut)
self.instance.record(self.recording)
self._update_test_status()

def generate_command(self):
config = self.instance.testsuite.harness_config
Expand Down

0 comments on commit 9b9a000

Please sign in to comment.