Invoke each "ut"-based unit test as a separate pytest. Now that the DM unit test runs under test/py, remove the manual shell script that invokes it. Signed-off-by: Stephen Warren <swarren@nvidia.com> Acked-by: Simon Glass <sjg@chromium.org> Tested-by: Simon Glass <sjg@chromium.org> # v2, on sandboxmaster
parent
7ed4848bb8
commit
1cd85f571d
@ -1,16 +0,0 @@ |
||||
#!/bin/sh |
||||
|
||||
die() { |
||||
echo $1 |
||||
exit 1 |
||||
} |
||||
|
||||
NUM_CPUS=$(cat /proc/cpuinfo |grep -c processor) |
||||
make O=sandbox sandbox_config || die "Cannot configure U-Boot" |
||||
make O=sandbox -s -j${NUM_CPUS} || die "Cannot build U-Boot" |
||||
dd if=/dev/zero of=spi.bin bs=1M count=2 |
||||
echo -n "this is a test" > testflash.bin |
||||
dd if=/dev/zero bs=1M count=4 >>testflash.bin |
||||
./sandbox/u-boot -d ./sandbox/arch/sandbox/dts/test.dtb -c "ut dm" |
||||
rm spi.bin |
||||
rm testflash.bin |
@ -0,0 +1,29 @@ |
||||
# Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved. |
||||
# |
||||
# SPDX-License-Identifier: GPL-2.0 |
||||
|
||||
import os.path |
||||
import pytest |
||||
|
||||
@pytest.mark.buildconfigspec('ut_dm') |
||||
def test_ut_dm_init(u_boot_console): |
||||
"""Initialize data for ut dm tests.""" |
||||
|
||||
fn = u_boot_console.config.source_dir + '/testflash.bin' |
||||
if not os.path.exists(fn): |
||||
data = 'this is a test' |
||||
data += '\x00' * ((4 * 1024 * 1024) - len(data)) |
||||
with open(fn, 'wb') as fh: |
||||
fh.write(data) |
||||
|
||||
fn = u_boot_console.config.source_dir + '/spi.bin' |
||||
if not os.path.exists(fn): |
||||
data = '\x00' * (2 * 1024 * 1024) |
||||
with open(fn, 'wb') as fh: |
||||
fh.write(data) |
||||
|
||||
def test_ut(u_boot_console, ut_subtest): |
||||
"""Execute a "ut" subtest.""" |
||||
|
||||
output = u_boot_console.run_command('ut ' + ut_subtest) |
||||
assert output.endswith('Failures: 0') |
Loading…
Reference in new issue