blob: 6c7b8dd2b30edac62e8c218e7ad5185010d6f0ad [file] [log] [blame]
Stephen Warren770fe172016-02-08 14:44:16 -07001# SPDX-License-Identifier: GPL-2.0
Tom Rini10e47792018-05-06 17:58:06 -04002# Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
Stephen Warren770fe172016-02-08 14:44:16 -07003
4import os.path
5import pytest
6
7@pytest.mark.buildconfigspec('ut_dm')
8def test_ut_dm_init(u_boot_console):
9 """Initialize data for ut dm tests."""
10
11 fn = u_boot_console.config.source_dir + '/testflash.bin'
12 if not os.path.exists(fn):
Tom Rini439ed3e2019-10-24 11:59:22 -040013 data = b'this is a test'
14 data += b'\x00' * ((4 * 1024 * 1024) - len(data))
Stephen Warren770fe172016-02-08 14:44:16 -070015 with open(fn, 'wb') as fh:
16 fh.write(data)
17
18 fn = u_boot_console.config.source_dir + '/spi.bin'
19 if not os.path.exists(fn):
Tom Rini439ed3e2019-10-24 11:59:22 -040020 data = b'\x00' * (2 * 1024 * 1024)
Stephen Warren770fe172016-02-08 14:44:16 -070021 with open(fn, 'wb') as fh:
22 fh.write(data)
23
24def test_ut(u_boot_console, ut_subtest):
25 """Execute a "ut" subtest."""
26
27 output = u_boot_console.run_command('ut ' + ut_subtest)
28 assert output.endswith('Failures: 0')