Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions doc/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
11 changes: 10 additions & 1 deletion labgrid/strategy/bareboxstrategy.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__()
Expand Down Expand Up @@ -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}"
Expand Down
11 changes: 10 additions & 1 deletion labgrid/strategy/shellstrategy.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__()
Expand All @@ -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}"
Expand Down
11 changes: 10 additions & 1 deletion labgrid/strategy/ubootstrategy.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__()
Expand Down Expand Up @@ -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
Expand Down