test_ut.py 863 B

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