Merge branch 'cie' into 'master'

test: pytest and hook improvements

See merge request u-boot/u-boot!348
This commit is contained in:
Simon Glass
2025-12-27 03:37:54 +00:00
14 changed files with 55 additions and 13 deletions

View File

@@ -1130,8 +1130,8 @@ config BLOBLIST_SIZE
config BLOBLIST_SIZE_RELOC
hex "Size of bloblist after relocation"
default BLOBLIST_SIZE if BLOBLIST_FIXED || BLOBLIST_ALLOC
default 0x20000 if (ARM && EFI_LOADER && GENERATE_ACPI_TABLE)
default BLOBLIST_SIZE if BLOBLIST_FIXED
default 0x20000
help
Sets the size of the bloblist in bytes after relocation. Since U-Boot
has a lot more memory available then, it is possible to use a larger

View File

@@ -2,7 +2,6 @@ CONFIG_ARM=y
CONFIG_POSITION_INDEPENDENT=y
CONFIG_ARCH_QEMU_ARM=y
CONFIG_SYS_MALLOC_LEN=0x1000000
CONFIG_BLOBLIST_SIZE_RELOC=0x2000
CONFIG_NR_DRAM_BANKS=1
CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x40200000
CONFIG_ENV_SIZE=0x40000

View File

@@ -2,7 +2,6 @@ CONFIG_ARM=y
CONFIG_ARM_SMCCC=y
CONFIG_ARCH_QEMU_ARM=y
CONFIG_SYS_MALLOC_LEN=0x1000000
CONFIG_BLOBLIST_SIZE_RELOC=0x2000
CONFIG_NR_DRAM_BANKS=1
CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x40200000
CONFIG_ENV_SIZE=0x40000

View File

@@ -0,0 +1 @@
../travis-ci/conf.qemu-arm-sbsa_na

View File

@@ -0,0 +1 @@
../travis-ci/conf.qemu-ppce500_na

View File

@@ -0,0 +1,10 @@
# SPDX-License-Identifier: MIT
# Config for qemu-riscv32 S-mode (requires OpenSBI)
console_impl=qemu
qemu_machine="virt"
qemu_binary="qemu-system-riscv32"
qemu_extra_args="-m 1G -nographic -netdev user,id=net0,tftp=${UBOOT_TRAVIS_BUILD_DIR} -device virtio-net-device,netdev=net0 -netdev user,id=net1,tftp=${UBOOT_TRAVIS_BUILD_DIR} -device virtio-net-device,netdev=net1 -device virtio-rng-device"
qemu_kernel_args="-bios ${OPENSBI} -kernel ${U_BOOT_BUILD_DIR}/u-boot.bin"
reset_impl=none
flash_impl=none

View File

@@ -0,0 +1,10 @@
# SPDX-License-Identifier: MIT
# Config for qemu-riscv64 S-mode (requires OpenSBI)
console_impl=qemu
qemu_machine="virt"
qemu_binary="qemu-system-riscv64"
qemu_extra_args="-m 1G -nographic -netdev user,id=net0,tftp=${UBOOT_TRAVIS_BUILD_DIR} -device virtio-net-device,netdev=net0 -netdev user,id=net1,tftp=${UBOOT_TRAVIS_BUILD_DIR} -device virtio-net-device,netdev=net1 -device virtio-rng-device"
qemu_kernel_args="-bios ${OPENSBI} -kernel ${U_BOOT_BUILD_DIR}/u-boot.bin"
reset_impl=none
flash_impl=none

View File

@@ -0,0 +1,10 @@
# SPDX-License-Identifier: MIT
# Config for qemu-riscv64 S-mode (requires OpenSBI)
console_impl=qemu
qemu_machine="virt"
qemu_binary="qemu-system-riscv64"
qemu_extra_args="-m 1G -nographic -netdev user,id=net0,tftp=${UBOOT_TRAVIS_BUILD_DIR} -device virtio-net-device,netdev=net0 -netdev user,id=net1,tftp=${UBOOT_TRAVIS_BUILD_DIR} -device virtio-net-device,netdev=net1 -device virtio-rng-device"
qemu_kernel_args="-bios ${OPENSBI} -kernel ${U_BOOT_BUILD_DIR}/u-boot.bin"
reset_impl=none
flash_impl=none

View File

@@ -0,0 +1 @@
../travis-ci/conf.qemu-xtensa-dc233c_na

View File

@@ -0,0 +1 @@
../travis-ci/conf.qemu_arm64_na

View File

@@ -0,0 +1 @@
../travis-ci/conf.qemu_arm64_na

View File

