Commit 8b304a37df13477f02fca5a6f5eaa3e55d7b4bf1

Authored by Simon Glass
Committed by Tom Rini
1 parent f3d3e95ce5

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>

Showing 1 changed file with 12 additions and 0 deletions Side-by-side Diff

test/py/u_boot_utils.py
... ... @@ -173,6 +173,18 @@
173 173 runner.close()
174 174 return output
175 175  
  176 +def cmd(u_boot_console, cmd_str):
  177 + """Run a single command string and log its output.
  178 +
  179 + Args:
  180 + u_boot_console: A console connection to U-Boot.
  181 + cmd: The command to run, as a string.
  182 +
  183 + Returns:
  184 + The output as a string.
  185 + """
  186 + return run_and_log(u_boot_console, cmd_str.split())
  187 +
176 188 ram_base = None
177 189 def find_ram_base(u_boot_console):
178 190 """Find the running U-Boot's RAM location.