Commit graph

789 commits

Author SHA1 Message Date
Tom Rini
a3b71cc6f5 Merge patch series "upl: Prerequite patches for updated spec"
Simon Glass <sjg@chromium.org> says:

The current UPL spec[1] has been tidied up and improved over the last
year, since U-Boot's original UPL support was written.

This series includes some prerequisite patches needed for the real UPL
patches. It is split from [2]

[1] https://github.com/UniversalPayload/spec/tree/3f1450d
[2] https://patchwork.ozlabs.org/project/uboot/list/?series=438574&state=*

Link: https://lore.kernel.org/r/20250111000029.245022-1-sjg@chromium.org
2025-01-22 17:08:47 -06:00
Simon Glass
5e0c63d04c test: Fix inpected typo in upl test
Fix a typo in the test comment.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-01-22 15:58:04 -06:00
Tom Rini
178f6ecb21 Merge patch series "bootstd: Support recording images"
Simon Glass <sjg@chromium.org> says:

This series provides a way to keep track of the images used in bootstd,
including the type of each image.

At present this is sort-of handled by struct bootflow but in quite an
ad-hoc way. The structure has become quite large and is hard to query.
Future work will be able to reduce its size.

Ultimately the 'bootflow info' command may change to also show images as
a list, but that is left for later, as this series is already fairly
long. So for now, just introduce the concept and adjust bootstd to use
it, with a simple command to list the images.

This series includes various alist enhancements, to make use of this new
data structure a little easier.

[trini: Drop patch 18 and 19 for now due to size considerations]

Link: https://lore.kernel.org/r/20241115231926.211999-1-sjg@chromium.org
2025-01-15 19:27:14 -06:00
Simon Glass
d9055f5e4f bootstd: Add a simple command to list images
Add a new 'bootstd images' command, which lists the images which have
been loaded.

Update some existing tests to use it. Provide some documentation about
images in general and this command in particular.

Use a more realistic kernel command-line to make the test easier to
follow.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-01-15 08:48:42 -06:00
Tom Rini
079214e4be Merge patch series "SMBIOS improvements"
Raymond Mao <raymond.mao@linaro.org> says:

