Commit Graph

15 Commits

Author SHA1 Message Date
Simon Glass a7a98755b8 test: Add a macros for finding tests in linker_lists
At present we use the linker list directly. This is not very friendly, so
add a helpful macro instead. This will also allow us to change the naming
later without updating this code.

Signed-off-by: Simon Glass <sjg@chromium.org>
2021-03-12 09:57:30 -05:00
Simon Glass f7ae49fc4f common: Drop log.h from common header
Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-05-18 21:19:18 -04:00
Simon Glass 0914011310 command: Remove the cmd_tbl_t typedef
We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-05-18 18:36:55 -04:00
Simon Glass 4d72caa5b9 common: Drop image.h from common header
Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-05-18 17:33:33 -04:00
Philippe Reynes 4ad4edfe77 cmd_ut: add a parameter prefix to the function cmd_ut_category
There is black magic in the file conftest.py that list
all the test unit. Then, all those test unit are called
in pytest. This call is done with the end of the name
(for example checksum if the full name is bloblist_test_checksum).

The result is that only test for dm are really executed.
by pytest, all others tests are listed but never executed.

This behaviour happens because the dm test unit only check
the end of the name and others tests checks the full name.

To fix this issue, I've added a prefix to the function
cmd_ut_category, and this prefix is removed when looking
for the unit test.

Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
Tested-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2020-01-07 11:13:25 -05:00
Heinrich Schuchardt 5766a27176 tests: enable DT overlay tests by default
Enable device tree overlay tests by default if unit tests are selected
and the runtime is configured via device tree.

Overlays have been mainlined in the device tree compiler so there is no
reason anymore to disable the tests by default.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2018-12-26 18:24:26 -05:00
Heinrich Schuchardt 3cc137616d test: overlay: NULL passed as fdt
The uts created in do_ut_overlay() is not the one used in
cmd_ut_category(). Currently all tests are therefore called with
uts->priv = NULL and fail.

Using a static variable is the easiest fix here.

Fixes: e93232e15e ("test: overlay: Use cmd_ut_category()")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2018-12-12 12:14:24 -05:00
Heinrich Schuchardt d796735c33 test: overlay: add missing include
Compiling the overlay unit test fails with odroid-c2_defconfig showing
errors like:

    test/overlay/cmd_ut_overlay.c:29:8:
    error: unknown type name ‘fdt32_t’

Add the missing include.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
2018-10-22 09:18:49 -04:00
Tom Rini 83d290c56f SPDX: Convert all of our single license tags to Linux Kernel style
When U-Boot started using SPDX tags we were among the early adopters and
there weren't a lot of other examples to borrow from.  So we picked the
area of the file that usually had a full license text and replaced it
with an appropriate SPDX-License-Identifier: entry.  Since then, the
Linux Kernel has adopted SPDX tags and they place it as the very first
line in a file (except where shebangs are used, then it's second line)
and with slightly different comment styles than us.

In part due to community overlap, in part due to better tag visibility
and in part for other minor reasons, switch over to that style.

This commit changes all instances where we have a single declared
license in the tag as both the before and after are identical in tag
contents.  There's also a few places where I found we did not have a tag
and have introduced one.

Signed-off-by: Tom Rini <trini@konsulko.com>
2018-05-07 09:34:12 -04:00
Simon Glass e93232e15e test: overlay: Use cmd_ut_category()
Adjust the code to use the common test-execution function.

Signed-off-by: Simon Glass <sjg@chromium.org>
2017-12-02 18:32:58 -05:00
Tom Rini d91062c41e test/overlay: Fix various malloc/free leaks
With the overlay tests now being built in sandbox Coverity has found a
number of issues in the tests.  In short, if malloc ever failed we would
leak the previous mallocs, so we need to do the usual goto pattern to
free each in turn.  Finally, we always looked at the free()d location to
see how many tests had failed for the return code.

Reported-by: Coverity (CID: 167224, 167227, 167230, 167236)
Signed-off-by: Tom Rini <trini@konsulko.com>
2017-10-06 11:28:20 -04:00
Pantelis Antoniou ea28e488f7 test: overlay: Add unit test for stacked overlay
Verify that stacked overlays work.

Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
Acked-by: Simon Glass <sjg@chromium.org>
2017-09-15 05:27:49 -06:00
Pantelis Antoniou 706708d3b2 ut: fix fdt_getprop_u32() change
fdt_getprop_u32 is not exported and it's different than what the
unit test uses. Rename u32 prop access methods to something that's
unit test specific.

Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
Acked-by: Simon Glass <sjg@chromium.org>
2017-09-15 05:27:49 -06:00
Simon Glass b02e4044ff libfdt: Bring in upstream stringlist functions
These have now landed upstream. The naming is different and in one case the
function signature has changed. Update the code to match.

This applies the following upstream commits by
Thierry Reding <treding@nvidia.com> :

   604e61e fdt: Add functions to retrieve strings
   8702bd1 fdt: Add a function to get the index of a string
   2218387 fdt: Add a function to count strings

Signed-off-by: Simon Glass <sjg@chromium.org>
2016-10-13 13:54:10 -06:00
Maxime Ripard f2a9942fbc tests: Introduce DT overlay tests
This adds a bunch of unit tests for the "fdt apply" command.

They've all been run successfully in the sandbox. However, as you still
require an out-of-tree dtc with overlay support, this is disabled by
default.

Acked-by: Simon Glass <sjg@chromium.org>
Acked-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
2016-08-20 11:35:07 -04:00