Compare commits

...

8 Commits

Author SHA1 Message Date
Simon Glass
e16a9fa8b5 test: pytest: Add --quiet-hooks option
Add a --quiet-hooks option to suppress display of hook commands to
stdout while still logging them to the HTML log file. This reduces
console noise during test runs.

Cover-letter:
test: pytest and hook improvements
This series includes several improvements to the pytest infrastructure
and test hook configurations:

- Fix the timing check in conftest to properly check if timing is enabled
- Add a --quiet-hooks option to suppress hook command display
- Add and update ellesmere hook config files for various QEMU boards
- Update qemu-riscv64 config for S-mode with OpenSBI
END

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-12-26 20:22:28 -07:00
Simon Glass
b5b75c768e test: hooks: Add more ellesmere config files
Add configuration files for qemu-riscv32_smode, qemu-riscv64_smode,
qemu-riscv64_smode_acpi, qemu_arm64_acpi, and qemu_arm64_lwip boards.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-12-26 20:09:09 -07:00
Simon Glass
5f66188fd5 test: hooks: Update qemu-riscv64 config for S-mode with OpenSBI
Update the qemu-riscv64 hook config to use OpenSBI as the BIOS and load
U-Boot as the kernel, which is required for S-mode operation.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-12-26 20:09:09 -07:00
Simon Glass
227cc00fd8 test: hooks: Add missing ellesmere config files
Add configuration files for qemu-arm-sbsa, qemu-ppce500, and
qemu-xtensa-dc233c boards.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-12-26 20:09:09 -07:00
Simon Glass
af5b84be61 test: pytest: Fix timing check in conftest
The check uses hasattr() to see if the 'timing' attribute exists, but
does not check if it is actually enabled. Fix this by checking the
attribute value instead.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-12-26 20:09:02 -07:00
Heinrich Schuchardt
e1a1046c61 bloblist: adjust default bloblist size after reloc
If neither CONFIG_BLOBLIST_FIXED NOR CONFIG_BLOBLIST_ALLOC is set,
currently CONFIG_BLOBLIST_SIZE_RELOC defaults to 0 except if
* CONFIG_ARM=y && CONFIG_EFI_LOADER=y && GENERATE_ACPI_TABLE=y.

A size of zero never makes sense for a bloblist.

When using QFW we need more than 64 KiB to host the ACPI table.
In this case CONFIG_BLOBLIST_ALLOC is used.

Set a reasonable default.

Remove the CONFIG_BLOBLIST_SIZE_RELOC in ARM QEMU defconfigs which are
not compatible with ACPI tables passed from QEMU.

Reported-by: Emil Renner Berthing <emil.renner.berthing@canonical.com>
Fixes: 6f9b015c13 ("common: Enable BLOBLIST_TABLES on arm")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
(cherry picked from commit 559f11e66c)
2025-12-26 19:58:15 -07:00
Simon Glass
075a61cda9 Merge branch 'cid' into 'master'
gitlab-ci: Use full clone for trigger_snap_builds job

See merge request u-boot/u-boot!347
2025-12-25 22:44:39 +00:00
Simon Glass
b42338d541 gitlab-ci: Use full clone for trigger_snap_builds job
The push to GitHub fails because the shallow clone is missing objects
that the remote references. Disable shallow cloning for this job by
setting GIT_DEPTH to 0

Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-12-25 15:38:52 -07:00
15 changed files with 57 additions and 13 deletions

View File

@@ -968,6 +968,8 @@ efi-aarch64:
trigger_snap_builds:
stage: release
variables:
GIT_DEPTH: 0 # Need full history for GitHub push
rules:
- if: $CI_COMMIT_BRANCH == "master"
before_script:

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.