summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2018-11-15 18:44:00 -0700
committerTom Rini <trini@konsulko.com>2018-11-26 08:25:35 -0500
commit20d4440189b924eaf9d77e9f2470cd39abe34a4a (patch)
tree3a4c9f5fb08d24cd38ee2acef5e0fed98d832b28 /test
parent9946d557be409de5d598232f6e29c17809b9ac9d (diff)
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>
Diffstat (limited to 'test')
-rw-r--r--test/py/u_boot_console_sandbox.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/py/u_boot_console_sandbox.py b/test/py/u_boot_console_sandbox.py
index 778f6d0983..836f5a9e2b 100644
--- a/test/py/u_boot_console_sandbox.py
+++ b/test/py/u_boot_console_sandbox.py
@@ -24,6 +24,7 @@ class ConsoleSandbox(ConsoleBase):
"""
super(ConsoleSandbox, self).__init__(log, config, max_fifo_fill=1024)
+ self.sandbox_flags = []
def get_spawn(self):
"""Connect to a fresh U-Boot instance.
@@ -51,8 +52,25 @@ class ConsoleSandbox(ConsoleBase):
'-d',
self.config.dtb
]
+ cmd += self.sandbox_flags
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):
"""Send a specific Unix signal to the sandbox process.