1 # Copyright (c) 2015 Stephen Warren
2 # Copyright (c) 2015-2016, NVIDIA CORPORATION. All rights reserved.
4 # SPDX-License-Identifier: GPL-2.0
9 @pytest.mark.buildconfigspec('cmd_memory')
10 def test_md(u_boot_console):
11 '''Test that md reads memory as expected, and that memory can be modified
12 using the mw command.'''
14 ram_base = u_boot_utils.find_ram_base(u_boot_console)
15 addr = '%08x' % ram_base
17 expected_response = addr + ': ' + val
18 u_boot_console.run_command('mw ' + addr + ' 0 10')
19 response = u_boot_console.run_command('md ' + addr + ' 10')
20 assert(not (expected_response in response))
21 u_boot_console.run_command('mw ' + addr + ' ' + val)
22 response = u_boot_console.run_command('md ' + addr + ' 10')
23 assert(expected_response in response)
25 @pytest.mark.buildconfigspec('cmd_memory')
26 def test_md_repeat(u_boot_console):
27 '''Test command repeat (via executing an empty command) operates correctly
28 for "md"; the command must repeat and dump an incrementing address.'''
30 ram_base = u_boot_utils.find_ram_base(u_boot_console)
31 addr_base = '%08x' % ram_base
33 addr_repeat = '%08x' % (ram_base + (words * 4))
34 u_boot_console.run_command('md %s %x' % (addr_base, words))
35 response = u_boot_console.run_command('')
36 expected_response = addr_repeat + ': '
37 assert(expected_response in response)