test_ut.py 861 B

12345678910111213141516171819202122232425262728
  1. # SPDX-License-Identifier: GPL-2.0
  2. # Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
  3. import os.path
  4. import pytest
  5. @pytest.mark.buildconfigspec('ut_dm')
  6. def test_ut_dm_init(u_boot_console):
  7. """Initialize data for ut dm tests."""
  8. fn = u_boot_console.config.source_dir + '/testflash.bin'
  9. if not os.path.exists(fn):
  10. data = 'this is a test'
  11. data += '\x00' * ((4 * 1024 * 1024) - len(data))
  12. with open(fn, 'wb') as fh:
  13. fh.write(data)
  14. fn = u_boot_console.config.source_dir + '/spi.bin'
  15. if not os.path.exists(fn):
  16. data = '\x00' * (2 * 1024 * 1024)
  17. with open(fn, 'wb') as fh:
  18. fh.write(data)
  19. def test_ut(u_boot_console, ut_subtest):
  20. """Execute a "ut" subtest."""
  21. output = u_boot_console.run_command('ut ' + ut_subtest)
  22. assert output.endswith('Failures: 0')