]> git.karo-electronics.de Git - karo-tx-uboot.git/commitdiff
test: Add a function to restart U-Boot
authorSimon Glass <sjg@chromium.org>
Sun, 31 Jul 2016 23:35:08 +0000 (17:35 -0600)
committerTom Rini <trini@konsulko.com>
Sat, 6 Aug 2016 00:55:22 +0000 (20:55 -0400)
Add a proper function for this rather than using internal functions. Use it
in the single call site.

Also, do a restart at the end of the vboot test to reset to the normal
device tree.

Signed-off-by: Simon Glass <sjg@chromium.org>
Suggested-by: Stephen Warren <swarren@nvidia.com>
test/py/tests/test_vboot.py
test/py/u_boot_console_base.py

index 25c3a53c97dc55f0394c7427956ec9ac230a1315..d7ab439b2bbb756f8753567fa1a4a8e51b89a0c0 100644 (file)
@@ -65,8 +65,7 @@ def test_vboot(u_boot_console):
             sha_algo: Either 'sha1' or 'sha256', to select the algorithm to
                     use.
         """
-        cons.cleanup_spawn()
-        cons.ensure_spawned()
+        cons.restart_uboot()
         with cons.log.section('Verified boot %s %s' % (sha_algo, test_type)):
             output = cons.run_command_list(
                 ['sb load hostfs - 100 %stest.fit' % tmpdir,
@@ -190,4 +189,6 @@ def test_vboot(u_boot_console):
         test_with_algo('sha1')
         test_with_algo('sha256')
     finally:
+        # Go back to the original U-Boot with the correct dtb.
         cons.config.dtb = old_dtb
+        cons.restart_uboot()
index 356cf801b4b2858818f4190c997c2bdd0f77a409..b855b10ecc59221204d22282fe6d99531a3a1e17 100644 (file)
@@ -393,6 +393,11 @@ class ConsoleBase(object):
             pass
         self.p = None
 
+    def restart_uboot(self):
+        """Shut down and restart U-Boot."""
+        self.cleanup_spawn()
+        self.ensure_spawned()
+
     def get_spawn_output(self):
         """Return the start-up output from U-Boot