Motivations for changes:
Current SMBIOS library and command-line tool is not fully matching with
the requirements:
1. Missing support for other mandatory types (#7, #9, #16, #17, #19).
2. Only a few platforms support SMBIOS node from the device tree.
3. Values of some fields are hardcoded in the library other than fetching
   from the device hardware.
4. Embedded data with dynamic length is not supported (E.g. Contained
   Object Handles in Type #2 and Contained Elements in Type #3)

Changes:
1. Refactor the SMBIOS library and command-line tool to better align with
   the SMBIOS spec.
2. Create an arch-specific driver for all aarch64-based platforms to fetch
   SMBIOS private data from the device hardware (processor and cache).
3. Create a sysinfo driver to poppulate platform SMBIOS private data.
4. Add generic SMBIOS DTS file for arm64 platforms for those common strings
   and values which cannot be retrieved from the system registers.
   Vendors can create their own SMBIOS node using this as an example.
   For those boards without SMBIOS nodes, this DTS file can be included to
   have a generic SMBIOS information of the system.
5. Add support for Type #7 (Cache Information) and link its handles to
   Type #4.
6. To minimize size-growth for those platforms which have not sufficient
   ROM spaces or the platforms which don't need detailed SMBIOS
   information, new added fields are only being built when kconfig
   GENERATE_SMBIOS_TABLE_VERBOSE is selected.

Once this patch is acceptted, subsequent patch sets will add other missing
types (#9, #16, #17, #19).

Tests:
To test this with QEMU arm64, please follow the guide on dt_qemu.rst to
get a merged DT to run with.
```
qemu-system-aarch64 -machine virt -machine dumpdtb=qemu.dtb
cat  <(dtc -I dtb qemu.dtb) <(dtc -I dtb ./dts/dt.dtb | grep -v /dts-v1/) \
  | dtc - -o merged.dtb
qemu-system-aarch64 -machine virt -nographic -bios u-boot.bin \
  -dtb merged.dtb
```

Link: https://lore.kernel.org/r/20241206225438.13866-1-raymond.mao@linaro.org
2025-01-14 14:29:49 -06:00
Raymond Mao
e6285168f8 cmd: update smbios cmd
Update the cmd according to the changes of the smbios library:
1. Refactor smbios cmd print functions to match the content defined
   by the specification.
2. Add new print functions for Type 3, 4 and 7.
3. Remove the fallback string "Not specified" from smbios_get_string,
   as the spec requires a NULL output for those undefined strings.
4. Update the test_cmd_smbios_sandbox pytest expected result to
   align with the smbios library changes and add new pytest
   test_cmd_smbios_sysinfo_verbose to test the verbose smbios
   output.

Signed-off-by: Raymond Mao <raymond.mao@linaro.org>
2025-01-14 14:29:29 -06:00
Heinrich Schuchardt
d01720a830 test: fix test_extension.py
test_extension.py assumes that no extension is known at test start.
This assumption is wrong because we do not come out of reboot.
A prior test may have already hunted for the extension bootdev.

Remove the invalid assert.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2025-01-05 02:30:47 +01:00
Tom Rini
2eb74974de Merge patch series "Add 'trace wipe'"
Jerome Forissier <jerome.forissier@linaro.org> says:

This short series adds the 'trace wipe' command which clears the trace
buffer, allowing to re-start a capture from scratch.

Link: https://lore.kernel.org/r/cover.1734093566.git.jerome.forissier@linaro.org
2025-01-01 10:40:33 -06:00
Jerome Forissier
905204ddcf test: test_trace.py: test 'trace wipe'
Test the newly added 'trace wipe' command.

Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2024-12-31 19:00:46 -06:00
Tom Rini
5cfbf8c364 Prepare v2025.01-rc5
-----BEGIN PGP SIGNATURE-----
 
 iQGzBAABCgAdFiEEGjx/cOCPqxcHgJu/FHw5/5Y0tywFAmdqIAsACgkQFHw5/5Y0
 tyxmdAv/a0dUsibc2oyLJzRFioJO6ib0dro5EHiH1oyF3igOTGe1ifxeQyR/0bb8
 /3Qtr19f77INNjgQmRNpLbBfeoIMm3MeVF+zwQzEvUDEHNNQ0nnxu/yNnJB6Ebej
 xF/vdAP4JoV+KFQXMCMjIyFZcjZh4wGn1L1T8y7GQHS+p1zf0EYA7tPbk5rbwk/E
 xAFSymtWvOZVjLgV9YKp/RqS1+vGHaKydwzUZAncXJzeAMFD2Wm7mnDkd828U/eR
 7vs5BCnRwTgj7iWE6KXJUhFz2hrrBMFTEIV4GNW28vBSCoArlWshLbpKRolEoKY9
 i+dfkBDhghw9fVcTBOSP7BkiFwQl02jPB4Vf8G5ykK11CHO8XTpdjE5buGS1zsiW
 dTX9w4pynCl07p0qYsgGPYf2cE1k6dG6XFNUzH3owyNGiF+66VQeG05V79moQp9F
 ZF0/rux475UhZceXDImdecgkBDsc9gRvu0aX9ZYQtaBCgKJnQ8nyYPXGWZ/u0TSl
 1WVADGUq
 =4mOT
 -----END PGP SIGNATURE-----

Merge tag 'v2025.01-rc5' into next

Prepare v2025.01-rc5
2024-12-25 22:31:04 -06:00
Simon Glass
a8f09d6282 test/py: Always use the current dir as the source tree
The logic in get_details() retrieves the default source directory from
the Labgrid settings. This is convenient for interactive use, since it
allows pytests to be run from any directory and still find the source
tree.

However, it is not actually correct.

Gitlab sets the current directory to the source tree and expects that to
be used. At present it is ignored. The result is that Gitlab builds
whatever happens to be in the default source directory, ignoring the
tree it is supposed to be building.

Fix this by using the directory of the source tree, always. This is
obtained by looking at the grandparent of the conftest.py file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Tom Rini <trini@konsulko.com>
Fixes: bf89a8f1fc ("test: Introduce the concept of a role")
Tested-by: Tom Rini <trini@konsulko.com>
2024-12-17 09:11:43 -06:00
Tom Rini
df863c4aa3 AMD/Xilinx changes for v2025.04-rc1
binman:
 - Separate binman description from main DT
 
 zynqmp:
 - Enable binman for ZynqMP platforms
 - DT sync with Linux v6.12
 - Update usb5744 hub for SOMs
 
 common:
 - Drop SPL_FIT_GENERATOR support
 
 versal2
 - Enable OPTEE layers
 
 ospi:
 - Refactor the flash reset functionality
 
 pytest:
 - Fix tcminit mode handling
 -----BEGIN PGP SIGNATURE-----
 
 iF0EABECAB0WIQQbPNTMvXmYlBPRwx7KSWXLKUoMIQUCZ0m53AAKCRDKSWXLKUoM
 Ie4PAJ4r7EHkSngpW3QdBEb15aLxN1pC4ACcC9DDGGn04kCTChpv0CEi/kRLUBU=
 =Veyg
 -----END PGP SIGNATURE-----

Merge tag 'xilinx-for-v2025.04-rc1' of https://gitlab.denx.de/u-boot/custodians/u-boot-microblaze into next

AMD/Xilinx changes for v2025.04-rc1

binman:
- Separate binman description from main DT

zynqmp:
- Enable binman for ZynqMP platforms
- DT sync with Linux v6.12
- Update usb5744 hub for SOMs

common:
- Drop SPL_FIT_GENERATOR support

versal2
- Enable OPTEE layers

ospi:
- Refactor the flash reset functionality

pytest:
- Fix tcminit mode handling
2024-12-03 15:51:56 -06:00
Tom Rini
c33be116dc Merge patch series "CI: Set up for an arm64 runner"
Tom Rini <trini@konsulko.com> says:

Hey all,

This is picking up Simon's v5 of the above-named series and making a few
more changes so that the follow-up series I have leads to arm64 being
supported for almost all jobs. To quote Simon's cover letter:

All gitlab runners are currently amd64 machines. This series attempts to
create a docker image which can also support arm64 so that sandbox tests
can be run on it.

The TARGET_... environment variables for grub could perhaps be adjusted,
using the new variables, but I have not done that for now.

Adding to what Simon said, we now build grub for all architectures as
the reason to install it was to be able to use the binaries in QEMU.
That won't provide us with amd64 binaries on arm64 hosts so we can't use
that shortcut anymore.

Link: https://lore.kernel.org/r/20241127172247.1488685-1-trini@konsulko.com
2024-12-03 09:24:23 -06:00
Heinrich Schuchardt
bc2a1b3c92 test: add command to 'Boot fail' message
When a timeout occurs while executing a command a 'Boot fail' message is
written and testing is stopped. The user is left in the dark about the
failure cause.

    ! _pytest.outcomes.Exit: Boot fail: Marking connection bad - no other tests will run !

Add the executed command to the message.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2024-11-29 14:41:47 -06:00
Heinrich Schuchardt
9c7b3dd091 test: add command to 'Lab failure' timeout message
When a timeout occurs while executing a command a 'Lab failure' message is
written and testing is stopped. The user is left in the dark about the
failure cause.

    ! _pytest.outcomes.Exit: Lab failure: Marking connection bad - no other tests will run !

Add the word 'Timeout' and the executed command to the message.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2024-11-29 14:41:47 -06:00
Tom Rini
230284b3e8 Merge patch series "test: Avoid needing sudo for image-creation"
Simon Glass <sjg@chromium.org> says:

This series rebases and tidies up a series sent by Richard Weinberger
to use unprivileged code to build the test images.

Link: https://patchwork.ozlabs.org/project/uboot/list/?series=417786&state=*
Link: https://lore.kernel.org/r/20241121223217.330117-1-sjg@chromium.org
Signed-off-by: Tom Rini <trini@konsulko.com>
2024-11-29 14:41:47 -06:00
Simon Glass
52efbc9522 bootstd: Remove prepared images
These are no-longer used. Drop them.

Signed-off-by: Simon Glass <sjg@chromium.org>
2024-11-29 14:41:47 -06:00
Simon Glass
6e32ca33ae test_ut: Drop support for fallback files
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-29 14:41:47 -06:00
Simon Glass
2042ed38a8 test_ut: Use the built mkimage
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-29 14:41:47 -06:00
Simon Glass
ac1c547092 test_ut: Drop exeception handling
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-29 14:41:47 -06:00
Richard Weinberger
d83143eb55 test_ut: Allow running unprivileged
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-29 14:41:46 -06:00
Simon Glass
0a4c69b1f0 test_ut: Add an image size to setup_image()
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-29 14:41:46 -06:00
Richard Weinberger
c6504372c6 test_fs: Rename mount dir to scratch
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-29 14:41:46 -06:00
Richard Weinberger
463bc7b82e test_fs: Allow running unprivileged
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-29 14:41:46 -06:00
Love Kumar
e013f0c592 test/py: zynqmp_rpu: Fix tcminit mode value
Update the tcminit value to string and number both as per commit
342ccba558 ("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-29 13:21:17 +01:00
Simon Glass
bda30f83f9 bootstd: Remove prepared images
These are no-longer used. Drop them.

Signed-off-by: Simon Glass <sjg@chromium.org>
2024-11-26 11:13:39 -06:00
Simon Glass
01c0695d9d test_ut: Drop support for fallback files
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-26 11:13:39 -06:00
Simon Glass
2fad73a166 test_ut: Use the built mkimage
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-26 11:13:39 -06:00
Simon Glass
22eef59dd3 test_ut: Drop exeception handling
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-26 11:13:39 -06:00
Richard Weinberger
360315b360 test_ut: Allow running unprivileged
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-26 11:13:39 -06:00
Simon Glass
fde4e53aaa test_ut: Add an image size to setup_image()
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-26 11:13:39 -06:00
Richard Weinberger
c25e8ceea4 test_fs: Rename mount dir to scratch
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-26 11:13:39 -06:00
Richard Weinberger
5b2ea71eaf test_fs: Allow running unprivileged
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-26 11:13:39 -06:00
Guillaume La Roque
126254ab97 bootstd: Add test for Android boot image v2
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-26 09:59:01 +01:00
Tom Rini
48380f9b2a Prepare v2025.01-rc3
-----BEGIN PGP SIGNATURE-----
 
 iQGzBAABCgAdFiEEGjx/cOCPqxcHgJu/FHw5/5Y0tywFAmdFAVQACgkQFHw5/5Y0
 tyyyfQwAuHAoOJ2Q5KnesduF9tkzeSRoziCNig3D+VItbJSxKqnBxPB9U+AxxsZ8
 JVA1e5qSwcblqybyWHrFUVTYVlI4j9oJIOTQKtEmUnDUNY+vd5eT9+V8kmQqnbU0
 mhE8fuH6wSHQ3K+tdVSJuWxcZJfFOE5dZKAxz0z/LysqNfJ/r/iqg2l0YYozId2s
 Kyyq7K25jNilcWAw4zUbGcdvM+H53KNzQ3WcZ36HwenlXWoQJOKCbEEskYxAaa0e
 hSEAQCNeuD1oVoZH1jc9dP6htLx5gmOaSbIScwfaOMqBQHyWQTjv/sMEy8wGSMdA
 PqDGClxU0GCenhbS6waY9GPMLYV0JtyXsAmjrWUOXStLrGMBCrP6Xu6T2Ol7+7pt
 O+ZPZM5Xhmo0UR2sY4sWjDIC1AHVXaLZlbC7vfjadkZ30UZvwIXgDFJemS3nDW96
 /JJo/6sgdLGJGvNYGb4mitKO5+kIiz6kKeMvzcfBj+PWybfYhUbqc/AARtlf9Hzp
 +gvtFlCF
 =Q9hw
 -----END PGP SIGNATURE-----

Merge tag 'v2025.01-rc3' into next

Prepare v2025.01-rc3
2024-11-25 17:34:08 -06:00
Love Kumar
b9e0048b6d test/py: mmc: Add support for different mmc modes
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-17 13:14:22 -06:00
Love Kumar
a730947974 test/py: usb: Distinguish b/w ext2/ext4 partitions
'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-17 13:14:18 -06:00
Love Kumar
87a9f499ab test/py: mmc: Distinguish b/w ext2/ext4 partitions
'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-17 13:14:13 -06:00
Love Kumar
92e1c2bf9e test/py: spi: Rephrase the warning/error messages
Rephrasing the error and warning messages to be more meaningful and
clear.

Signed-off-by: Love Kumar <love.kumar@amd.com>
2024-11-15 13:11:29 -06:00
Simon Glass
5e92fbcefc test: Correct regex string in test_spi
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-13 12:01:35 -06:00
Simon Glass
8f2a9fa7d6 test: Support testing with two board-builds
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-13 12:01:35 -06:00
Simon Glass
6d0ff32650 test: Add a section for closing the connection
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-13 12:01:35 -06:00
Simon Glass
082f3359c7 test: Try to shut down the lab console gracefully
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-13 12:01:35 -06:00
Simon Glass
5825ddccc6 test: Avoid double echo when starting up
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-13 12:01:35 -06:00
Simon Glass
f32951df40 test: Improve handling of sending commands
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-13 12:01:35 -06:00
Simon Glass
8308a5eed6 test: Introduce lab mode
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-13 12:01:35 -06:00
Simon Glass
bf89a8f1fc test: Introduce the concept of a role
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-13 12:01:35 -06:00
Simon Glass
6f3583074f test: Allow connecting to a running board
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-13 12:01:35 -06:00
Simon Glass
530c694c45 test: Release board after tests complete
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-13 12:01:35 -06:00
Simon Glass
8344038a93 test: Allow signaling that U-Boot is ready
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-13 12:01:35 -06:00