summaryrefslogtreecommitdiff
path: root/test/py
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2016-07-31 17:35:08 -0600
committerTom Rini <trini@konsulko.com>2016-08-05 20:55:22 -0400
commit27c087d58ab703f15211629abfa4a47f19974b9e (patch)
tree5acc83311a431be6acf3f84b474579bcab5ab810 /test/py
parent851271a71ada94d3ae52057c5cea465f4ba9f621 (diff)
downloadu-boot-27c087d58ab703f15211629abfa4a47f19974b9e.tar.gz
u-boot-27c087d58ab703f15211629abfa4a47f19974b9e.tar.bz2
u-boot-27c087d58ab703f15211629abfa4a47f19974b9e.zip
test: Add a function to restart U-Boot
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>
Diffstat (limited to 'test/py')
-rw-r--r--test/py/tests/test_vboot.py5
-rw-r--r--test/py/u_boot_console_base.py5
2 files changed, 8 insertions, 2 deletions
diff --git a/test/py/tests/test_vboot.py b/test/py/tests/test_vboot.py
index 25c3a53c97..d7ab439b2b 100644
--- a/test/py/tests/test_vboot.py
+++ b/test/py/tests/test_vboot.py
@@ -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()
diff --git a/test/py/u_boot_console_base.py b/test/py/u_boot_console_base.py
index 356cf801b4..b855b10ecc 100644
--- a/test/py/u_boot_console_base.py
+++ b/test/py/u_boot_console_base.py
@@ -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