summaryrefslogtreecommitdiff
path: root/test/py
AgeCommit message (Collapse)Author
2024-11-29test_ut: Allow running unprivilegedRichard Weinberger
Like for test_fs, no need to mess with loop mounts. Tweaks to reduce diff (keep mnt variable): Signed-off-by: Richard Weinberger <richard@nod.at> Signed-off-by: Simon Glass <sjg@chromium.org>
2024-11-29test_ut: Add an image size to setup_image()Simon Glass
Add a parameter to indicate the size of the image to build. Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: Richard Weinberger <richard@nod.at>
2024-11-29test_fs: Rename mount dir to scratchRichard Weinberger
Since no mounting happens anymore, rename the "mnt" directory to "scratch" and the related variables. Signed-off-by: Richard Weinberger <richard@nod.at> Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> Signed-off-by: Simon Glass <sjg@chromium.org>
2024-11-29test_fs: Allow running unprivilegedRichard Weinberger
There is no need to mount the filesystem on the host side. All filesystem tools offer some way to fill the fs without mounting. So, create the content on the host side, create and fill the fs without mounting. No more sudo or guestmount needed. This new approach works because the tests don't care about user IDs and no device files are needed. If user IDs start to matter it's still possible to use wrapper tools like fakeroot in future while filling the fs. Signed-off-by: Richard Weinberger <richard@nod.at> Signed-off-by: Simon Glass <sjg@chromium.org> Tested-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
2024-11-29test/py: zynqmp_rpu: Fix tcminit mode valueLove Kumar
Update the tcminit value to string and number both as per commit 342ccba5586a ("arm64: zynqmp: Fix tcminit mode value based on argv") and also adds negative cases based on invalid command sequences. Signed-off-by: Love Kumar <love.kumar@amd.com> Link: https://lore.kernel.org/r/48f75577f6735a0d14105658e89b625d45537bb1.1731672024.git.love.kumar@amd.com Signed-off-by: Michal Simek <michal.simek@amd.com>
2024-11-26bootstd: Remove prepared imagesSimon Glass
These are no-longer used. Drop them. Signed-off-by: Simon Glass <sjg@chromium.org>
2024-11-26test_ut: Drop support for fallback filesSimon Glass
We don't need the fallback anymore. Remove the code which uses these files. Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: Richard Weinberger <richard@nod.at>
2024-11-26test_ut: Use the built mkimageSimon Glass
The mkimage tool is not present in the docker image. Use the one in the build directory. Signed-off-by: Simon Glass <sjg@chromium.org>
2024-11-26test_ut: Drop exeception handlingSimon Glass
We don't need the fallback anymore. As a first step to removing it, drop the try...except clauses and unindent the code. This produces a large diff but there are no other code changes. Signed-off-by: Simon Glass <sjg@chromium.org>
2024-11-26test_ut: Allow running unprivilegedRichard Weinberger
Like for test_fs, no need to mess with loop mounts. Signed-off-by: Richard Weinberger <richard@nod.at> Tweaks to reduce diff (keep mnt variable): Signed-off-by: Simon Glass <sjg@chromium.org>
2024-11-26test_ut: Add an image size to setup_image()Simon Glass
Add a parameter to indicate the size of the image to build. Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: Richard Weinberger <richard@nod.at>
2024-11-26test_fs: Rename mount dir to scratchRichard Weinberger
Since no mounting happens anymore, rename the "mnt" directory to "scratch" and the related variables. Signed-off-by: Richard Weinberger <richard@nod.at> Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> Signed-off-by: Simon Glass <sjg@chromium.org>
2024-11-26test_fs: Allow running unprivilegedRichard Weinberger
There is no need to mount the filesystem on the host side. All filesystem tools offer some way to fill the fs without mounting. So, create the content on the host side, create and fill the fs without mounting. No more sudo or guestmount needed. This new approach works because the tests don't care about user IDs and no device files are needed. If user IDs start to matter it's still possible to use wrapper tools like fakeroot in future while filling the fs. Signed-off-by: Richard Weinberger <richard@nod.at> Signed-off-by: Simon Glass <sjg@chromium.org> Tested-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
2024-11-26bootstd: Add test for Android boot image v2Guillaume La Roque
Rename actual android bootmethod test to specify it's for boot image version 4. Add a unit test for testing the Android bootmethod with boot image version 2. This requires another mmc image (mmc8) to contain the following partitions: - misc: contains the Bootloader Control Block (BCB) - boot_a: contains a fake generic kernel image we can test this with: $ ./test/py/test.py --bd sandbox --build -k test_ut # build the mmc8.img $ ./test/py/test.py --bd sandbox --build -k bootflow_android Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> Signed-off-by: Guillaume La Roque <glaroque@baylibre.com> Link: https://lore.kernel.org/r/20241126-adnroidv2-v4-5-11636106dc69@baylibre.com Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
2024-11-25Merge tag 'v2025.01-rc3' into nextTom Rini
Prepare v2025.01-rc3
2024-11-17test/py: mmc: Add support for different mmc modesLove Kumar
Currently, MMC test runs on default mmc modes, adding a provision to support multiple mmc modes through user defined parameters. Signed-off-by: Love Kumar <love.kumar@amd.com>
2024-11-17test/py: usb: Distinguish b/w ext2/ext4 partitionsLove Kumar
'usb part' command shows the partition maps and shows the partition type by displaying number such as 0c, 83 etc. Observed that ext2 and ext4 partitions shows the same number, i.e, 83, so, using the fstype command to distiniguish between ext2 and ext4 partitions. Signed-off-by: Love Kumar <love.kumar@amd.com>
2024-11-17test/py: mmc: Distinguish b/w ext2/ext4 partitionsLove Kumar
'mmc part' command shows the partition maps and shows the partition type by displaying number such as 0c, 83 etc. Observed that ext2 and ext4 partitions shows the same number, i.e, 83, so, using the fstype command to distiniguish between ext2 and ext4 partitions. Signed-off-by: Love Kumar <love.kumar@amd.com>
2024-11-15test/py: spi: Rephrase the warning/error messagesLove Kumar
Rephrasing the error and warning messages to be more meaningful and clear. Signed-off-by: Love Kumar <love.kumar@amd.com>
2024-11-13test: Correct regex string in test_spiSimon Glass
Use an 'r' string to avoid a warning: test/py/tests/test_spi.py:698: DeprecationWarning: invalid escape sequence '\s' Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Love Kumar <love.kumar@amd.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2024-11-13test: Support testing with two board-buildsSimon Glass
The Beagleplay board uses an SoC from the TI K3 family. This has both a Cortex-R core and a Cortex-A core and the R core needs to come up before the A core. In both cases we have U-Boot SPL then U-Boot proper being used. In practice this means we need two entirely separate builds to produce an image. Handle this in test.py by adding more parameters. Signed-off-by: Simon Glass <sjg@chromium.org>
2024-11-13test: Add a section for closing the connectionSimon Glass
This can take a while and involve multiple steps (e.g. turning the board back off). Add a section for it and show the output. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
2024-11-13test: Try to shut down the lab console gracefullySimon Glass
Send the Labgrid quit characters to ask it to exit gracefully. This typically allows it to power off the board being used. Only do this when labgrid is being used (detected with an env var). If that doesn't work, try the less graceful approach. The normal approach for pytest is to simply kill the child process. This makes Labgrid exit immediately. Thus it does not get a chance to execute the 'off' part of strategy (which may power it off) and release the device. Without this, every board disconnect leaves the board in a bad state, requiring separate steps to recover the board, then power it off. The action is conditional on since USE_LABGRID_SJG being set, so only affects operation if the Labgrid-sjg integration is being used. Signed-off-by: Simon Glass <sjg@chromium.org>
2024-11-13test: Avoid double echo when starting upSimon Glass
There is a very annoying bug at present where the terminal echos part of the first command sent to the board. This happens because the terminal is still set to echo for a period until Labgrid starts up and can change this. Fix this by disabling echo (and other terminal features) as soon as the spawn happens. Signed-off-by: Simon Glass <sjg@chromium.org>
2024-11-13test: Improve handling of sending commandsSimon Glass
We expect commands to be echoed and this should happen quite quickly, since U-Boot is sitting at the prompt waiting for a command. Reduce the timeout for this situation. Try to produce a more useful error message when something goes wrong. Also handle the case where the connection has gone away since the last command was issued. Signed-off-by: Simon Glass <sjg@chromium.org>
2024-11-13test: Introduce lab modeSimon Glass
There is quite a bit of code in pytest to try to start up U-Boot on a board, with timeouts, expects, etc. This is tedious to maintain and is peripheral to the test system's purpose. It seems better to put this logic in the lab itself, where is can provide such support. With Labgrid we can use the UbootStrategy class to get the board into a useful state, however it needs to do it. Then it can report to pytest by writing a suitable string along with the U-Boot version it detected. Add support for detecting 'lab mode' and simply assume that all is well in that case. Collect the version string when Labgrid says it is ready. This is only used with the Labgrid-sjg integration. When Labgrid starts the UbootStrategy it checks if U_BOOT_SOURCE_DIR is set. If so it emits a string '{lab mode}' that tells test.py to simply wait for an indication that the board is ready. All banner-checking is skipped. The indication comes in the form of another string 'Lab: Board is ready' which Labgrid sends once the board is sitting at a prompt ready to run tests. Then test.py emits 'U-Boot is ready' and continues with testing. Note that Labgrid has the same kind of "check for a string" logic that is in test.py, except it's not caring about the correct number / order of banner prints. This checking could be added, however. If something fails, the complete output is shown, so it is possible to see what went wrong. Signed-off-by: Simon Glass <sjg@chromium.org>
2024-11-13test: Introduce the concept of a roleSimon Glass
In Labgrid there is the concept of a 'role', which is similar to the U-Boot board ID in U-Boot's pytest subsystem. The role indicates both the target and information about the U-Boot build to use. It can also provide any amount of other configuration. The information is obtained using the 'labgrid-client query' operation. Using this role, all required configuration for the board is stored within the Labgrid environment, with pytest simply querying it. This allows connecting to boards using an interactive console, something that isn't possible without some kind of mapping. It also means that we don't need to replicate the pytest functionality in tbot, since Labgrid can handle the console and kick off builds as needed. Make use of this in tests, so that only the role is required in gitlab and other situations. The board type and other things can be queried as needed. Use a new 'u-boot-test-getrole' script to obtain the requested information. With this it is possible to run lab tests in gitlab with just a single 'ROLE' variable for each board. Note that, without this feature: - interactive use of boards with Labgrid-sjg would require repeating the id/board in a separate configuration file - Gitlab yaml file would need to specify both the id and board This feature is entirely optional, however, with the code gracefully falling back to using a separate ID and board. Link: https://tbot.tools Signed-off-by: Simon Glass <sjg@chromium.org>
2024-11-13test: Allow connecting to a running boardSimon Glass
Sometimes we know that the board is already running the right software, so provide an option to allow running of tests directly, without first resetting the board. This saves time when re-running a test where only the Python code is changing. Note that this feature is open to errors, since the user must know that the board is in a fit state to execute tests. It is useful for repeated iteration on a particular test, where it can save quite a bit of time. Signed-off-by: Simon Glass <sjg@chromium.org>
2024-11-13test: Release board after tests completeSimon Glass
When a board is finished with, the lab may want to power it off, or perform some other function. Add a new script which is called when tests are complete. Reviewed-by: Tom Rini <trini@konsulko.com> Signed-off-by: Simon Glass <sjg@chromium.org>
2024-11-13test: Allow signaling that U-Boot is readySimon Glass
When Labgrid is used, it can get U-Boot ready for running tests. It prints a message when it has done so. Add logic to detect this message and accept it. Note that this does not change pytest, which still (also) looks for the U-Boot banner. This change merely makes it possible for pytest to believe Labgrid when it says that the board is ready for use. In several cases, the board starts up and Labgrid receives some initial output, then pytest starts and misses some of that output, because it came in while Labgrid had the console open. Then pytest fails because it doesn't see the expected banners. With this change, Labgrid handles getting U-Boot to a prompt, in a fully reliable manner. Then pytest starts up and can simply start running its tests. But, again, this does not prevent pytest from handling a banner if one is provided (e.g. if not using the Labgrid integration). Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
2024-11-09test: efi: boot: Set up an image suitable for EFI testingSimon Glass
Create a new disk for use with tests, which contains the new 'testapp' EFI app specifically intended for testing the EFI loader. Attach it to the USB device, since most testing is currently done with mmc. Initially this image will be used to test the EFI bootmeth. Fix a stale comment in prep_mmc_bootdev() while we are here. For now this uses sudo and a compressed fallback file, like all the other bootstd tests. Once this series is in, the patch which moves this to use user-space tools will be cleaned up and re-submitted. Signed-off-by: Simon Glass <sjg@chromium.org>
2024-11-04usb: Fix test dependency on ext4write commandAndrew Goodbody
The tests test_usb_ext4load_ext4write, test_usb_ext2load and test_usb_load depend on the command ext4write being present not just the feature of being able to write to an ext4 file system. So update their dependencies to include the ext4write command itself. This will prevent spurious test failures when running the USB tests against USB storage with an ext2/ext4 partition but no ext4write command available. Fixes: 1c5b6edad381 ("test/py: usb: Add tests for USB device") Signed-off-by: Andrew Goodbody <andrew.goodbody@linaro.org> Reviewed-by: Love Kumar <love.kumar@amd.com>
2024-11-04usb: Fix test failure with multiple partitionsAndrew Goodbody
When test_usb_load finds multiple partitions of the same type then it will cause a test failure. The call to write the test file will write a different test file to each partition but only return the name and size of the last one written. So the test then fails to load the test file from the first partition as it uses the name of a file on a different partition. Refactor the code so that only one test file is written at a time and is written to only the partition being tested at that time. This allows the correct file name to always be available to the code that runs the load command. This reduces the number of files written and also the number of calls to crc32 needed. Fixes: 1c5b6edad381 ("test/py: usb: Add tests for USB device") Signed-off-by: Andrew Goodbody <andrew.goodbody@linaro.org> Reviewed-by: Love Kumar <love.kumar@amd.com>
2024-11-03test: Drop the duplicate line in setup_bootmenu_image()Simon Glass
The mkimage call is done twice. Remove the duplicate. Signed-off-by: Simon Glass <sjg@chromium.org>
2024-11-01Merge patch series "fs: ext4: implement opendir, readdir, closedir"Tom Rini
Heinrich Schuchardt <heinrich.schuchardt@canonical.com> says: With this series opendir, readdir, closedir are implemented for ext4. These functions are needed for the UEFI sub-system to interact with the ext4 file system. To reduce code growth the functions are reused to implement the ls command for ext4. A memory leak in ext4fs_exists is resolved. ext4fs_iterate_dir is simplified by removing a redundant pointer copy. Link: https://lore.kernel.org/r/20241026064048.370062-1-heinrich.schuchardt@canonical.com
2024-11-01fs: ext4: use fs_ls_genericHeinrich Schuchardt
Now that opendir, readir, closedir are implemented for ext4 we can use fs_ls_generic() for implementing the ls command. Adjust the unit tests: * fs_ls_generic() produces more spaces between file size and name. * The ext4 specific message "** Can not find directory. **\n" is not written anymore. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2024-11-01test/py: spi: prevent overwriting relocation memoryPadmarao Begari
Update spi negative test case to prevent SF command from overwriting relocation memory area. Signed-off-by: Padmarao Begari <padmarao.begari@amd.com> Reviewed-by: Tom Rini <trini@konsulko.com> Reviewed-by: Love Kumar <love.kumar@amd.com>
2024-10-30cmd/eficonfig: capitalize 'enter description'Heinrich Schuchardt
To conform with other messages capitalize the first letter: %s/enter description/Enter description/g Adjust the unit tests accordingly. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2024-10-27test: efi_loader: Fix dependency for http testAndrew Goodbody
The config setting CMD_BOOTEFI_HELLO_COMPILE was removed in favour of BOOTEFI_HELLO_COMPILE but the dependency for test_efi_helloworld_net_http was not updated and so is now incorrect preventing the test from ever running. Fix it. Fixes: 6fe80876dcc7 ("efi_loader: Rename and move CMD_BOOTEFI_HELLO_COMPILE") Signed-off-by: Andrew Goodbody <andrew.goodbody@linaro.org> Reviewed-by: Tom Rini <trini@konsulko.com> Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2024-10-27Merge patch series "Implement ACPI on aarch64"Tom Rini
Patrick Rudolph <patrick.rudolph@9elements.com> says: Based on the existing work done by Simon Glass this series adds support for booting aarch64 devices using ACPI only. As first target QEMU SBSA support is added, which relies on ACPI only to boot an OS. As secondary target the Raspberry Pi4 was used, which is broadly available and allows easy testing of the proposed solution. The series is split into ACPI cleanups and code movements, adding Arm specific ACPI tables and finally SoC and mainboard related changes to boot a Linux on the QEMU SBSA and RPi4. Currently only the mandatory ACPI tables are supported, allowing to boot into Linux without errors. The QEMU SBSA support is feature complete and provides the same functionality as the EDK2 implementation. The changes were tested on real hardware as well on QEMU v9.0: qemu-system-aarch64 -machine sbsa-ref -nographic -cpu cortex-a57 \ -pflash secure-world.rom \ -pflash unsecure-world.rom qemu-system-aarch64 -machine raspi4b -kernel u-boot.bin -cpu cortex-a72 \ -smp 4 -m 2G -drive file=raspbian.img,format=raw,index=0 \ -dtb bcm2711-rpi-4-b.dtb -nographic Tested against FWTS V24.03.00. Known issues: - The QEMU rpi4 support is currently limited as it doesn't emulate PCI, USB or ethernet devices! - The SMP bringup doesn't work on RPi4, but works in QEMU (Possibly cache related). - PCI on RPI4 isn't working on real hardware since the pcie_brcmstb Linux kernel module doesn't support ACPI yet. Link: https://lore.kernel.org/r/20241023132116.970117-1-patrick.rudolph@9elements.com
2024-10-27acpi: Allocate and write ACPI tablesPatrick Rudolph
Allocate memory for ACPI tables in generic acpi code. When ACPI wasn't installed in other places, install the ACPI table using BLOBLISTs. This allows non x86 platforms to boot using ACPI only in case the EFI loader is being used, since EFI is necessary to advertise the location of the ACPI tables in memory. TEST: Booted QEMU SBSA (no QFW) using EFI and ACPI only. Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com> Reviewed-by: Simon Glass <sjg@chromium.org> Cc: Simon Glass <sjg@chromium.org> Cc: Tom Rini <trini@konsulko.com>
2024-10-24cmd: bcb: introduce 'ab_dump' command to print BCB block contentDmitry Rokosov
It's really helpful to have the ability to dump BCB block for debugging A/B logic on the board supported this partition schema. Command 'bcb ab_dump' prints all fields of bootloader_control struct including slot_metadata for all presented slots. Output example: ===== > board# bcb ab_dump ubi 0#misc > Read 512 bytes from volume misc to 000000000bf07580 > Read 512 bytes from volume misc to 000000000bf42f40 > Bootloader Control: [misc] > Active Slot: _a > Magic Number: 0x42414342 > Version: 1 > Number of Slots: 2 > Recovery Tries Remaining: 0 > CRC: 0x2c8b50bc (Valid) > > Slot[0] Metadata: > - Priority: 15 > - Tries Remaining: 0 > - Successful Boot: 1 > - Verity Corrupted: 0 > > Slot[1] Metadata: > - Priority: 14 > - Tries Remaining: 7 > - Successful Boot: 0 > - Verity Corrupted: 0 ==== The ab_dump command allows you to display ABC data directly on the U-Boot console. During an A/B test execution, this test verifies the accuracy of each field within the ABC data. Signed-off-by: Dmitry Rokosov <ddrokosov@salutedevices.com> Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> Tested-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> # vim3_android Link: https://lore.kernel.org/r/20241017-android_ab_master-v5-5-43bfcc096d95@salutedevices.com Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
2024-10-24treewide: bcb: move ab_select command to bcb subcommandsDmitry Rokosov
To enhance code organization, it is beneficial to consolidate all A/B BCB management routines into a single super-command. The 'bcb' command is an excellent candidate for this purpose. This patch integrates the separate 'ab_select' command into the 'bcb' group as the 'ab_select' subcommand, maintaining the same parameter list for consistency. Signed-off-by: Dmitry Rokosov <ddrokosov@salutedevices.com> Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> Tested-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> # vim3_android Link: https://lore.kernel.org/r/20241017-android_ab_master-v5-3-43bfcc096d95@salutedevices.com Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
2024-10-15test: Fix skip check for sleep command testAndrew Goodbody
When the config option CMD_MISC was renamed to CMD_SLEEP the check in the test for the sleep command was not updated. Do that now. Fixes: 16060854095 ("cmd: Rename CMD_MISC to CMD_SLEEP") Signed-off-by: Andrew Goodbody <andrew.goodbody@linaro.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2024-10-15test: Fix mulptiplex_log typoSimon Glass
Fix a typo in a comment. Signed-off-by: Simon Glass <sjg@chromium.org>
2024-10-15test: Tidy up remaining exceptionsSimon Glass
Use the new handle_exception() function from ConsoleBase also. Signed-off-by: Simon Glass <sjg@chromium.org>
2024-10-15test: Detect dead connectionsSimon Glass
When the connection to a board dies, assume it is dead forever until some user action is taken. Skip all remaining tests. This avoids CI runs taking an hour, with hundreds of 30-second timeouts all to no avail. Signed-off-by: Simon Glass <sjg@chromium.org>
2024-10-15test: Separate out the exception handlingSimon Glass
The tests currently catch a very broad Exception in each case. This is thrown even in the event of a coding error. We want to handle exceptions differently depending on their severity, so that we can avoid hour-long delays waiting for a board that is clearly broken. As a first step, create some new exception types, separating out those which are simply an unexpected result from executed a command, from those which indicate some kind of hardware failure. Signed-off-by: Simon Glass <sjg@chromium.org>
2024-10-15test: Move the receive code into a functionSimon Glass
There is quite a bit of code to deal with receiving data from the target so move it into its own receive() function. Signed-off-by: Simon Glass <sjg@chromium.org>
2024-10-15test: Create a common function to get the configSimon Glass
The settings are decoded in two places. Combine them into a new function, before (in a future patch) expanding the number of items. Signed-off-by: Simon Glass <sjg@chromium.org>