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 14, 2024
1 parent 9909031 commit 1827ab4
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 @@ -366,10 +366,10 @@ def pytest_run(self, timeout):
self.status = TwisterStatus.FAIL
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 1827ab4

Please sign in to comment.