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