summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2016-07-03 09:40:40 -0600
committerTom Rini <trini@konsulko.com>2016-07-14 18:22:35 -0400
commit8b304a37df13477f02fca5a6f5eaa3e55d7b4bf1 (patch)
tree0bd33d216e78eabe7c1f0a5810e5e526734658ab /test
parentf3d3e95ce5d26777a6a138635f9bb12ca7ccf6fa (diff)
downloadu-boot-8b304a37df13477f02fca5a6f5eaa3e55d7b4bf1.tar.gz
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 <sjg@chromium.org> Reviewed-by: Teddy Reed <teddy.reed@gmail.com>
Diffstat (limited to 'test')
-rw-r--r--test/py/u_boot_utils.py12
1 files changed, 12 insertions, 0 deletions
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.