From: Simon Glass Date: Wed, 26 Sep 2018 15:55:12 -0600 Subject: [U-Boot] [PATCH 14/22] test/py: Add a way to pass flags to sandbox In-Reply-To: <20180926215520.87168-1-sjg@chromium.org> References: <20180926215520.87168-1-sjg@chromium.org> Message-ID: <20180926215520.87168-15-sjg@chromium.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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 --- test/py/u_boot_console_sandbox.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/test/py/u_boot_console_sandbox.py b/test/py/u_boot_console_sandbox.py index 778f6d0983d..7f357cbc9d1 100644 --- a/test/py/u_boot_console_sandbox.py +++ b/test/py/u_boot_console_sandbox.py @@ -22,8 +22,8 @@ class ConsoleSandbox(ConsoleBase): Returns: Nothing. """ - 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 +51,24 @@ 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. -- 2.19.0.605.g01d371f741-goog