summaryrefslogtreecommitdiff
path: root/test
AgeCommit message (Collapse)Author
2022-09-03tpm: Allow reporting the internal stateSimon Glass
It is useful to read information about the current TPM state, where supported, e.g. for debugging purposes when verified boot fails. Add support for this to the TPM interface as well as Cr50. Add a simple sandbox test. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org> Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2022-08-22CI: Move to Ubuntu 2022.04 "Jammy" for CI baseTom Rini
- We now have a new enough sbsigntools in the distro, stop building. - Use the 20220801 tag for Jammy. - Move to pygit2 1.9.2 (current version) as the old one doesn't build on "Jammy". - Add the working directory to the list of safe directories for git. - Move to pytest 6.2.5 to address other issues. - This move exposed a number of minor issues in the existing scripts we used within CI to perform the jobs themselves. The most notable changes here involve using 'set +e / set -e' to enforce when we should or should not make non-zero buildman status be a fatal error. Signed-off-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-08-12vbe: Add a new vbe commandSimon Glass
Add a command to look at VBE methods and their status. Provide a test for all of this as well. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-08-12bootstd: Check building without global bootmethsSimon Glass
Use the sandbox_flattree build to check that everything works correctly with BOOTMETH_GLOBAL disabled. Update the tests as needed. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-08-12bootstd: Add vbe bootmeth into sandboxSimon Glass
Update sandbox to include the VBE bootmeth. Update a few existing tests to take account of this change, specifically that the new bootmeth now appears when scanning. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-08-12vbe: Support VBE simpleSimon Glass
Add support for VBE simple, which permits firmware update of a single image stored in MMC or another block device. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-08-12event: Add an event for device tree fixupsSimon Glass
At present there is a confusing array of functions that handle the device tree fix-ups needed for booting an OS. We should be able to switch to using events to clean this up. As a first step, create a new event type and call it from the standard place. Note that this event uses the ofnode interface only, since this can support live tree which is more efficient when making lots of updates. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-08-12bootstd: Drop the system bootdevSimon Glass
This was a work-around for the fact that global bootmeths such as EFI bootmgr and VBE don't use a particular bootdev, or at least select it themselves so that we don't need to scan all bootdevs when using that bootmeth. Drop the system bootdev entirely. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-08-12bootstd: Always create the EFI bootmgr bootmethSimon Glass
Now that we can separate this out from the normal bootmeths, update the code to create it always. We cannot rely on the device tree to create this, since the EFI project is quite opposed to having anything in the device tree that helps U-Boot with its processing. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-08-12bootstd: Allow scanning for global bootmeths separatelySimon Glass
Typically we want to find and use global bootmeths first, since they have the best idea of how the system should boot. We then use normal bootmeths as a fallback. Add the logic for this, putting global bootmeths at the end of the ordering. We can then easily scan the global bootmeths first, then drop them from the list for subsequent bootdev-centric scans. This changes the ordering of global bootmeths, so update the bootflow_system() accordingly. Drop the comment from bootmeth_setup_iter_order() since this is an exported function and it should be in the header file. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-08-12dm: core: Call dm_scan_other() when setting up for testsSimon Glass
At present this function is not called, so tests miss out on any devices created by it. Add it in so that tests can rely on these extra devices. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-08-12bootstd: Allow EFI bootmgr to support an invalid bootflowSimon Glass
For most testing we don't want this bootmeth to actually do anything. For the one test where we do, add a test hook to obtain the correct behaviour. This will allow us to bind the device always, rather than just doing it for this test. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-08-12bootstd: Provide a bootmeth method to obtain state infoSimon Glass
Some bootmeths can provide information about what is available to boot. For example, VBE simple provides access to the firmware state. Add a new method for this, along with a sandbox test. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-08-12bootstd: Fix comment in bootmeth testSimon Glass
Correct the comment at the top of this file. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-08-12bootstd: Drop delays in the testsSimon Glass
Some tests go as far as booting a distribution. In this case a menu is presented to the user, with a two-second timeout. This adds a total of 12 seconds to the test runs at present. Avoid this by inserting a response using the console-recording feature. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-08-12dm: core: Add support for writing u32 with ofnodeSimon Glass
Add a new function to write an integer to an ofnode (live tree or flat tree). Signed-off-by: Simon Glass <sjg@chromium.org>
2022-08-12dm: core: Allow writing to a flat tree with ofnodeSimon Glass
In generally it is not permitted to implement an ofnode function only for flat tree or live tree. Both must be supported. Also the code for live tree access should be in of_access.c rather than ofnode.c which is really just for holding the API-conversion code. Update ofnode_write_prop() accordingly and fix the test so it can work with flat tree too. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-08-12dm: core: Prepare for updating the device tree with ofnodeSimon Glass
Add some documentation and a new flag so that we can safely enabled using the ofnode interface to write to the device tree. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-08-12dm: core: Tidy up ofnode-writing testSimon Glass
Update this test to use the livetree flag so that special check can be avoided. Also drop a few blank lines. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-08-12dm: core: Swap parameters of ofnode_write_prop()Simon Glass
It is normal for the length to come after the value in libfdt. Follow this same convention with ofnode. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-08-12dm: core: Move ofnode-writing test to ofnodeSimon Glass
This fits better in the ofnode tests, so move it. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-08-12dm: core: Introduce support for multiple treesSimon Glass
At present ofnode only works with a single device tree, for the most part. This is the control FDT used by U-Boot. When booting an OS we may obtain a different device tree and want to modify it. Add some initial support for this into the ofnode API. Note that we don't permit aliases in this other device tree, since the of_access implementation maintains a list of aliases collected at start-up. Also, we don't need aliases to do fixups in the other FDT. So make sure that flat tree and live tree processing are consistent in this area. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-08-10test: Add some tests for kconfig.hSimon Glass
The macros in this file are a little confusing and we currently have no tests to check that they work as expected. Add some tests which check the macros in C code. Add a few tests which check that the build errors are generated correctly too, using buildman's -a option. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-08-02test: rng: Add a UT testcase for the rng commandSughosh Ganu
The 'rng' command dumps a number of random bytes on the console. Add a set of tests for the 'rng' command. The test function performs basic sanity testing of the command. Since a unit test is being added for the command, enable it by default in the sandbox platforms. Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org> Reviewed-by: Simon Glass <sjg@chromium.org> Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org> Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2022-07-27Merge tag 'dm-pull-26jul22' of ↵Tom Rini
https://gitlab.denx.de/u-boot/custodians/u-boot-dm.git minor dm- and fdt-related fixes start of test for fdt command
2022-07-26fdt: Start a test for the fdt commandSimon Glass
Add a basic test of the 'fdt addr' command, to kick things off. This includes a new convenience function to run a command from a printf() string. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-07-26addrmap: Support on sandboxSimon Glass
Update this feature so that it works on sandbox, using a basic identity mapping. This allows us to run the 'ut addrmap' test. Also fix up the test to use the correct macros to access the linker list, so that the 'ut addrmap' command actually works. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-07-26test: fix log testsHeinrich Schuchardt
Consider CONFIG_LOG_MAX_LEVEL and gd->default_log_level in * do_log_test_helpers() * log_test_dropped() * log_test_level_deny() Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-07-26test/py: Run simple dm commands without checkingMichal Simek
Just to make sure that dm commands can operate. This was the problem on Microblaze in past without fixing manual relocation. Signed-off-by: Michal Simek <michal.simek@xilinx.com> Signed-off-by: Michal Simek <michal.simek@amd.com> Reviewed-by: Simon Glass <sjg@chromium.org> Link: https://lore.kernel.org/r/e6c4b8b44445c16cee84436627642ccc9886f507.1657191580.git.michal.simek@amd.com
2022-07-26py: tests: Bind should run only on sandboxMichal Simek
Disable test to run on any other platform than sandbox. Signed-off-by: Michal Simek <michal.simek@xilinx.com> Signed-off-by: Michal Simek <michal.simek@amd.com> Reviewed-by: Simon Glass <sjg@chromium.org> Link: https://lore.kernel.org/r/786bfdfda7dee4494e39c3fff699970ecd623116.1657191142.git.michal.simek@amd.com
2022-07-22Merge tag 'efi-2022-10-rc1-2' of ↵Tom Rini
https://source.denx.de/u-boot/custodians/u-boot-efi Pull request for efi-2022-10-rc1-2 Documentation: * doc: add package uuid-dev to build dependencies UEFI: * remove support for CONFIG_LCD * fix authenticated capsules tests Others: * pxe: simplify label_boot() * cli: support bracketed paste
2022-07-21watchdog: add pulse support to gpio watchdog driverPaul Doelle
A common external watchdog circuit is kept alive by triggering a short pulse on the reset pin. This patch adds support for this use case, while making the algorithm configurable in the devicetree. The "linux,wdt-gpio" driver being modified is based off the equivalent driver in the Linux kernel, which provides support for this algorithm. This patch brings parity to this driver, and is kept aligned with the functionality and devicetree configuration in the kernel. It should be noted that this adds a required property named 'hw_algo' to the devicetree binding, following suit with the kernel. I'm happy to make this backward-compatible if preferred. Signed-off-by: Paul Doelle <paaull.git@gmail.com> Reviewed-by: Stefan Roese <sr@denx.de>
2022-07-18efi: test/py: repair authenticated capsules testsVincent Stehlé
The UEFI console initialisation has been modified by commit 68edbed454b8 ("efi_loader: initialize console size late"). A corresponding workaround is now necessary for the automated tests, as added to some of the tests already by commit e05bd68ed5fc ("test: work around for EFI terminal size probing"). Add the same workaround to the UEFI authenticated capsules tests to repair them. This can be tested with sandbox_defconfig, sandbox64_defconfig or sandbox_flattree_defconfig, plus CONFIG_EFI_CAPSULE_AUTHENTICATE=y. Signed-off-by: Vincent Stehlé <vincent.stehle@arm.com> Cc: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2022-07-11Merge branch 'next'Tom Rini
2022-07-08requirements: Move to atomicwrites==1.4.1Tom Rini
As explained upstream: https://github.com/untitaker/python-atomicwrites/issues/61 there is no longer a 1.3.0 version but the API is unchanged. Move to 1.4.1. Signed-off-by: Tom Rini <trini@konsulko.com>
2022-07-08requirements: Move to atomicwrites==1.4.1Tom Rini
As explained upstream: https://github.com/untitaker/python-atomicwrites/issues/61 there is no longer a 1.3.0 version but the API is unchanged. Move to 1.4.1. Signed-off-by: Tom Rini <trini@konsulko.com>
2022-07-08Merge tag 'dm-pull-28jun22' of ↵Tom Rini
https://source.denx.de/u-boot/custodians/u-boot-dm into next nman external-symbol improvements Driver model memory-usage reporting patman test-reporting improvements Add bloblist design goals
2022-07-08test: fix CONFIG_ACPIGEN dependenciesHeinrich Schuchardt
Some tests cannot be built with CONFIG_ACPIGEN=n. Consider this in the Makefile. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2022-07-07spl: Ensure all SPL symbols in Kconfig have some SPL dependencyTom Rini
Tighten up symbol dependencies in a number of places. Ensure that a SPL specific option has at least a direct dependency on SPL. In places where it's clear that we depend on something more specific, use that dependency instead. This means in a very small number of places we can drop redundant dependencies. Reported-by: Pali Rohár <pali@kernel.org> Signed-off-by: Tom Rini <trini@konsulko.com>
2022-07-05test/py: efi_secboot: add a test for a forged signed imageAKASHI Takahiro
In this test case, a image binary, helloworld.efi.signed, is willfully modified to print a corrupted message while the signature itself is unchanged. This binary must be rejected under secure boot mode. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
2022-06-28dm: core: Add a way to collect memory usageSimon Glass
Add a function for collecting the amount of memory used by driver model, including devices, uclasses and attached data and tags. This information can provide insights into how to reduce the memory required by driver model. Future work may look at execution speed also. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-06-28dm: core: Support accessing core tagsSimon Glass
At present tag numbers are only allocated for non-core data, meaning that the 'core' data, like priv and plat, are accessed through dedicated functions. For debugging and consistency it is convenient to use tags for this 'core' data too. Add support for this, with new tag numbers and functions to access the pointer and size for each. Update one of the test drivers so that the uclass-private data can be tested here. There is some code duplication with functions like device_alloc_priv() but this is not addressed for now. At some point, some rationalisation may help to reduce code size, but more thought it needed on that. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-06-28test: fix some pylint errors in test_bind.pyHeinrich Schuchardt
* Use spaces not tabs * Limit lines to 100 spaces * Remove an unused import * Sort imports correctly * Add a module description Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2022-06-23fuzz: virtio: Add fuzzer for vringAndrew Scull
Add a fuzzer to test the vring handling code against unexpected mutations from the virtio device. After building the sandbox with CONFIG_FUZZ=y, the fuzzer can be invoked with by: UBOOT_SB_FUZZ_TEST=fuzz_vring ./u-boot This fuzzer finds unvalidated inputs in the vring driver that allow a buggy or malicious device to make the driver chase wild pointers. Signed-off-by: Andrew Scull <ascull@google.com>
2022-06-23test: fuzz: Add framework for fuzzingAndrew Scull
Add the basic infrastructure for declaring fuzz tests and a command to invoke them. Signed-off-by: Andrew Scull <ascull@google.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-06-23test/py: test_stackprotector: Disable for ASANAndrew Scull
The stack protector test intentionally overflows a buffer in order to corrupt the stack canary so that it can test that the corruption is detected as expected. However, this is incompatible with ASAN, which detects the buffer overflow and interrupts the test, so disable the test for such configurations. Signed-off-by: Andrew Scull <ascull@google.com>
2022-06-22cmd: load: add load command for memory mappedRui Miguel Silva
cp.b is used a lot as a way to load binaries to memory and execute them, however we may need to integrate this with the efi subsystem to set it up as a bootdev. So, introduce a loadm command that will be consistent with the other loadX commands and will call the efi API's. ex: loadm $kernel_addr $kernel_addr_r $kernel_size with this a kernel with CONFIG_EFI_STUB enabled will be loaded and then subsequently booted with bootefi command. Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org> Reviewed-by: Tom Rini <trini@konsulko.com>
2022-06-20Merge branch 'master' into nextTom Rini
Merge in v2022.07-rc5.
2022-06-19test: work around for EFI terminal size probingHeinrich Schuchardt
When the UEFI sub-system is initialized it sends an escape sequence to the serial console to determine the terminal size. This stops the run_command_list() function of the console emulation from recognizing the U-Boot command line prompt. Add a 'print -e' command as first command in the command list to work around this issue. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2022-06-08test: eth: Add test for ethernet addressesSean Anderson
This adds a test to make sure that all the ethernet interfaces have their addresses read properly. At the moment everything is read from the environment, but the next few commits will add additional sources. Signed-off-by: Sean Anderson <sean.anderson@seco.com> Reviewed-by: Simon Glass <sjg@chromium.org>