[U-Boot] [PATCH 10/14] test/py: Add a helper to run a list of U-Boot commands

Simon Glass sjg at chromium.org
Sun Jul 3 17:40:42 CEST 2016


Some tests want to execute a sequence of commands. Add a helper for this.

Signed-off-by: Simon Glass <sjg at chromium.org>
---

 test/py/u_boot_console_base.py | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/test/py/u_boot_console_base.py b/test/py/u_boot_console_base.py
index 815fa64..b5aad7c 100644
--- a/test/py/u_boot_console_base.py
+++ b/test/py/u_boot_console_base.py
@@ -216,6 +216,22 @@ class ConsoleBase(object):
             self.cleanup_spawn()
             raise
 
+    def run_command_list(self, cmds):
+        """Run a list of commands.
+
+        This is a helper function to call run_command() with default arguments
+        for each command in a list.
+
+        Args:
+            cmd: List of commands (each a string)
+        Returns:
+            Combined output of all commands, as a string
+        """
+        output = ''
+        for cmd in cmds:
+            output += self.run_command(cmd)
+        return output
+
     def ctrlc(self):
         """Send a CTRL-C character to U-Boot.
 
-- 
2.8.0.rc3.226.g39d4020



More information about the U-Boot mailing list