test_md.py 1.4 KB

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