diff --git a/doc/configuration.rst b/doc/configuration.rst index d93e58c90..53647fbb4 100644 --- a/doc/configuration.rst +++ b/doc/configuration.rst @@ -3458,6 +3458,11 @@ the "shell" state: This command would transition from the bootloader into a Linux shell and activate the `ShellDriver`_. +Arguments: + - wait_for_systemd (bool, default=True): If True, wait for all systemd services + to be up and running when transitioning to the "shell" state + - systemd_timeout (int, default=30): Timeout to wait for systemd services in seconds + ShellStrategy ~~~~~~~~~~~~~ A :any:`ShellStrategy` has three states: @@ -3504,6 +3509,11 @@ the "shell" state: This command would transition directly into a Linux shell and activate the `ShellDriver`_. +Arguments: + - wait_for_systemd (bool, default=True): If True, wait for all systemd services + to be up and running when transitioning to the "shell" state + - systemd_timeout (int, default=30): Timeout to wait for systemd services in seconds + UBootStrategy ~~~~~~~~~~~~~ A :any:`UBootStrategy` has four states: @@ -3553,6 +3563,11 @@ the "shell" state: This command would transition from the bootloader into a Linux shell and activate the `ShellDriver`_. +Arguments: + - wait_for_systemd (bool, default=True): If True, wait for all systemd services + to be up and running when transitioning to the "shell" state + - systemd_timeout (int, default=30): Timeout to wait for systemd services in seconds + DockerStrategy ~~~~~~~~~~~~~~ A :any:`DockerStrategy` has three states: diff --git a/labgrid/strategy/bareboxstrategy.py b/labgrid/strategy/bareboxstrategy.py index 8cae9eb6a..c2533e19d 100644 --- a/labgrid/strategy/bareboxstrategy.py +++ b/labgrid/strategy/bareboxstrategy.py @@ -26,6 +26,14 @@ class BareboxStrategy(Strategy): } status = attr.ib(default=Status.unknown) + wait_for_systemd = attr.ib( + default=True, + validator=attr.validators.optional(attr.validators.instance_of(bool)) + ) + systemd_timeout = attr.ib( + default=30, + validator=attr.validators.optional(attr.validators.instance_of(int)) + ) def __attrs_post_init__(self): super().__attrs_post_init__() @@ -57,7 +65,8 @@ def transition(self, status, *, step): # pylint: disable=redefined-outer-name self.barebox.boot("") self.barebox.await_boot() self.target.activate(self.shell) - self.shell.run("systemctl is-system-running --wait") + if self.wait_for_systemd: + self.shell.run("systemctl is-system-running --wait", timeout=self.systemd_timeout) else: raise StrategyError( f"no transition found from {self.status} to {status}" diff --git a/labgrid/strategy/shellstrategy.py b/labgrid/strategy/shellstrategy.py index 0f2c7ed7a..a6cf5ca81 100644 --- a/labgrid/strategy/shellstrategy.py +++ b/labgrid/strategy/shellstrategy.py @@ -24,6 +24,14 @@ class ShellStrategy(Strategy): } status = attr.ib(default=Status.unknown) + wait_for_systemd = attr.ib( + default=True, + validator=attr.validators.optional(attr.validators.instance_of(bool)) + ) + systemd_timeout = attr.ib( + default=30, + validator=attr.validators.optional(attr.validators.instance_of(int)) + ) def __attrs_post_init__(self): super().__attrs_post_init__() @@ -47,7 +55,8 @@ def transition(self, status, *, step): # pylint: disable=redefined-outer-name self.target.activate(self.console) self.power.cycle() self.target.activate(self.shell) - self.shell.run("systemctl is-system-running --wait") + if self.wait_for_systemd: + self.shell.run("systemctl is-system-running --wait", timeout=self.systemd_timeout) else: raise StrategyError( f"no transition found from {self.status} to {status}" diff --git a/labgrid/strategy/ubootstrategy.py b/labgrid/strategy/ubootstrategy.py index 8cbafc452..94cc3572d 100644 --- a/labgrid/strategy/ubootstrategy.py +++ b/labgrid/strategy/ubootstrategy.py @@ -25,6 +25,14 @@ class UBootStrategy(Strategy): } status = attr.ib(default=Status.unknown) + wait_for_systemd = attr.ib( + default=True, + validator=attr.validators.optional(attr.validators.instance_of(bool)) + ) + systemd_timeout = attr.ib( + default=30, + validator=attr.validators.optional(attr.validators.instance_of(int)) + ) def __attrs_post_init__(self): super().__attrs_post_init__() @@ -54,7 +62,8 @@ def transition(self, status): self.uboot.boot("") self.uboot.await_boot() self.target.activate(self.shell) - self.shell.run("systemctl is-system-running --wait") + if self.wait_for_systemd: + self.shell.run("systemctl is-system-running --wait", timeout=self.systemd_timeout) else: raise StrategyError(f"no transition found from {self.status} to {status}") self.status = status