Skip to content

Commit 72ff289

Browse files
committed
tests/test_bareboxdriver.py: Add barebox boot test
Add 'test_barebox_boot' test to meet code coverage and maintain related documentation Signed-off-by: Fabian Meuren <[email protected]>
1 parent 7729b2d commit 72ff289

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

doc/configuration.rst

+1
Original file line numberDiff line numberDiff line change
@@ -1595,6 +1595,7 @@ Arguments:
15951595
- bootstring (regex, default="Linux version \\d"): regex that indicating that the Linux Kernel is
15961596
booting
15971597
- password (str): optional, password to use for access to the shell
1598+
- boot_command (str, default="boot -v"): optional, boot command to boot target
15981599
- login_timeout (int, default=60): timeout for access to the shell
15991600

16001601
ExternalConsoleDriver

labgrid/driver/bareboxdriver.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class BareboxDriver(CommandMixin, Driver, CommandProtocol, LinuxBootProtocol):
2929
interrupt (str): optional, string to interrupt autoboot (use "\x03" for CTRL-C)
3030
bootstring (regex): optional, regex indicating that the Linux Kernel is booting
3131
password (str): optional, password to use for access to the shell
32-
boot_command (str): optional boot command to boot target
32+
boot_command (str): optional, boot command to boot target
3333
login_timeout (int): optional, timeout for access to the shell
3434
"""
3535
bindings = {"console": ConsoleProtocol, }
@@ -200,7 +200,7 @@ def await_boot(self):
200200
self.console.expect(self.bootstring)
201201

202202
@Driver.check_active
203-
def boot(self, name: str):
203+
def boot(self, name: str = ""):
204204
"""Boot the default or a specific boot entry
205205
206206
Args:

tests/test_bareboxdriver.py

+9
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,12 @@ def test_barebox_run_error(self, target_with_fakeconsole, mocker):
3535
res = d.run_check("test")
3636
res = d.run("test")
3737
assert res == (['error'], [], 1)
38+
39+
def test_barebox_boot(self, target_with_fakeconsole):
40+
t = target_with_fakeconsole
41+
d = BareboxDriver(t, "barebox", boot_command='boot -v foo')
42+
d = t.get_driver(BareboxDriver)
43+
d.boot()
44+
assert d.console.txq.pop() == b"boot -v foo\n"
45+
d.boot(name='bar')
46+
assert d.console.txq.pop() == b"boot -v bar\n"

0 commit comments

Comments
 (0)