@@ -1,11 +1,10 @@
# SPDX-License-Identifier: MIT
#
# Copyright (c) 2019 Heinrich Schuchardt
# Config for qemu-riscv64 S-mode (requires OpenSBI)
console_impl=qemu
qemu_machine="virt"
qemu_binary="qemu-system-riscv64"
qemu_extra_args="-m 1G -nographic -netdev user,id=net0,tftp=${UBOOT_TRAVIS_BUILD_DIR} -device virtio-net-device,netdev=net0 -netdev user,id=net1,tftp=${UBOOT_TRAVIS_BUILD_DIR} -device virtio-net-device,netdev=net1 -device virtio-rng-device"
qemu_kernel_args="-bios ${U_BOOT_BUILD_DIR}/u-boot"
qemu_kernel_args="-bios ${OPENSBI} -kernel ${U_BOOT_BUILD_DIR}/u-boot.bin"
reset_impl=none
flash_impl=none

View File

@@ -87,6 +87,8 @@ def pytest_addoption(parser):
help='Compile U-Boot before running tests')
parser.addoption('--buildman', default=False, action='store_true',
help='Use buildman to build U-Boot (assuming --build is given)')
parser.addoption('--quiet-hooks', default=False, action='store_true',
help='Suppress display of hook commands (still logged to file)')
parser.addoption(
'-E', '--allow-exceptions', '-E', default=False, action='store_true',
help='Avoid catching exceptions with test failures')
@@ -113,6 +115,8 @@ def run_build(config, source_dir, build_dir, board_type, log):
if config.getoption('buildman'):
if build_dir != source_dir:
dest_args = ['-o', build_dir, '-w']
if config.getoption('quiet_hooks'):
dest_args.append('-I')
else:
dest_args = ['-i']
cmds = (['buildman', '--board', board_type] + dest_args,)
@@ -276,7 +280,9 @@ def pytest_configure(config):
raise Exception('--gdbserver only supported with sandbox targets')
import multiplexed_log
log = multiplexed_log.Logfile(result_dir + '/test-log.html')
quiet_hooks = config.getoption('quiet_hooks')
log = multiplexed_log.Logfile(result_dir + '/test-log.html',
quiet_hooks=quiet_hooks)
if config.getoption('build'):
worker_id = os.environ.get("PYTEST_XDIST_WORKER")
@@ -626,7 +632,7 @@ def show_timings():
if too_long:
show_bar(f'>{get_time_delta(max_dur)}', too_long_msecs, too_long)
log.info(buf.getvalue())
if ubconfig and hasattr(ubconfig, 'timing'):
if ubconfig and ubconfig.timing:
print(buf.getvalue(), end='')

View File

@@ -88,7 +88,7 @@ class RunAndLog(object):
a multiplexed log file. Objects of this type should be created by factory
functions in the Logfile class rather than directly."""
def __init__(self, logfile, name, chained_file):
def __init__(self, logfile, name, chained_file, quiet=False):
"""Initialize a new object.
Args:
@@ -96,6 +96,7 @@ class RunAndLog(object):
name: The name of this log stream or sub-process.
chained_file: The file-like object to which all stream data should
be logged to in addition to logfile. Can be None.
quiet: Suppress display of hook commands to chained_file.
Returns:
Nothing.
@@ -104,6 +105,7 @@ class RunAndLog(object):
self.logfile = logfile
self.name = name
self.chained_file = chained_file
self.quiet = quiet
self.output = None
self.exit_status = None
@@ -133,7 +135,7 @@ class RunAndLog(object):
"""
msg = '+' + ' '.join(cmd) + '\n'
if self.chained_file:
if self.chained_file and not self.quiet:
self.chained_file.write(msg)
self.logfile.write(self, msg)
@@ -215,11 +217,12 @@ class Logfile:
"""Generates an HTML-formatted log file containing multiple streams of
data, each represented in a well-delineated/-structured fashion."""
def __init__(self, fn):
def __init__(self, fn, quiet_hooks=False):
"""Initialize a new object.
Args:
fn: The filename to write to.
quiet_hooks: Suppress display of hook commands to stdout.
Returns:
Nothing.
@@ -234,6 +237,7 @@ class Logfile:
self.timestamp_prev = self.timestamp_start
self.timestamp_blocks = []
self.seen_warning = False
self.quiet_hooks = quiet_hooks
shutil.copy(mod_dir + '/multiplexed_log.css', os.path.dirname(fn))
self.f.write('''\
@@ -666,7 +670,7 @@ $(document).ready(function () {
A RunAndLog object.
"""
return RunAndLog(self, name, chained_file)
return RunAndLog(self, name, chained_file, self.quiet_hooks)
def write(self, stream, data, implicit=False):
"""Write stream data into the log file.