test_md.py 1.4 KB

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