]> git.sur5r.net Git - u-boot/commitdiff
test/py: Add a helper to run a list of U-Boot commands
authorSimon Glass <sjg@chromium.org>
Sun, 3 Jul 2016 15:40:42 +0000 (09:40 -0600)
committerTom Rini <trini@konsulko.com>
Thu, 14 Jul 2016 22:22:36 +0000 (18:22 -0400)
Some tests want to execute a sequence of commands. Add a helper for this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Teddy Reed <teddy.reed@gmail.com>
test/py/u_boot_console_base.py

index 815fa64d5ff344ba7dc6470e714862d6f59c568c..b5aad7cb94ad6a876aac51164fdc5e45b4632c0d 100644 (file)
@@ -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.