summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorLove Kumar <love.kumar@amd.com>2024-03-12 14:18:33 +0530
committerTom Rini <trini@konsulko.com>2024-03-19 18:40:47 -0400
commit8132970f7d1a14b27eb71f963af47b2248289743 (patch)
tree4c3ccd7835ace147c0537f5b51d75851183290fc /test
parent4eff1145bc388bc46af140068120e28a3d939ca5 (diff)
downloadu-boot-8132970f7d1a14b27eb71f963af47b2248289743.tar.gz
u-boot-8132970f7d1a14b27eb71f963af47b2248289743.tar.bz2
u-boot-8132970f7d1a14b27eb71f963af47b2248289743.zip
test/py: reset: Add a test for reset command
Add a test for reset commands which performs resetting of CPU, It does COLD reset by default and WARM reset with -w option. Signed-off-by: Love Kumar <love.kumar@amd.com>
Diffstat (limited to 'test')
-rw-r--r--test/py/tests/test_reset.py63
1 files changed, 63 insertions, 0 deletions
diff --git a/test/py/tests/test_reset.py b/test/py/tests/test_reset.py
new file mode 100644
index 0000000000..00fc31da57
--- /dev/null
+++ b/test/py/tests/test_reset.py
@@ -0,0 +1,63 @@
+# SPDX-License-Identifier: GPL-2.0
+# (C) Copyright 2023, Advanced Micro Devices, Inc.
+
+"""
+Note: This test doesn't rely on boardenv_* configuration value but they can
+change test behavior.
+
+For example:
+
+# Setup env__reset_test_skip to True if reset test is not possible or desired
+# and should be skipped.
+env__reset_test_skip = True
+
+# Setup env__reset_test to set the bootmode if 'modeboot' u-boot environment
+# variable is not set. Test will be skipped if bootmode is not set in both
+# places i.e, boardenv and modeboot u-boot environment variable
+env__reset_test = {
+ 'bootmode': 'qspiboot',
+}
+
+# This test will be also skipped if the bootmode is detected to JTAG.
+"""
+
+import pytest
+import test_000_version
+
+def setup_reset_env(u_boot_console):
+ if u_boot_console.config.env.get('env__reset_test_skip', False):
+ pytest.skip('reset test is not enabled')
+
+ output = u_boot_console.run_command('echo $modeboot')
+ if output:
+ bootmode = output
+ else:
+ f = u_boot_console.config.env.get('env__reset_test', None)
+ if not f:
+ pytest.skip('bootmode cannot be determined')
+ bootmode = f.get('bootmode', 'jtagboot')
+
+ if 'jtag' in bootmode:
+ pytest.skip('skipping reset test due to jtag bootmode')
+
+@pytest.mark.buildconfigspec('hush_parser')
+def test_reset(u_boot_console):
+ """Test the reset command in non-JTAG bootmode.
+ It does COLD reset, which resets CPU, DDR and peripherals
+ """
+ setup_reset_env(u_boot_console)
+ u_boot_console.run_command('reset', wait_for_reboot=True)
+
+ # Checks the u-boot command prompt's functionality after reset
+ test_000_version.test_version(u_boot_console)
+
+@pytest.mark.buildconfigspec('hush_parser')
+def test_reset_w(u_boot_console):
+ """Test the reset -w command in non-JTAG bootmode.
+ It does WARM reset, which resets CPU but keep DDR/peripherals active.
+ """
+ setup_reset_env(u_boot_console)
+ u_boot_console.run_command('reset -w', wait_for_reboot=True)
+
+ # Checks the u-boot command prompt's functionality after reset
+ test_000_version.test_version(u_boot_console)