summaryrefslogtreecommitdiff
path: root/test/py
diff options
context:
space:
mode:
authorStephen Warren <swarren@wwwdotorg.org>2016-01-15 11:15:27 -0700
committerSimon Glass <sjg@chromium.org>2016-01-20 19:06:23 -0700
commit98cee89b55a561917648196a94be7e80455a9ac9 (patch)
tree568f9933945e3b2db1e333a4179e96e84a0884d9 /test/py
parent5ab097abad7d6d2b6da2d0423b95803950831cc6 (diff)
downloadu-boot-imx-98cee89b55a561917648196a94be7e80455a9ac9.zip
u-boot-imx-98cee89b55a561917648196a94be7e80455a9ac9.tar.gz
u-boot-imx-98cee89b55a561917648196a94be7e80455a9ac9.tar.bz2
test/py: test the md/mw commands
This tests whether md/mw work, and affect each-other. Command repeat is also tested. test/cmd_repeat.sh is removed, since the new Python-based test does everything it used to. Signed-off-by: Stephen Warren <swarren@wwwdotorg.org> Signed-off-by: Stephen Warren <swarren@nvidia.com> Acked-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'test/py')
-rw-r--r--test/py/tests/test_md.py36
1 files changed, 36 insertions, 0 deletions
diff --git a/test/py/tests/test_md.py b/test/py/tests/test_md.py
new file mode 100644
index 0000000..94603c7
--- /dev/null
+++ b/test/py/tests/test_md.py
@@ -0,0 +1,36 @@
+# Copyright (c) 2015 Stephen Warren
+# Copyright (c) 2015-2016, NVIDIA CORPORATION. All rights reserved.
+#
+# SPDX-License-Identifier: GPL-2.0
+
+import pytest
+
+@pytest.mark.buildconfigspec('cmd_memory')
+def test_md(u_boot_console):
+ '''Test that md reads memory as expected, and that memory can be modified
+ using the mw command.'''
+
+ ram_base = u_boot_console.find_ram_base()
+ addr = '%08x' % ram_base
+ val = 'a5f09876'
+ expected_response = addr + ': ' + val
+ u_boot_console.run_command('mw ' + addr + ' 0 10')
+ response = u_boot_console.run_command('md ' + addr + ' 10')
+ assert(not (expected_response in response))
+ u_boot_console.run_command('mw ' + addr + ' ' + val)
+ response = u_boot_console.run_command('md ' + addr + ' 10')
+ assert(expected_response in response)
+
+@pytest.mark.buildconfigspec('cmd_memory')
+def test_md_repeat(u_boot_console):
+ '''Test command repeat (via executing an empty command) operates correctly
+ for "md"; the command must repeat and dump an incrementing address.'''
+
+ ram_base = u_boot_console.find_ram_base()
+ addr_base = '%08x' % ram_base
+ words = 0x10
+ addr_repeat = '%08x' % (ram_base + (words * 4))
+ u_boot_console.run_command('md %s %x' % (addr_base, words))
+ response = u_boot_console.run_command('')
+ expected_response = addr_repeat + ': '
+ assert(expected_response in response)