From: Simon Glass Date: Sun, 3 Jul 2016 15:40:40 +0000 (-0600) Subject: test/py: Add an option to execute a string containing a command X-Git-Tag: v2016.09-rc1~105 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=8b304a37df13477f02fca5a6f5eaa3e55d7b4bf1;p=u-boot test/py: Add an option to execute a string containing a command It is sometimes inconvenient to convert a string into a list for execution with run_and_log(). Provide a helper function to do this. Signed-off-by: Simon Glass Reviewed-by: Teddy Reed --- diff --git a/test/py/u_boot_utils.py b/test/py/u_boot_utils.py index 99bad7c0e4..ce0bbcf763 100644 --- a/test/py/u_boot_utils.py +++ b/test/py/u_boot_utils.py @@ -173,6 +173,18 @@ def run_and_log(u_boot_console, cmd, ignore_errors=False): runner.close() return output +def cmd(u_boot_console, cmd_str): + """Run a single command string and log its output. + + Args: + u_boot_console: A console connection to U-Boot. + cmd: The command to run, as a string. + + Returns: + The output as a string. + """ + return run_and_log(u_boot_console, cmd_str.split()) + ram_base = None def find_ram_base(u_boot_console): """Find the running U-Boot's RAM location.