The error that this test checks for is only shown on sandbox. For real
boards, there is normally no error. Add a special case to handle this.
Signed-off-by: Simon Glass <sjg@chromium.org>
Calling into sub-test functions should be done using ut_assertok() so
that the test exits immediately on failure. Add those which are
missing.
Signed-off-by: Simon Glass <sjg@chromium.org>
This test assumes that the stack pointer is the same across two calls
to lmb_init_and_reserve() but this is not the case on x86, for example.
Add a special case to handle this, along with a detailed comment.
Signed-off-by: Simon Glass <sjg@chromium.org>
Add a new suite for 'cmd' tests, used for testing commands. These are
kept in the test/cmd directory.
For now it is empty, but it will be used for coreboot-command tests.
Signed-off-by: Simon Glass <sjg@chromium.org>
Systems without getopt support fall back to plain full bdinfo print,
handle such a case, which occurs e.g. with sandbox_flattree_defconfig .
Fixes: 8827a38714 ("test: bdinfo: Test bdinfo -h")
Fixes: 2696f3ab81 ("test: bdinfo: Test bdinfo -m")
Fixes: 3ff2d796a6 ("test: bdinfo: Test bdinfo -e")
Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
The bdinfo -e should print only the board ethernet settings.
Test the expected output.
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
The bdinfo -m should print only the board memory layout.
Test the expected output.
Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
The bdinfo -h should print error message that -h is an unknown
parameter and then command help text. Test the expected output.
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Factor out the core of test for all bdinfo output into bdinfo_test_all()
and then reuse it to verify that both 'bdinfo' and 'bdinfo -a' print all
the bdinfo output.
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Rename bdinfo_test_move() to bdinfo_test_full(). The former is a
remnant of deriving this test from another test. No functional
change.
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Current code allows up to 3 MBR partitions without extended one.
If more than 3 partitions are required, then extended partition(s)
must be used.
This commit allows up to 4 primary MBR partitions without the
need for extended partition.
Add mbr test unit. In order to run the test manually, mmc6.img file
of size 12 MiB or greater is required in the same directory as u-boot.
Test also runs automatically via ./test/py/test.py tool.
Running mbr test is only supported in sandbox mode.
Signed-off-by: Alex Gendin <agendin@matrox.com>
[ And due to some further changes for testing ]
Signed-off-by: Simon Glass <sjg@chromium.org>
There is a function for this but it is never used. Showing the history is
a useful feature, so add a new 'history' command.
Signed-off-by: Simon Glass <sjg@chromium.org>
Provide armffa command showcasing the use of the U-Boot FF-A support
armffa is a command showcasing how to invoke FF-A operations.
This provides a guidance to the client developers on how to
call the FF-A bus interfaces. The command also allows to gather secure
partitions information and ping these partitions. The command is also
helpful in testing the communication with secure partitions.
For more details please refer to the command documentation [1].
A Sandbox test is provided for the armffa command.
[1]: doc/usage/cmd/armffa.rst
Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Cc: Jens Wiklander <jens.wiklander@linaro.org>
Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
This reverts commit d927d1a808, reversing
changes made to c07ad9520c.
These changes do not pass CI currently.
Signed-off-by: Tom Rini <trini@konsulko.com>
Add Sandbox test for the armffa command
Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Cc: Jens Wiklander <jens.wiklander@linaro.org>
These are useful pieces of information when debugging. The RAM top shows
where U-Boot started allocating memory from, before it relocated. The
stack pointer can be checked to ensure it is in the correct region.
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Nikhil M Jain <n-jain1@ti.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Nikhil M Jain <n-jain1@ti.com>
It is useful to see the detailed setting of the serial port, e.g. to
allow setting up earlycon or console for Linux. Add this output to the
'bdinfo' command.
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
[bmeng: squashed in 20230716033929.253357-2-sjg@chromium.org]
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
This test was written for the incorrect use of assertions. Update it to
build with the previous approach, where tests fail at the first
assertion.
All assertion functions return 0 on success and non-zero on failure.
They can be nested into functions simply by declaring a function that
returns an int and using ut_assertok() to call it.
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
Wrap the assert macros in ({ ... }) so they can be safely used both as
right side argument as well as in conditionals without curly brackets
around them. In the process, find a bunch of missing semicolons, fix
them.
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Add list of missing tests for the 'fdt' command, currently
the missing sandbox tests are only 'fdt boardsetup' and
'fdt checksign' .
Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Add 'fdt bootcpu' test which works as follows:
- Create basic FDT, map it to sysmem
- Print the FDT bootcpu
- Set the FDT bootcpu and read the value back using 'fdt header get'
- Perform the previous step twice to validate bootcpu overwrite
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>
Add 'fdt rm' test which works as follows:
- Create fuller FDT, map it to sysmem
- Selectively delete nodes or properties by both path and aliases
- Verify created nodes or properties using fdt print command
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>
Add 'fdt mknode' test which works as follows:
- Create fuller FDT, map it to sysmem
- Create node either in / or subnode
- Attempt to create node over existing node, which fails
- Attempt to create subnodes in non-existing nodes or aliases
- Verify created nodes using fdt list command
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>
Add 'fdt set' test which works as follows:
- Create fuller FDT, map it to sysmem
- Set either existing property to overwrite it, or new property
- Test setting both single properties as well as string and integer arrays
- Test setting to non-existent nodes and aliases
- Verify set values using 'fdt get value'
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>
Add 'fdt get size' test which works as follows:
- Create fuller FDT, map it to sysmem
- Get size of various properties
- Get node count of available nodes
- Test non-existent nodes and properties
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>
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@mailbox.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Add 'fdt get name' test which works as follows:
- Create fuller FDT, map it to sysmem
- Get name of / node 0, 1 and /clk-test node 0
- Compare output and validate the node name
- Get name of / node 2 and /clk-test node 1
- Compare output and validate the node is not present
- Get name of / node -1 and /clk-test node -1
- Compare output and validate the node name equals node 0 name
- Check nonexistent node, verify the command errors out
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>
Add 'fdt resize' test which works as follows:
- Create simple FDT with extra size 0, map it to sysmem
- 'resize' the FDT by 0x2000 bytes
- Verify the new space has been added to the FDT
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>
Add 'fdt move' test which works as follows:
- Create simple FDT, map it to sysmem
- 'move' the FDT into new zeroed out sysmem location
- Verify newly active FDT is in the new location
- Compare both locations
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>
The 'fdt get value' subcommand now supports extraction of integer value
from integer arrays, add test for it, including a test for special case
unindexed integer array read, which is handled as hash and treated as a
long string instead of integer.
Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
The 'fdt' command help contains the following note:
"
Dereference aliases by omitting the leading '/', e.g. fdt print ethernet0.
"
Add test for it.
Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Implement function to generate internal test DT fragment and switch
the 'fdt get value' test to this instead of depending on the sandbox
DT. Rename clk-test node to test-node node. This FDT fragment will be
reused by other tests. No functional change.
Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Simon Glass <sjg@chromium.org>