mirror of
https://github.com/AsahiLinux/u-boot
synced 2025-02-26 12:27:12 +00:00
test/py: Add a way to pass flags to sandbox
It is sometimes useful to restart sandbox with some particular flags to test certain functionality. Add a new method to ConsoleSandbox to handle this, without changing the existing APIs. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Stephen Warren <swarren@nvidia.com>
This commit is contained in:
parent
9946d557be
commit
20d4440189
1 changed files with 18 additions and 0 deletions
|
@ -24,6 +24,7 @@ class ConsoleSandbox(ConsoleBase):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
super(ConsoleSandbox, self).__init__(log, config, max_fifo_fill=1024)
|
super(ConsoleSandbox, self).__init__(log, config, max_fifo_fill=1024)
|
||||||
|
self.sandbox_flags = []
|
||||||
|
|
||||||
def get_spawn(self):
|
def get_spawn(self):
|
||||||
"""Connect to a fresh U-Boot instance.
|
"""Connect to a fresh U-Boot instance.
|
||||||
|
@ -51,8 +52,25 @@ class ConsoleSandbox(ConsoleBase):
|
||||||
'-d',
|
'-d',
|
||||||
self.config.dtb
|
self.config.dtb
|
||||||
]
|
]
|
||||||
|
cmd += self.sandbox_flags
|
||||||
return Spawn(cmd, cwd=self.config.source_dir)
|
return Spawn(cmd, cwd=self.config.source_dir)
|
||||||
|
|
||||||
|
def restart_uboot_with_flags(self, flags):
|
||||||
|
"""Run U-Boot with the given command-line flags
|
||||||
|
|
||||||
|
Args:
|
||||||
|
flags: List of flags to pass, each a string
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
A u_boot_spawn.Spawn object that is attached to U-Boot.
|
||||||
|
"""
|
||||||
|
|
||||||
|
try:
|
||||||
|
self.sandbox_flags = flags
|
||||||
|
return self.restart_uboot()
|
||||||
|
finally:
|
||||||
|
self.sandbox_flags = []
|
||||||
|
|
||||||
def kill(self, sig):
|
def kill(self, sig):
|
||||||
"""Send a specific Unix signal to the sandbox process.
|
"""Send a specific Unix signal to the sandbox process.
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue