summaryrefslogtreecommitdiff
path: root/test
AgeCommit message (Collapse)AuthorFilesLines
2023-06-08test/py: efi_capsule: test for FMP versioningMasahisa Kojima6-2/+404
This test covers the FMP versioning for both raw and FIT image, and both signed and non-signed capsule update. Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org> Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2023-06-08test: efi_capsule: refactor efi_capsule testMasahisa Kojima5-642/+287
Current efi capsule python tests have much code duplication. This commit creates the common function in test/py/tests/test_efi_capsule/capsule_common.py, aim to reduce the code size and improve maintainability. Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org> Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2023-06-01acpi: Put the version numbers in a central placeSimon Glass1-9/+7
At present two acpi files are built every time since they use a version number from version.h This is not necessary. Make use of the same technique as for the version string, so that they are build only when they change. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-05-13bootstd: Rename distro and syslinux to extlinuxSimon Glass2-29/+29
We use the terms 'distro' to mean extlinux but they are not really the same. 'Distro' could refer to any method of booting a distribution, whereas extlinux is a particular method. Also we sometimes use syslinux, but it is better to use the same term in all cases. Rename distro to syslinux and also update bootstd uses of syslinux to use extlinux instead. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-05-13bootstd: Tidy up reporting of errorsSimon Glass1-5/+5
In a few cases the error handling is not quite right. Make sure we return the actual error in distro_efi_read_bootflow_file() rather than -EINVAL. Return -IO when a file cannot be read. Also show the error name if available. This does not change operation, but does make it easier to diagnose problems. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-05-13bootstd: usb: Avoid initing USB twiceSimon Glass1-0/+5
This causes crashes on some boards, e.g. rockpro64. In any case, we should not do it. Check the usb_started flag to avoid this. Signed-off-by: Simon Glass <sjg@chromium.org> Tested-by: Jonas Karlman <jonas@kwiboo.se> Tested-by: Tom Rini <trini@konsulko.com>
2023-05-13usb: Tidy up the usb_start flagSimon Glass2-5/+2
This should be declared in a header file so that type-checking works correctly. Add a single declaration to usb.h and remove the others. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Marek Vasut <marex@denx.de> Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
2023-05-06test: eth: IPv6 network discovery unit testEhsan Mohandesi1-0/+88
Test router advertisement validation and processing functions. Signed-off-by: Ehsan Mohandesi <emohandesi@linux.microsoft.com> Reviewed-by: Viacheslav Mitrofanov <v.v.mitrofanov@yadro.com>
2023-05-06test/py: IPv6 network discovery testEhsan Mohandesi1-1/+30
Test the IPv6 network discovery feature if indicated by boardenv file. Signed-off-by: Ehsan Mohandesi <emohandesi@linux.microsoft.com> Reviewed-by: Viacheslav Mitrofanov <v.v.mitrofanov@yadro.com>
2023-05-06net: dhcp6: Add a sandbox test for dhcp6Sean Edmond1-0/+25
Requires proper environment with DHCP6 server provisioned. Signed-off-by: Sean Edmond <seanedmond@microsoft.com> Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
2023-05-04Merge branch '2023-05-03-assorted-updates-and-fixes'Tom Rini1-0/+13
- Various typo fixes, pass -Werror to host tools builds, bdi cleanups, fix hush and local variables, a FSL PCI fix and correct some python in one of the tests.
2023-05-04efi: Rename the base efi self-testSimon Glass1-1/+1
This function uses the same base name as all the others in this file, so it is not easy to run just that one test. Add a _base suffix so that it can be run on its own. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2023-05-04test: fix pydoc issues for EFI testsHeinrich Schuchardt5-11/+16
Fix issues reported by pydocstyle. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2023-05-04test: hush_if_test: Add hush variable testStefan Herbrechtsmeier1-0/+13
Add a test for the hush shell variable assignment and clear. Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-05-02test: Add tests for the extconSvyatoslav Ryhel2-0/+22
Provide tests to the simple extcon device. Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-04-28core: fdtaddr: use map_sysmem() as cast for the returnJohan Jonker1-1/+4
For the devfdt_get_addr_index_ptr() and devfdt_get_addr_size_index_ptr() function use map_sysmem() function as cast for the return for use in sandbox. Also fix sandbox test. Signed-off-by: Johan Jonker <jbx6244@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org> Drop second hunk: Signed-off-by: Simon Glass <sjg@chromium.org>
2023-04-28test: fdt: Fix copyright messageMarek Vasut1-1/+1
Drop the map_to_sysmem() copy paste error. No functional change. Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-04-28sandbox64: add a test case for UCLASS_NVMXIPAbdellatif El Khlifi2-0/+150
provide a test for NVM XIP devices The test case allows to make sure of the following: - The NVM XIP QSPI devices are probed - The DT entries are read correctly - the data read from the flash by the NVMXIP block driver is correct Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
2023-04-27ide: Move ide_init() into probingSimon Glass1-2/+0
At present the code does ide_init() as a separate operation, then calls device_probe() to copy over the information. We can call ide_init() from probe just as easily. The only difference is that using 'ide init' twice will do nothing. However it already fails to copy over the new data in that case, so the effect is the same. For now, unbind the block devices and remove the IDE device, which causes the bus to be probed again. Later patches will fix this up fully, so that all blk_desc data is copied across. Since ide_reset() is only called from ide_init(), there is no need to init the ide_dev_desc[] array. This is already done at the end of ide_init() so drop this code. The call to uclass_first_device() is now within the probe() function of the same device, so does nothing. Drop it. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-04-26bootstd: Report missing labels only when askedSimon Glass1-7/+5
Use the -l flag to indicate whether to report missing uclasses. Also try to be more helpful when no devices are found. For example, when we see something 'scsi0' requested and nothing was found, this indicates that there are no SCSI devices, so show a suitable message. Move messages out of the low-level functions so that silent operation is possible. This means they are never reported unless BOOTSTD_FULL is enabled, since the -l flag cannot otherwise be set. Suggested-by: Tom Rini <trini@konsulko.com> Signed-off-by: Simon Glass <sjg@chromium.org>
2023-04-25pytest: Use --lazy with umountTom Rini1-2/+2
Sometimes when doing tests on real hardware we sometimes run in to the case where some of these mounts haven't been fully flushed. Using the --lazy option with umount will allow us to continue while letting the OS handle flushing the data out still. Signed-off-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-04-25test: move unit tests into a sub-menuHeinrich Schuchardt1-1/+5
The main configuration menu should not contain detail settings. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-04-25test: improve configuration for Kconfig test optionsHeinrich Schuchardt1-7/+8
* Fix dependencies * Provide labels that are easier to grasp. * Fix typo %s/whgch/which/ * Fix type %s/Is/is/ Fixes: 29784d62eded ("test: Add some tests for kconfig.h") Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-04-21test: fix launch_efi()Heinrich Schuchardt1-1/+3
We cannot use old_dtb in the finally block if it has not been assigned before the try block. test/py/tests/test_efi_fit.py:458:30: E0601: Using variable 'old_dtb' before assignment (used-before-assignment) Fixes: 8391f955494e ("test/py: Create a test for launching UEFI binaries from FIT images") Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2023-04-21test: fix pylint warning for capsule testsHeinrich Schuchardt4-76/+65
Fix pylint warnings like: * Class inherits from object * Missing module description * Missing class description * First line of comment blank * Superfluous imports Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2023-04-10test: dm: mmc: Check block erasing boundariesLoic Poulain1-7/+7
Verify that erasing blocks does not impact adjacent ones. - Write four blocks [0 1 2 3] - Erase two blocks [ 1 2 ] - Verify [0 1 2 3 ] Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2023-04-05test: blkmap: Add test suiteTobias Waldekranz2-0/+202
Verify that: - Block maps can be created and destroyed - Mappings aren't allowed to overlap - Multiple mappings can be attached and be read/written from/to Signed-off-by: Tobias Waldekranz <tobias@waldekranz.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-04-04test/py: android: extend abootimg testSafae Ouajih1-13/+123
test_abootimg is extended to include the testing of boot images version 4. For this, boot.img and vendor_boot.img have been generated using mkbootimg tool with setting the header version to 4. This tests: - Getting the header version using abootimg - Extracting the load address of the dtb - Extracting the dtb start address in RAM Running test: $ ./test/py/test.py --bd sandbox --build -k test_abootimg Signed-off-by: Safae Ouajih <souajih@baylibre.com> Reviewed-by: Simon Glass <sjg@chromium.org> Tested-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
2023-04-04pytest: Update requirements to match sphinx versionsTom Rini1-4/+4
In order to better make use of pip caches, and also for better overall consistency, we should use the same versions of packages in each of our python requirements files. Update pytest to use the newer versions of packages we use in sphinx builds. Signed-off-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-04-03Merge branch 'next'Tom Rini32-127/+1276
Signed-off-by: Tom Rini <trini@konsulko.com>
2023-04-02test: Run the VPL tests with 'make check'Simon Glass1-0/+5
Update the script to run VPL tests as well as the others. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-04-02vbe: Use the correct image filename in the testSimon Glass1-2/+4
At present this inadvertently relies on having a symlink to the correct file from the current directory. Use the correct path to fix this. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-04-02fdt: Make fdt addr -q quieterPeter Hoyes1-1/+0
64597346 "fdt: Add -q option to fdt addr for distro_bootcmd" introduced the -q option for fdt addr, which sets the current working fdt address without printing any output. baf41410 "fdt: Show a message when the working FDT changes" made the utility function set_working_fdt_addr (in cmd/fdt.c) output a message on each invocation, even if called via fdt addr -q, in which case its output is now slightly noisier. To fix this, split out set_working_fdt_addr into set_working_fdt_addr plus the static function set_working_fdt_addr_quiet. set_working_fdt_addr_quiet can be called by "quiet" fdt cmd logic and set_working_fdt_addr is exported (as before) to other boot logic. The latter calls the former. Remove the assertion from the fdt addr test case when calling with the -q argument. Signed-off-by: Peter Hoyes <Peter.Hoyes@arm.com> Reviewed-by: Marek Vasut <marek.vasut+renesas@mailbox.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-04-02test_vboot.py: include test of fdt_add_pubkey toolRoman Kopytin1-38/+148
Add test_fdt_add_pubkey test which provides simple functionality test which contains such steps: create DTB and FIT files add keys with fdt_add_pubkey to DTB sign FIT image check with fit_check_sign that keys properly added to DTB file Signed-off-by: Roman Kopytin <Roman.Kopytin@kaspersky.com> Signed-off-by: Ivan Mikhaylov <fr0st61te@gmail.com> Cc: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
2023-03-30test: fs: Check fat short file nameStefan Herbrechtsmeier1-0/+36
Ensure that a freshly written fat file with a lower case filename which fits into the upper case 8.3 short filename is not mangeled with a tilde and number. Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
2023-03-30test: exit: fix run_commandf() warningsEvgeny Bachinin1-9/+9
Fix warnings after adding printf-like attribute format for run_commandf(): warning: too many arguments for format [-Wformat-extra-args] Signed-off-by: Evgeny Bachinin <EABachinin@sberdevices.ru> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-03-30test: fdt: fix run_commandf() warningsEvgeny Bachinin1-11/+11
Fix warnings both for 32bit and 64bit architecture after adding printf-like attribute format for run_commandf(): warning: format ‘%x’ expects argument of type ‘unsigned int’, but argument 2 has type ‘ulong {aka long unsigned int}’ [-Wformat=] ret = run_commandf("fdt addr -c %08x", addr); ^ Signed-off-by: Evgeny Bachinin <EABachinin@sberdevices.ru> Cc: Marek Vasut <marek.vasut+renesas@mailbox.org> Reviewed-by: Simon Glass <sjg@chromium.org> [trini: Fixup testcases added since patch was posted] Signed-off-by: Tom Rini <trini@konsulko.com>
2023-03-30unit-test: cover run_commandf() by test-casesEvgeny Bachinin1-0/+34
As run_commandf() is variadic version of run_command() and just a wrapper, hence apply similar run_command's test-cases. Let's avoid warning about empty string passing: warning: zero-length gnu_printf format string [-Wformat-zero-length] assert(run_commandf("") == 0); Signed-off-by: Evgeny Bachinin <EABachinin@sberdevices.ru> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-03-30test: Add test for new command pci_mpsStephen Carlson3-0/+51
Adds a test for the new pci_mps command to ensure that it can set the Maximum Payload Size (MPS) of all devices to 256 bytes in the sandbox environment. Enables the pci_mps command in the sandbox environment so that this test can be run. Signed-off-by: Stephen Carlson <stcarlso@linux.microsoft.com>
2023-03-28cli: Correct handling of invalid escape sequences in cread_line()Simon Glass1-0/+45
The second call to cli_ch_process() is in the wrong place, meaning that the one of the characters of an invalid escape sequence is swallowed instead of being returned. Fix the bug and add a test to cover this. This behaviour matches that of the code before cli_getch() was introduced. This was verified on the commit before b08e9d4b66 i.e.: 7d850f85aad ("sandbox: Enable mmc command and legacy images") Signed-off-by: Simon Glass <sjg@chromium.org> Reported-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2023-03-28cli: Correct several bugs in cli_getch()Simon Glass2-0/+49
This function does not behave as expected when unknown escape sequences are sent to it: - it fails to store (and thus echo) the last character of the invalid sequence - it fails to set esc_len to 0 when it finishes emitting the invalid sequence, meaning that the following character will appear to be part of a new escape sequence - it processes the first character of the rejected sequence as a valid character, just starting the sequence all over again The last two bugs conspire to produce an "impossible condition #876" message which is the main symptom of this behaviour. Fix these bugs and add a test to verify the behaviour. Signed-off-by: Simon Glass <sjg@chromium.org> Reported-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2023-03-18test: add tests of 'read' and 'write' shell commandsRasmus Villemoes2-0/+105
Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
2023-03-16Merge tag 'dm-next-12mar23a' of git://git.denx.de/u-boot-dm into nextTom Rini9-30/+576
More tests and fixes for fdt command binman signing feature fix buildman -A bug introduced recently Signed-off-by: Tom Rini <trini@konsulko.com>
2023-03-15test: cmd: fdt: Test fdt applyMarek Vasut1-0/+152
Add 'fdt chosen' test which works as follows: - Create basic DT, map it to sysmem - Apply DTO which adds single property via fragment (without address spec) - Apply DTO which adds more properties (string, u32, empty) and a subnode, with phandle via frament@0 and thus tests /__symbols__ node - Apply DTO which modifies property of the previous DTO via phandle and thus tests the /__fixups__ node - Print modified DT, verify it contains updates from DTOs The test case can be triggered using: " ./u-boot -Dc 'ut fdt' " To dump the full output from commands used during test, add '-v' flag. Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-03-15test: cmd: fdt: Test fdt chosenMarek Vasut1-0/+48
Add 'fdt chosen' test which works as follows: - Create basic DT, map it to sysmem - Print /chosen node, verify it is nonexistent - Create chosen node - Print /chosen node, verify it contains only version - Create /chosen node with initrd entries - Print /chosen node, verify it contains version and initrd entries The test case can be triggered using: " ./u-boot -Dc 'ut fdt' " To dump the full output from commands used during test, add '-v' flag. Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-03-15test: cmd: fdt: Test fdt rsvmemMarek Vasut1-0/+63
Add 'fdt rsvmem' test which works as follows: - Create custom FDT with single reserved memory (rsvmem) entry, map it to sysmem - Add new rsvmem entry - Delete existing older rsvmem entry - Add new rsvmem entry again - Always print the rsvmem list and validate it The test case can be triggered using: " ./u-boot -Dc 'ut fdt' " To dump the full output from commands used during test, add '-v' flag. Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-03-15test: cmd: fdt: Test fdt memoryMarek Vasut1-0/+83
Add 'fdt memory' test which works as follows: - Create custom FDT with /memory node, with select #*cells, map it to sysmem - Perform memory fixup - Read back the /memory node and validate its content The test case can be triggered using: " ./u-boot -Dc 'ut fdt' " To dump the full output from commands used during test, add '-v' flag. Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-03-15test: cmd: fdt: Test fdt headerMarek Vasut1-0/+59
Add 'fdt header' test which works as follows: - Create basic FDT, map it to sysmem - Print the FDT header - Get all members of the FDT header into variable and verify the variables contain correct data The test case can be triggered using: " ./u-boot -Dc 'ut fdt' " To dump the full output from commands used during test, add '-v' flag. Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org> Reviewed-by: Simon Glass <sjg@chromium.org> Merged in test: cmd: fdt: Drop unused fdt_test_header_get() fdt parameter: Signed-off-by: Simon Glass <sjg@chromium.org>
2023-03-15test: cmd: fdt: Test fdt print and listMarek Vasut1-0/+143
Add 'fdt print' and 'fdt list' test which works as follows: - Create fuller FDT, map it to sysmem - Print the entire FDT, parts of the FDT and select properties - Compare output from the print or list The test case can be triggered using: " ./u-boot -Dc 'ut fdt' " To dump the full output from commands used during test, add '-v' flag. Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-03-15test: cmd: fdt: Drop new unneeded curly bracketsMarek Vasut1-8/+6
Drop no longer needed { } around ut_assert*() functions in FDT test. No functional change. Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>