]> git.sur5r.net Git - u-boot/commitdiff
test/py: Add an option to execute a string containing a command
authorSimon Glass <sjg@chromium.org>
Sun, 3 Jul 2016 15:40:40 +0000 (09:40 -0600)
committerTom Rini <trini@konsulko.com>
Thu, 14 Jul 2016 22:22:35 +0000 (18:22 -0400)
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>
test/py/u_boot_utils.py

index 99bad7c0e4016fc066e4eb50c5bdf12159a7d589..ce0bbcf763a25fdf6c5b17f558e8129fb55f1014 100644 (file)
@@ -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.