Skip to content

Commit

Permalink
add next_reboot
Browse files Browse the repository at this point in the history
  • Loading branch information
mateusz-bloch committed Jul 27, 2023
1 parent cd014a4 commit 3a47fd8
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions trunner/test_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ def run_tests(self, tests: Sequence[TestOptions]):
fail, skip = 0, 0
# Reboot is required for the initial test.
tests[0].should_reboot = True
next_reboot = False

for idx, test in enumerate(tests):
result = TestResult(test.name)
Expand Down Expand Up @@ -199,21 +200,29 @@ def set_reboot_flag(tests, idx, result):
# 2. The test has failed.
# 3. We have to enter the bootloader in order to load applications.
# 4. The test is skipped, but there should be a reboot.
nonlocal next_reboot

if idx == len(tests) - 1:
return

if (
result.is_fail()
or self.ctx.nightly
self.ctx.nightly
or (
not self.ctx.target.rootfs
and tests[idx + 1].bootloader is not None
and tests[idx + 1].bootloader.apps
)
or result.is_skip() and tests[idx].should_reboot
or result.is_skip() and next_reboot
):
tests[idx + 1].should_reboot = True

if not result.is_skip():
next_reboot = False

if result.is_fail():
tests[idx + 1].should_reboot = True
next_reboot = True

set_reboot_flag(tests, idx, result)

return fail, skip
Expand Down

0 comments on commit 3a47fd8

Please sign in to comment.