blob: 5c25a2d465a8fb195c2aee861166c93583386323 [file] [log] [blame]
Stephen Warren770fe172016-02-08 14:44:16 -07001# Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
2#
3# SPDX-License-Identifier: GPL-2.0
4
5import os.path
6import pytest
7
8@pytest.mark.buildconfigspec('ut_dm')
9def 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
25def 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')