[PATCH v2 21/32] test: cmd: fdt: Test fdt get addr

Simon Glass sjg at chromium.org
Wed Mar 8 23:16:46 CET 2023

Add 'fdt get addr' test which works as follows:
- Create fuller FDT, map it to sysmem
- Get address of various properties
- Compare addresses calculated by UT and fdt command

This test is special in that it has to go through gruesome remapping scheme
where the test calculates:
- pointer offsets of the generated FDT root and the property being tested
- map_sysmem() result of environment variable "fdtaddr" and the one set
  by the test matching address of property being tested
- difference between the later and the former, to obtain offset of the
  DT property from start of DT
The offsets must match in both the UT and the tested U-Boot, if they do
not, the test fails.

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 at mailbox.org>
Reviewed-by: Simon Glass <sjg at chromium.org>
Cc: Heinrich Schuchardt <heinrich.schuchardt at canonical.com>
Cc: Simon Glass <sjg at chromium.org>
Cc: Tom Rini <trini at konsulko.com>
V2: Do assignment first, assert second
    Add RB from Simon
 test/cmd/fdt.c | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 67 insertions(+)

Applied to u-boot-dm/next, thanks!

More information about the U-Boot mailing list