diff --git a/psh/test.yaml b/psh/test.yaml index 396f0d48d..89ab3a263 100644 --- a/psh/test.yaml +++ b/psh/test.yaml @@ -6,6 +6,7 @@ test: tests: - name: gibber harness: test-gibber.py + reboot: True - name: auth harness: test-auth.py diff --git a/trunner/config.py b/trunner/config.py index ae2ca46e1..a3c44058f 100644 --- a/trunner/config.py +++ b/trunner/config.py @@ -43,6 +43,7 @@ class ConfigParser: class MainConfig: targets: Optional[Set] = None type: Optional[str] = None + should_reboot: bool = False ignore: bool = False nightly: bool = False @@ -169,6 +170,14 @@ def _parse_shell_command(self, config: dict): cmd=parsed_cmd, ) + def _parse_reboot(self, config: dict) -> None: + should_reboot = config.get("reboot", self.main.should_reboot) + + if not isinstance(should_reboot, bool): + raise ParserError(f"reboot must be a boolean value (true/false) not {should_reboot}") + + self.test.should_reboot = should_reboot + def _parse_ignore(self, config: dict) -> None: ignore = config.get("ignore", self.main.ignore) @@ -248,6 +257,7 @@ def _parse_config(self, config: dict): if self.test.ignore: return + self._parse_reboot(config) self._parse_shell_command(config) self._parse_load(config) self._parse_kwargs(config) diff --git a/trunner/test_runner.py b/trunner/test_runner.py index b69a08a83..b6d3ae7ff 100644 --- a/trunner/test_runner.py +++ b/trunner/test_runner.py @@ -198,8 +198,6 @@ def set_reboot_flag(tests, idx, result): if idx == len(tests) - 1: return - tests[idx + 1].should_reboot = False - if result.is_skip(): tests[idx + 1].should_reboot = tests[idx].should_reboot diff --git a/trunner/types.py b/trunner/types.py index 09a127ce5..c66ea317e 100644 --- a/trunner/types.py +++ b/trunner/types.py @@ -208,7 +208,7 @@ class TestOptions: target: Optional[str] = None bootloader: Optional[BootloaderOptions] = None shell: Optional[ShellOptions] = None - should_reboot: bool = True + should_reboot: bool = False ignore: bool = False nightly: bool = False kwargs: Dict = field(default_factory=dict)