History log of /u-boot/test/Makefile
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 6a8a23cc 16-Dec-2023 Heinrich Schuchardt <xypron.glpk@gmx.de>

test: build test/boot for CONFIG_UT_BOOTSTD=n

Building sandbox_defconfig with

CONFIG_UT_BOOTSTD=n
CONFIG_MEASURMENT=y

results in an error:

/usr/bin/ld: test/cmd_ut.o:(.data.rel.cmd_ut_sub+0x408):
undefined reference to `do_ut_measurement'

Fixes: 5999ea20fa42 ("test: Add sandbox TPM boot measurement")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>

# cb1277cc 22-Dec-2023 Francis Laniel <francis.laniel@amarulasolutions.com>

test: Add framework to test hush behavior

Introduce a new subcommand to ut: ut hush.
For the moment, this command does nothing, future commits will add tests which
will be run on command call.

Note that CONFIG_HUSH_PARSER must be defined to compile this new subcommand.

Signed-off-by: Francis Laniel <francis.laniel@amarulasolutions.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 07073d2b 01-Oct-2023 Simon Glass <sjg@chromium.org>

test: Run bootstd tests only on sandbox

These make use of disk images which are not available on reak boards.
Add a new Kconfig to ensure these tests only run where they are valid.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c56468a6 14-Oct-2023 Sean Anderson <seanga2@gmail.com>

test: spl: Split tests up and use some configs

In order to make adding new spl unit tests easier, especially when they may
have many dependencies, add some Kconfigs for the existing image test.
Split it into the parts which are generic (such as callbacks) and the
test-specific parts.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 29784d62 01-Aug-2022 Simon Glass <sjg@chromium.org>

test: Add some tests for kconfig.h

The macros in this file are a little confusing and we currently have no
tests to check that they work as expected.

Add some tests which check the macros in C code. Add a few tests which
check that the build errors are generated correctly too, using buildman's
-a option.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 36f641c5 30-May-2022 Andrew Scull <ascull@google.com>

test: fuzz: Add framework for fuzzing

Add the basic infrastructure for declaring fuzz tests and a command to
invoke them.

Signed-off-by: Andrew Scull <ascull@google.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# fb1451be 24-Apr-2022 Simon Glass <sjg@chromium.org>

bootstd: Add tests for bootstd including all uclasses

Add a set of combined tests for the bootdev, bootflow and bootmeth
commands, along with associated functionality.

Expand the sandbox console-recording limit so that these can work.

These tests rely on a filesystem script which is not yet added to the
Python tests. It is included here as a shell script.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 25c8b9f2 08-Jul-2021 Steffen Jaeckel <jaeckel-floss@eyet-services.de>

test: add first autoboot unit tests

This adds tests for the crypt-based and plain SHA256-based password hashing
algorithms in the autoboot flow.

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f093f864 05-Jul-2021 Simon Glass <sjg@chromium.org>

test: Allow CONFIG_SPL_LOAD_FIT to be disabled

At present if this is not enabled on a sandbox build, the build fails. Add
a condition to avoid this.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 2e059e4a 07-Mar-2021 Simon Glass <sjg@chromium.org>

spl: test: Add a test for spl_load_simple_fit()

As an example of an SPL test, add a new test for loading a FIT within
SPL. This runs on sandbox_spl. For this to work, the text base is adjusted
so that there is plenty of space available.

While we are here, document struct spl_load_info properly, since this is
currently ambiguous.

This test only verifies the logic path. It does not actually check that
the image is loaded correctly. It is not possible for sandbox's SPL to
actually run u-boot.img since it currently includes u-boot.bin rather than
u-boot. Further work could expand the test in that direction.

The need for this was noted at:

http://patchwork.ozlabs.org/project/uboot/patch/20201216000944.2832585-3-mr.nuke.me@gmail.com/

Signed-off-by: Simon Glass <sjg@chromium.org>

# 1c721751 07-Mar-2021 Simon Glass <sjg@chromium.org>

test: Add an overall test runner

Add a new test runner that will eventually be able to run any test. For
now, have it run the 'command' unit tests, so that the functionality in
cmd_ut_category() moves into it.

Signed-off-by: Simon Glass <sjg@chromium.org>

# fe158657 17-Jan-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

test: inconsistent bootm tests

Excluding ut bootm in test/cmd_ut.c but compiling test/bootm.c results in
failure of the Python test invoking the C unit tests as observed on
sipeed_riscv_smode_defconfig:

FAILED test/py/tests/test_ut.py::test_ut[ut_bootm_nop]
FAILED test/py/tests/test_ut.py::test_ut[ut_bootm_nospace]
FAILED test/py/tests/test_ut.py::test_ut[ut_bootm_silent]
FAILED test/py/tests/test_ut.py::test_ut[ut_bootm_silent_var]
FAILED test/py/tests/test_ut.py::test_ut[ut_bootm_subst]
FAILED test/py/tests/test_ut.py::test_ut[ut_bootm_subst_both]
FAILED test/py/tests/test_ut.py::test_ut[ut_bootm_subst_var]

Only compile test/bootm.c on the sandbox.

Fixes: f158ba15ee0f ("bootm: Add tests for fixup_silent_linux()")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6ea5df39 08-Nov-2020 Simon Glass <sjg@chromium.org>

test: Only enable bloblist test when supported

This test cannot work unless CONFIG_BLOBLIST is enabled. Update it to add
that condition.

Reported-by: Kever Yang <kever.yang@rock-chips.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# f158ba15 05-Nov-2020 Simon Glass <sjg@chromium.org>

bootm: Add tests for fixup_silent_linux()

This function currently has no tests. Export it so that we can implement
a simple test on sandbox. Use IS_ENABLED() to remove the unused code,
instead #ifdef.

Signed-off-by: Simon Glass <sjg@chromium.org>

# de429d7b 31-Oct-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

test: linking test/compression.c fails

Building U-Boot with unit tests on a non-sandbox systems fails:

ld.bfd: test/built-in.o: in function `compress_using_gzip':
test/compression.c:138: undefined reference to `gzip'
ld.bfd: test/built-in.o: in function `uncompress_using_bzip2':
test/compression.c:187: undefined reference to `BZ2_bzBuffToBuffDecompress'
ld.bfd: test/built-in.o: in function `uncompress_using_lzma':
test/compression.c:222: undefined reference to `lzmaBuffToBuffDecompress'
ld.bfd: test/built-in.o: in function `uncompress_using_lzo':
test/compression.c:257: undefined reference to `lzop_decompress'
ld.bfd: test/built-in.o: in function `uncompress_using_lz4':
test/compression.c:292: undefined reference to `ulz4fn

Add the missing dependencies.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c961b1b5 31-Oct-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

test: test/bloblist.c depends on asm/state.h

Building test/bloblist.c fails for non sandbox devices:

test/bloblist.c:10:10: fatal error: asm/state.h: No such file or directory
#include <asm/state.h>
^~~~~~~~~~~~~

Build the test only on the sandbox.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 627988f9 03-Oct-2020 Simon Glass <sjg@chromium.org>

dm: test: Disable some tests that should not run in SPL

Tests are easier to run in U-Boot proper. Running them in SPL does not add
test coverage in most cases. Also some tests use features that are not
available in SPL.

Update the build rules to disable these tests in SPL. We still need
test-main to be able to actually run SPL tests.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 16a50683 03-Oct-2020 Simon Glass <sjg@chromium.org>

dm: test: Make use of CONFIG_UNIT_TEST

At present we always include test/dm from the main Makefile. We have a
CONFIG_UNIT_TEST that should control whether the test/ directory is built,
so rely on that instead.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 82c468a0 03-Oct-2020 Simon Glass <sjg@chromium.org>

dm: test: Update Makefile conditions

At present most of the tests in test/Makefile are dependent on
CONFIG_SANDBOX. But this is not ideal since they rely on commands being
available and SPL does not support commands.

Use CONFIG_COMMAND instead. This has the dual purpose of allowing these
tests to be used on other boards and allowing SPL to skip them.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 1cadc761 03-Oct-2020 Simon Glass <sjg@chromium.org>

dm: test: Sort the Makefile

Move everything into alphabetical order.

Signed-off-by: Simon Glass <sjg@chromium.org>

# bdded201 02-Jun-2020 Simon Glass <sjg@chromium.org>

cmd: Add a memory-search command

It is useful to be able to find hex values and strings in a memory range.
Add a command to support this.

cmd: Fix 'md' and add a memory-search command
At present 'md.q' is broken. This series provides a fix for this. It also
implements a new memory-search command called 'ms'. It allows searching
memory for hex and string data.
END

Signed-off-by: Simon Glass <sjg@chromium.org>

# 4f04d549 08-Apr-2020 Simon Glass <sjg@chromium.org>

test: Add the beginnings of some string tests

There are quite a few string functions in U-Boot with no tests. Make a
start by adding a test for strtoul().

Signed-off-by: Simon Glass <sjg@chromium.org>

# 395041b2 26-Feb-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

test: log functions with CONFIG_LOG=n

If CONFIG_LOG=n, we still expect output for log_err(), log_warning(),
log_notice(), log_info() and in case of DEBUG=1 also for log_debug().

Provide unit tests verifying this.

The tests depend on:

CONFIG_CONSOLE_RECORD=y
CONFIG_LOG=n
CONFIG_UT_LOG=y

It may be necessary to increase the value of CONFIG_SYS_MALLOC_F_LEN to
accommodate CONFIG_CONSOLE_RECORD=y.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 919e7a8f 15-Nov-2018 Simon Glass <sjg@chromium.org>

test: Add a simple test for bloblist

Add a unit test for the bloblist functionality and enable bloblist for
sandbox.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 87be2fe6 27-Sep-2018 Mario Six <mario.six@gdsys.cc>

test: list: Add tests for hexdump.c

Add tests for the hex2bin, bin2hex, and hex_to_bin functions, which were
recently added to U-Boot.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f11a164b 31-Aug-2018 Heinrich Schuchardt <xypron.glpk@gmx.de>

test: unit tests for Unicode functions

Provide unit tests for Unicode functions.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

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>

# ef11ed82 04-Dec-2017 Simon Glass <sjg@chromium.org>

log: Add a test command

Add a command which exercises the logging system.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e5a9d27f 15-Jun-2017 Simon Glass <sjg@chromium.org>

test: Add a test for snprintf() and the banner/version

Add a simple test to make sure that these functions obey the buffer size
passed into them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Stephen Warren <swarren@nvidia.com>

# c812f722 20-May-2015 Joe Hershberger <joe.hershberger@ni.com>

test: dm: Move the time test over to the ut command

Unify the command for running unit tests further by moving the "ut_time"
command over to "ut time".

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# c617ede0 20-May-2015 Joe Hershberger <joe.hershberger@ni.com>

test: Add a common unit test command

Add a command that all other unit tests should be a sub-command of.
Also include a command that will run all tests.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Acked-by: Simon Glass <sjg@chromium.org>

# e721b882 20-May-2015 Joe Hershberger <joe.hershberger@ni.com>

test: Generalize the unit test framework

Separate the ability to define tests and assert status of test functions
from the dm tests so they can be used more consistently throughout all
tests.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8271f5d4 02-May-2015 Simon Glass <sjg@chromium.org>

test: Add a simple time test

Sometimes the time functions are incorrect due to bad time support on a
board. Add a unit test which tries to detect this.

Signed-off-by: Simon Glass <sjg@chromium.org>

# bcfe8fdf 20-Oct-2013 Masahiro Yamada <masahiroy@kernel.org>

dts, api, test: convert makefiles to Kbuild style

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# 3153e915 16-Aug-2013 Kees Cook <keescook@chromium.org>

sandbox: add compression tests

This adds the "test_compression" command when building the sandbox. This
tests the existing compression and decompression routines for simple
sanity and for buffer overflow conditions.

Signed-off-by: Kees Cook <keescook@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 1a459660 08-Jul-2013 Wolfgang Denk <wd@denx.de>

Add GPL-2.0+ SPDX-License-Identifier to source files

Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini <trini@ti.com>

# a72007d9 30-Mar-2012 Simon Glass <sjg@chromium.org>

sandbox: Add basic test for command execution

Since run_command() and run_command_list() are important and a little
confusing, add some basic tests to check that the behaviour is correct.

Note: I am not sure that this should be committed, nor where it should go
in the source tree. Comments welcome.

To run the unit tests use the ut_cmd command available in sandbox:

make sandbox_config
make
./u-boot -c ut_cmd

(To test both hush and built-in parsers, you need to manually change
CONFIG_SYS_HUSH_PARSER in include/configs/sandbox.h and build/run again)

Signed-off-by: Simon Glass <sjg@chromium.org>

# cb1277cc 22-Dec-2023 Francis Laniel <francis.laniel@amarulasolutions.com>

test: Add framework to test hush behavior

Introduce a new subcommand to ut: ut hush.
For the moment, this command does nothing, future commits will add tests which
will be run on command call.

Note that CONFIG_HUSH_PARSER must be defined to compile this new subcommand.

Signed-off-by: Francis Laniel <francis.laniel@amarulasolutions.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 07073d2b 01-Oct-2023 Simon Glass <sjg@chromium.org>

test: Run bootstd tests only on sandbox

These make use of disk images which are not available on reak boards.
Add a new Kconfig to ensure these tests only run where they are valid.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c56468a6 14-Oct-2023 Sean Anderson <seanga2@gmail.com>

test: spl: Split tests up and use some configs

In order to make adding new spl unit tests easier, especially when they may
have many dependencies, add some Kconfigs for the existing image test.
Split it into the parts which are generic (such as callbacks) and the
test-specific parts.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 29784d62 01-Aug-2022 Simon Glass <sjg@chromium.org>

test: Add some tests for kconfig.h

The macros in this file are a little confusing and we currently have no
tests to check that they work as expected.

Add some tests which check the macros in C code. Add a few tests which
check that the build errors are generated correctly too, using buildman's
-a option.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 36f641c5 30-May-2022 Andrew Scull <ascull@google.com>

test: fuzz: Add framework for fuzzing

Add the basic infrastructure for declaring fuzz tests and a command to
invoke them.

Signed-off-by: Andrew Scull <ascull@google.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# fb1451be 24-Apr-2022 Simon Glass <sjg@chromium.org>

bootstd: Add tests for bootstd including all uclasses

Add a set of combined tests for the bootdev, bootflow and bootmeth
commands, along with associated functionality.

Expand the sandbox console-recording limit so that these can work.

These tests rely on a filesystem script which is not yet added to the
Python tests. It is included here as a shell script.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 25c8b9f2 08-Jul-2021 Steffen Jaeckel <jaeckel-floss@eyet-services.de>

test: add first autoboot unit tests

This adds tests for the crypt-based and plain SHA256-based password hashing
algorithms in the autoboot flow.

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f093f864 05-Jul-2021 Simon Glass <sjg@chromium.org>

test: Allow CONFIG_SPL_LOAD_FIT to be disabled

At present if this is not enabled on a sandbox build, the build fails. Add
a condition to avoid this.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 2e059e4a 07-Mar-2021 Simon Glass <sjg@chromium.org>

spl: test: Add a test for spl_load_simple_fit()

As an example of an SPL test, add a new test for loading a FIT within
SPL. This runs on sandbox_spl. For this to work, the text base is adjusted
so that there is plenty of space available.

While we are here, document struct spl_load_info properly, since this is
currently ambiguous.

This test only verifies the logic path. It does not actually check that
the image is loaded correctly. It is not possible for sandbox's SPL to
actually run u-boot.img since it currently includes u-boot.bin rather than
u-boot. Further work could expand the test in that direction.

The need for this was noted at:

http://patchwork.ozlabs.org/project/uboot/patch/20201216000944.2832585-3-mr.nuke.me@gmail.com/

Signed-off-by: Simon Glass <sjg@chromium.org>

# 1c721751 07-Mar-2021 Simon Glass <sjg@chromium.org>

test: Add an overall test runner

Add a new test runner that will eventually be able to run any test. For
now, have it run the 'command' unit tests, so that the functionality in
cmd_ut_category() moves into it.

Signed-off-by: Simon Glass <sjg@chromium.org>

# fe158657 17-Jan-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

test: inconsistent bootm tests

Excluding ut bootm in test/cmd_ut.c but compiling test/bootm.c results in
failure of the Python test invoking the C unit tests as observed on
sipeed_riscv_smode_defconfig:

FAILED test/py/tests/test_ut.py::test_ut[ut_bootm_nop]
FAILED test/py/tests/test_ut.py::test_ut[ut_bootm_nospace]
FAILED test/py/tests/test_ut.py::test_ut[ut_bootm_silent]
FAILED test/py/tests/test_ut.py::test_ut[ut_bootm_silent_var]
FAILED test/py/tests/test_ut.py::test_ut[ut_bootm_subst]
FAILED test/py/tests/test_ut.py::test_ut[ut_bootm_subst_both]
FAILED test/py/tests/test_ut.py::test_ut[ut_bootm_subst_var]

Only compile test/bootm.c on the sandbox.

Fixes: f158ba15ee0f ("bootm: Add tests for fixup_silent_linux()")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6ea5df39 08-Nov-2020 Simon Glass <sjg@chromium.org>

test: Only enable bloblist test when supported

This test cannot work unless CONFIG_BLOBLIST is enabled. Update it to add
that condition.

Reported-by: Kever Yang <kever.yang@rock-chips.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# f158ba15 05-Nov-2020 Simon Glass <sjg@chromium.org>

bootm: Add tests for fixup_silent_linux()

This function currently has no tests. Export it so that we can implement
a simple test on sandbox. Use IS_ENABLED() to remove the unused code,
instead #ifdef.

Signed-off-by: Simon Glass <sjg@chromium.org>

# de429d7b 31-Oct-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

test: linking test/compression.c fails

Building U-Boot with unit tests on a non-sandbox systems fails:

ld.bfd: test/built-in.o: in function `compress_using_gzip':
test/compression.c:138: undefined reference to `gzip'
ld.bfd: test/built-in.o: in function `uncompress_using_bzip2':
test/compression.c:187: undefined reference to `BZ2_bzBuffToBuffDecompress'
ld.bfd: test/built-in.o: in function `uncompress_using_lzma':
test/compression.c:222: undefined reference to `lzmaBuffToBuffDecompress'
ld.bfd: test/built-in.o: in function `uncompress_using_lzo':
test/compression.c:257: undefined reference to `lzop_decompress'
ld.bfd: test/built-in.o: in function `uncompress_using_lz4':
test/compression.c:292: undefined reference to `ulz4fn

Add the missing dependencies.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c961b1b5 31-Oct-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

test: test/bloblist.c depends on asm/state.h

Building test/bloblist.c fails for non sandbox devices:

test/bloblist.c:10:10: fatal error: asm/state.h: No such file or directory
#include <asm/state.h>
^~~~~~~~~~~~~

Build the test only on the sandbox.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 627988f9 03-Oct-2020 Simon Glass <sjg@chromium.org>

dm: test: Disable some tests that should not run in SPL

Tests are easier to run in U-Boot proper. Running them in SPL does not add
test coverage in most cases. Also some tests use features that are not
available in SPL.

Update the build rules to disable these tests in SPL. We still need
test-main to be able to actually run SPL tests.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 16a50683 03-Oct-2020 Simon Glass <sjg@chromium.org>

dm: test: Make use of CONFIG_UNIT_TEST

At present we always include test/dm from the main Makefile. We have a
CONFIG_UNIT_TEST that should control whether the test/ directory is built,
so rely on that instead.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 82c468a0 03-Oct-2020 Simon Glass <sjg@chromium.org>

dm: test: Update Makefile conditions

At present most of the tests in test/Makefile are dependent on
CONFIG_SANDBOX. But this is not ideal since they rely on commands being
available and SPL does not support commands.

Use CONFIG_COMMAND instead. This has the dual purpose of allowing these
tests to be used on other boards and allowing SPL to skip them.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 1cadc761 03-Oct-2020 Simon Glass <sjg@chromium.org>

dm: test: Sort the Makefile

Move everything into alphabetical order.

Signed-off-by: Simon Glass <sjg@chromium.org>

# bdded201 02-Jun-2020 Simon Glass <sjg@chromium.org>

cmd: Add a memory-search command

It is useful to be able to find hex values and strings in a memory range.
Add a command to support this.

cmd: Fix 'md' and add a memory-search command
At present 'md.q' is broken. This series provides a fix for this. It also
implements a new memory-search command called 'ms'. It allows searching
memory for hex and string data.
END

Signed-off-by: Simon Glass <sjg@chromium.org>

# 4f04d549 08-Apr-2020 Simon Glass <sjg@chromium.org>

test: Add the beginnings of some string tests

There are quite a few string functions in U-Boot with no tests. Make a
start by adding a test for strtoul().

Signed-off-by: Simon Glass <sjg@chromium.org>

# 395041b2 26-Feb-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

test: log functions with CONFIG_LOG=n

If CONFIG_LOG=n, we still expect output for log_err(), log_warning(),
log_notice(), log_info() and in case of DEBUG=1 also for log_debug().

Provide unit tests verifying this.

The tests depend on:

CONFIG_CONSOLE_RECORD=y
CONFIG_LOG=n
CONFIG_UT_LOG=y

It may be necessary to increase the value of CONFIG_SYS_MALLOC_F_LEN to
accommodate CONFIG_CONSOLE_RECORD=y.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 919e7a8f 15-Nov-2018 Simon Glass <sjg@chromium.org>

test: Add a simple test for bloblist

Add a unit test for the bloblist functionality and enable bloblist for
sandbox.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 87be2fe6 27-Sep-2018 Mario Six <mario.six@gdsys.cc>

test: list: Add tests for hexdump.c

Add tests for the hex2bin, bin2hex, and hex_to_bin functions, which were
recently added to U-Boot.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f11a164b 31-Aug-2018 Heinrich Schuchardt <xypron.glpk@gmx.de>

test: unit tests for Unicode functions

Provide unit tests for Unicode functions.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

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>

# ef11ed82 04-Dec-2017 Simon Glass <sjg@chromium.org>

log: Add a test command

Add a command which exercises the logging system.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e5a9d27f 15-Jun-2017 Simon Glass <sjg@chromium.org>

test: Add a test for snprintf() and the banner/version

Add a simple test to make sure that these functions obey the buffer size
passed into them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Stephen Warren <swarren@nvidia.com>

# c812f722 20-May-2015 Joe Hershberger <joe.hershberger@ni.com>

test: dm: Move the time test over to the ut command

Unify the command for running unit tests further by moving the "ut_time"
command over to "ut time".

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# c617ede0 20-May-2015 Joe Hershberger <joe.hershberger@ni.com>

test: Add a common unit test command

Add a command that all other unit tests should be a sub-command of.
Also include a command that will run all tests.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Acked-by: Simon Glass <sjg@chromium.org>

# e721b882 20-May-2015 Joe Hershberger <joe.hershberger@ni.com>

test: Generalize the unit test framework

Separate the ability to define tests and assert status of test functions
from the dm tests so they can be used more consistently throughout all
tests.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8271f5d4 02-May-2015 Simon Glass <sjg@chromium.org>

test: Add a simple time test

Sometimes the time functions are incorrect due to bad time support on a
board. Add a unit test which tries to detect this.

Signed-off-by: Simon Glass <sjg@chromium.org>

# bcfe8fdf 20-Oct-2013 Masahiro Yamada <masahiroy@kernel.org>

dts, api, test: convert makefiles to Kbuild style

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# 3153e915 16-Aug-2013 Kees Cook <keescook@chromium.org>

sandbox: add compression tests

This adds the "test_compression" command when building the sandbox. This
tests the existing compression and decompression routines for simple
sanity and for buffer overflow conditions.

Signed-off-by: Kees Cook <keescook@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 1a459660 08-Jul-2013 Wolfgang Denk <wd@denx.de>

Add GPL-2.0+ SPDX-License-Identifier to source files

Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini <trini@ti.com>

# a72007d9 30-Mar-2012 Simon Glass <sjg@chromium.org>

sandbox: Add basic test for command execution

Since run_command() and run_command_list() are important and a little
confusing, add some basic tests to check that the behaviour is correct.

Note: I am not sure that this should be committed, nor where it should go
in the source tree. Comments welcome.

To run the unit tests use the ut_cmd command available in sandbox:

make sandbox_config
make
./u-boot -c ut_cmd

(To test both hush and built-in parsers, you need to manually change
CONFIG_SYS_HUSH_PARSER in include/configs/sandbox.h and build/run again)

Signed-off-by: Simon Glass <sjg@chromium.org>

# c56468a6 14-Oct-2023 Sean Anderson <seanga2@gmail.com>

test: spl: Split tests up and use some configs

In order to make adding new spl unit tests easier, especially when they may
have many dependencies, add some Kconfigs for the existing image test.
Split it into the parts which are generic (such as callbacks) and the
test-specific parts.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 29784d62 01-Aug-2022 Simon Glass <sjg@chromium.org>

test: Add some tests for kconfig.h

The macros in this file are a little confusing and we currently have no
tests to check that they work as expected.

Add some tests which check the macros in C code. Add a few tests which
check that the build errors are generated correctly too, using buildman's
-a option.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 36f641c5 30-May-2022 Andrew Scull <ascull@google.com>

test: fuzz: Add framework for fuzzing

Add the basic infrastructure for declaring fuzz tests and a command to
invoke them.

Signed-off-by: Andrew Scull <ascull@google.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# fb1451be 24-Apr-2022 Simon Glass <sjg@chromium.org>

bootstd: Add tests for bootstd including all uclasses

Add a set of combined tests for the bootdev, bootflow and bootmeth
commands, along with associated functionality.

Expand the sandbox console-recording limit so that these can work.

These tests rely on a filesystem script which is not yet added to the
Python tests. It is included here as a shell script.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 25c8b9f2 08-Jul-2021 Steffen Jaeckel <jaeckel-floss@eyet-services.de>

test: add first autoboot unit tests

This adds tests for the crypt-based and plain SHA256-based password hashing
algorithms in the autoboot flow.

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f093f864 05-Jul-2021 Simon Glass <sjg@chromium.org>

test: Allow CONFIG_SPL_LOAD_FIT to be disabled

At present if this is not enabled on a sandbox build, the build fails. Add
a condition to avoid this.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 2e059e4a 07-Mar-2021 Simon Glass <sjg@chromium.org>

spl: test: Add a test for spl_load_simple_fit()

As an example of an SPL test, add a new test for loading a FIT within
SPL. This runs on sandbox_spl. For this to work, the text base is adjusted
so that there is plenty of space available.

While we are here, document struct spl_load_info properly, since this is
currently ambiguous.

This test only verifies the logic path. It does not actually check that
the image is loaded correctly. It is not possible for sandbox's SPL to
actually run u-boot.img since it currently includes u-boot.bin rather than
u-boot. Further work could expand the test in that direction.

The need for this was noted at:

http://patchwork.ozlabs.org/project/uboot/patch/20201216000944.2832585-3-mr.nuke.me@gmail.com/

Signed-off-by: Simon Glass <sjg@chromium.org>

# 1c721751 07-Mar-2021 Simon Glass <sjg@chromium.org>

test: Add an overall test runner

Add a new test runner that will eventually be able to run any test. For
now, have it run the 'command' unit tests, so that the functionality in
cmd_ut_category() moves into it.

Signed-off-by: Simon Glass <sjg@chromium.org>

# fe158657 17-Jan-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

test: inconsistent bootm tests

Excluding ut bootm in test/cmd_ut.c but compiling test/bootm.c results in
failure of the Python test invoking the C unit tests as observed on
sipeed_riscv_smode_defconfig:

FAILED test/py/tests/test_ut.py::test_ut[ut_bootm_nop]
FAILED test/py/tests/test_ut.py::test_ut[ut_bootm_nospace]
FAILED test/py/tests/test_ut.py::test_ut[ut_bootm_silent]
FAILED test/py/tests/test_ut.py::test_ut[ut_bootm_silent_var]
FAILED test/py/tests/test_ut.py::test_ut[ut_bootm_subst]
FAILED test/py/tests/test_ut.py::test_ut[ut_bootm_subst_both]
FAILED test/py/tests/test_ut.py::test_ut[ut_bootm_subst_var]

Only compile test/bootm.c on the sandbox.

Fixes: f158ba15ee0f ("bootm: Add tests for fixup_silent_linux()")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6ea5df39 08-Nov-2020 Simon Glass <sjg@chromium.org>

test: Only enable bloblist test when supported

This test cannot work unless CONFIG_BLOBLIST is enabled. Update it to add
that condition.

Reported-by: Kever Yang <kever.yang@rock-chips.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# f158ba15 05-Nov-2020 Simon Glass <sjg@chromium.org>

bootm: Add tests for fixup_silent_linux()

This function currently has no tests. Export it so that we can implement
a simple test on sandbox. Use IS_ENABLED() to remove the unused code,
instead #ifdef.

Signed-off-by: Simon Glass <sjg@chromium.org>

# de429d7b 31-Oct-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

test: linking test/compression.c fails

Building U-Boot with unit tests on a non-sandbox systems fails:

ld.bfd: test/built-in.o: in function `compress_using_gzip':
test/compression.c:138: undefined reference to `gzip'
ld.bfd: test/built-in.o: in function `uncompress_using_bzip2':
test/compression.c:187: undefined reference to `BZ2_bzBuffToBuffDecompress'
ld.bfd: test/built-in.o: in function `uncompress_using_lzma':
test/compression.c:222: undefined reference to `lzmaBuffToBuffDecompress'
ld.bfd: test/built-in.o: in function `uncompress_using_lzo':
test/compression.c:257: undefined reference to `lzop_decompress'
ld.bfd: test/built-in.o: in function `uncompress_using_lz4':
test/compression.c:292: undefined reference to `ulz4fn

Add the missing dependencies.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c961b1b5 31-Oct-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

test: test/bloblist.c depends on asm/state.h

Building test/bloblist.c fails for non sandbox devices:

test/bloblist.c:10:10: fatal error: asm/state.h: No such file or directory
#include <asm/state.h>
^~~~~~~~~~~~~

Build the test only on the sandbox.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 627988f9 03-Oct-2020 Simon Glass <sjg@chromium.org>

dm: test: Disable some tests that should not run in SPL

Tests are easier to run in U-Boot proper. Running them in SPL does not add
test coverage in most cases. Also some tests use features that are not
available in SPL.

Update the build rules to disable these tests in SPL. We still need
test-main to be able to actually run SPL tests.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 16a50683 03-Oct-2020 Simon Glass <sjg@chromium.org>

dm: test: Make use of CONFIG_UNIT_TEST

At present we always include test/dm from the main Makefile. We have a
CONFIG_UNIT_TEST that should control whether the test/ directory is built,
so rely on that instead.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 82c468a0 03-Oct-2020 Simon Glass <sjg@chromium.org>

dm: test: Update Makefile conditions

At present most of the tests in test/Makefile are dependent on
CONFIG_SANDBOX. But this is not ideal since they rely on commands being
available and SPL does not support commands.

Use CONFIG_COMMAND instead. This has the dual purpose of allowing these
tests to be used on other boards and allowing SPL to skip them.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 1cadc761 03-Oct-2020 Simon Glass <sjg@chromium.org>

dm: test: Sort the Makefile

Move everything into alphabetical order.

Signed-off-by: Simon Glass <sjg@chromium.org>

# bdded201 02-Jun-2020 Simon Glass <sjg@chromium.org>

cmd: Add a memory-search command

It is useful to be able to find hex values and strings in a memory range.
Add a command to support this.

cmd: Fix 'md' and add a memory-search command
At present 'md.q' is broken. This series provides a fix for this. It also
implements a new memory-search command called 'ms'. It allows searching
memory for hex and string data.
END

Signed-off-by: Simon Glass <sjg@chromium.org>

# 4f04d549 08-Apr-2020 Simon Glass <sjg@chromium.org>

test: Add the beginnings of some string tests

There are quite a few string functions in U-Boot with no tests. Make a
start by adding a test for strtoul().

Signed-off-by: Simon Glass <sjg@chromium.org>

# 395041b2 26-Feb-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

test: log functions with CONFIG_LOG=n

If CONFIG_LOG=n, we still expect output for log_err(), log_warning(),
log_notice(), log_info() and in case of DEBUG=1 also for log_debug().

Provide unit tests verifying this.

The tests depend on:

CONFIG_CONSOLE_RECORD=y
CONFIG_LOG=n
CONFIG_UT_LOG=y

It may be necessary to increase the value of CONFIG_SYS_MALLOC_F_LEN to
accommodate CONFIG_CONSOLE_RECORD=y.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 919e7a8f 15-Nov-2018 Simon Glass <sjg@chromium.org>

test: Add a simple test for bloblist

Add a unit test for the bloblist functionality and enable bloblist for
sandbox.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 87be2fe6 27-Sep-2018 Mario Six <mario.six@gdsys.cc>

test: list: Add tests for hexdump.c

Add tests for the hex2bin, bin2hex, and hex_to_bin functions, which were
recently added to U-Boot.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f11a164b 31-Aug-2018 Heinrich Schuchardt <xypron.glpk@gmx.de>

test: unit tests for Unicode functions

Provide unit tests for Unicode functions.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

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>

# ef11ed82 04-Dec-2017 Simon Glass <sjg@chromium.org>

log: Add a test command

Add a command which exercises the logging system.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e5a9d27f 15-Jun-2017 Simon Glass <sjg@chromium.org>

test: Add a test for snprintf() and the banner/version

Add a simple test to make sure that these functions obey the buffer size
passed into them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Stephen Warren <swarren@nvidia.com>

# c812f722 20-May-2015 Joe Hershberger <joe.hershberger@ni.com>

test: dm: Move the time test over to the ut command

Unify the command for running unit tests further by moving the "ut_time"
command over to "ut time".

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# c617ede0 20-May-2015 Joe Hershberger <joe.hershberger@ni.com>

test: Add a common unit test command

Add a command that all other unit tests should be a sub-command of.
Also include a command that will run all tests.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Acked-by: Simon Glass <sjg@chromium.org>

# e721b882 20-May-2015 Joe Hershberger <joe.hershberger@ni.com>

test: Generalize the unit test framework

Separate the ability to define tests and assert status of test functions
from the dm tests so they can be used more consistently throughout all
tests.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8271f5d4 02-May-2015 Simon Glass <sjg@chromium.org>

test: Add a simple time test

Sometimes the time functions are incorrect due to bad time support on a
board. Add a unit test which tries to detect this.

Signed-off-by: Simon Glass <sjg@chromium.org>

# bcfe8fdf 20-Oct-2013 Masahiro Yamada <masahiroy@kernel.org>

dts, api, test: convert makefiles to Kbuild style

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# 3153e915 16-Aug-2013 Kees Cook <keescook@chromium.org>

sandbox: add compression tests

This adds the "test_compression" command when building the sandbox. This
tests the existing compression and decompression routines for simple
sanity and for buffer overflow conditions.

Signed-off-by: Kees Cook <keescook@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 1a459660 08-Jul-2013 Wolfgang Denk <wd@denx.de>

Add GPL-2.0+ SPDX-License-Identifier to source files

Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini <trini@ti.com>

# a72007d9 30-Mar-2012 Simon Glass <sjg@chromium.org>

sandbox: Add basic test for command execution

Since run_command() and run_command_list() are important and a little
confusing, add some basic tests to check that the behaviour is correct.

Note: I am not sure that this should be committed, nor where it should go
in the source tree. Comments welcome.

To run the unit tests use the ut_cmd command available in sandbox:

make sandbox_config
make
./u-boot -c ut_cmd

(To test both hush and built-in parsers, you need to manually change
CONFIG_SYS_HUSH_PARSER in include/configs/sandbox.h and build/run again)

Signed-off-by: Simon Glass <sjg@chromium.org>

# 29784d62 01-Aug-2022 Simon Glass <sjg@chromium.org>

test: Add some tests for kconfig.h

The macros in this file are a little confusing and we currently have no
tests to check that they work as expected.

Add some tests which check the macros in C code. Add a few tests which
check that the build errors are generated correctly too, using buildman's
-a option.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 36f641c5 30-May-2022 Andrew Scull <ascull@google.com>

test: fuzz: Add framework for fuzzing

Add the basic infrastructure for declaring fuzz tests and a command to
invoke them.

Signed-off-by: Andrew Scull <ascull@google.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# fb1451be 24-Apr-2022 Simon Glass <sjg@chromium.org>

bootstd: Add tests for bootstd including all uclasses

Add a set of combined tests for the bootdev, bootflow and bootmeth
commands, along with associated functionality.

Expand the sandbox console-recording limit so that these can work.

These tests rely on a filesystem script which is not yet added to the
Python tests. It is included here as a shell script.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 25c8b9f2 08-Jul-2021 Steffen Jaeckel <jaeckel-floss@eyet-services.de>

test: add first autoboot unit tests

This adds tests for the crypt-based and plain SHA256-based password hashing
algorithms in the autoboot flow.

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f093f864 05-Jul-2021 Simon Glass <sjg@chromium.org>

test: Allow CONFIG_SPL_LOAD_FIT to be disabled

At present if this is not enabled on a sandbox build, the build fails. Add
a condition to avoid this.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 2e059e4a 07-Mar-2021 Simon Glass <sjg@chromium.org>

spl: test: Add a test for spl_load_simple_fit()

As an example of an SPL test, add a new test for loading a FIT within
SPL. This runs on sandbox_spl. For this to work, the text base is adjusted
so that there is plenty of space available.

While we are here, document struct spl_load_info properly, since this is
currently ambiguous.

This test only verifies the logic path. It does not actually check that
the image is loaded correctly. It is not possible for sandbox's SPL to
actually run u-boot.img since it currently includes u-boot.bin rather than
u-boot. Further work could expand the test in that direction.

The need for this was noted at:

http://patchwork.ozlabs.org/project/uboot/patch/20201216000944.2832585-3-mr.nuke.me@gmail.com/

Signed-off-by: Simon Glass <sjg@chromium.org>

# 1c721751 07-Mar-2021 Simon Glass <sjg@chromium.org>

test: Add an overall test runner

Add a new test runner that will eventually be able to run any test. For
now, have it run the 'command' unit tests, so that the functionality in
cmd_ut_category() moves into it.

Signed-off-by: Simon Glass <sjg@chromium.org>

# fe158657 17-Jan-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

test: inconsistent bootm tests

Excluding ut bootm in test/cmd_ut.c but compiling test/bootm.c results in
failure of the Python test invoking the C unit tests as observed on
sipeed_riscv_smode_defconfig:

FAILED test/py/tests/test_ut.py::test_ut[ut_bootm_nop]
FAILED test/py/tests/test_ut.py::test_ut[ut_bootm_nospace]
FAILED test/py/tests/test_ut.py::test_ut[ut_bootm_silent]
FAILED test/py/tests/test_ut.py::test_ut[ut_bootm_silent_var]
FAILED test/py/tests/test_ut.py::test_ut[ut_bootm_subst]
FAILED test/py/tests/test_ut.py::test_ut[ut_bootm_subst_both]
FAILED test/py/tests/test_ut.py::test_ut[ut_bootm_subst_var]

Only compile test/bootm.c on the sandbox.

Fixes: f158ba15ee0f ("bootm: Add tests for fixup_silent_linux()")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6ea5df39 08-Nov-2020 Simon Glass <sjg@chromium.org>

test: Only enable bloblist test when supported

This test cannot work unless CONFIG_BLOBLIST is enabled. Update it to add
that condition.

Reported-by: Kever Yang <kever.yang@rock-chips.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# f158ba15 05-Nov-2020 Simon Glass <sjg@chromium.org>

bootm: Add tests for fixup_silent_linux()

This function currently has no tests. Export it so that we can implement
a simple test on sandbox. Use IS_ENABLED() to remove the unused code,
instead #ifdef.

Signed-off-by: Simon Glass <sjg@chromium.org>

# de429d7b 31-Oct-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

test: linking test/compression.c fails

Building U-Boot with unit tests on a non-sandbox systems fails:

ld.bfd: test/built-in.o: in function `compress_using_gzip':
test/compression.c:138: undefined reference to `gzip'
ld.bfd: test/built-in.o: in function `uncompress_using_bzip2':
test/compression.c:187: undefined reference to `BZ2_bzBuffToBuffDecompress'
ld.bfd: test/built-in.o: in function `uncompress_using_lzma':
test/compression.c:222: undefined reference to `lzmaBuffToBuffDecompress'
ld.bfd: test/built-in.o: in function `uncompress_using_lzo':
test/compression.c:257: undefined reference to `lzop_decompress'
ld.bfd: test/built-in.o: in function `uncompress_using_lz4':
test/compression.c:292: undefined reference to `ulz4fn

Add the missing dependencies.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c961b1b5 31-Oct-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

test: test/bloblist.c depends on asm/state.h

Building test/bloblist.c fails for non sandbox devices:

test/bloblist.c:10:10: fatal error: asm/state.h: No such file or directory
#include <asm/state.h>
^~~~~~~~~~~~~

Build the test only on the sandbox.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 627988f9 03-Oct-2020 Simon Glass <sjg@chromium.org>

dm: test: Disable some tests that should not run in SPL

Tests are easier to run in U-Boot proper. Running them in SPL does not add
test coverage in most cases. Also some tests use features that are not
available in SPL.

Update the build rules to disable these tests in SPL. We still need
test-main to be able to actually run SPL tests.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 16a50683 03-Oct-2020 Simon Glass <sjg@chromium.org>

dm: test: Make use of CONFIG_UNIT_TEST

At present we always include test/dm from the main Makefile. We have a
CONFIG_UNIT_TEST that should control whether the test/ directory is built,
so rely on that instead.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 82c468a0 03-Oct-2020 Simon Glass <sjg@chromium.org>

dm: test: Update Makefile conditions

At present most of the tests in test/Makefile are dependent on
CONFIG_SANDBOX. But this is not ideal since they rely on commands being
available and SPL does not support commands.

Use CONFIG_COMMAND instead. This has the dual purpose of allowing these
tests to be used on other boards and allowing SPL to skip them.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 1cadc761 03-Oct-2020 Simon Glass <sjg@chromium.org>

dm: test: Sort the Makefile

Move everything into alphabetical order.

Signed-off-by: Simon Glass <sjg@chromium.org>

# bdded201 02-Jun-2020 Simon Glass <sjg@chromium.org>

cmd: Add a memory-search command

It is useful to be able to find hex values and strings in a memory range.
Add a command to support this.

cmd: Fix 'md' and add a memory-search command
At present 'md.q' is broken. This series provides a fix for this. It also
implements a new memory-search command called 'ms'. It allows searching
memory for hex and string data.
END

Signed-off-by: Simon Glass <sjg@chromium.org>

# 4f04d549 08-Apr-2020 Simon Glass <sjg@chromium.org>

test: Add the beginnings of some string tests

There are quite a few string functions in U-Boot with no tests. Make a
start by adding a test for strtoul().

Signed-off-by: Simon Glass <sjg@chromium.org>

# 395041b2 26-Feb-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

test: log functions with CONFIG_LOG=n

If CONFIG_LOG=n, we still expect output for log_err(), log_warning(),
log_notice(), log_info() and in case of DEBUG=1 also for log_debug().

Provide unit tests verifying this.

The tests depend on:

CONFIG_CONSOLE_RECORD=y
CONFIG_LOG=n
CONFIG_UT_LOG=y

It may be necessary to increase the value of CONFIG_SYS_MALLOC_F_LEN to
accommodate CONFIG_CONSOLE_RECORD=y.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 919e7a8f 15-Nov-2018 Simon Glass <sjg@chromium.org>

test: Add a simple test for bloblist

Add a unit test for the bloblist functionality and enable bloblist for
sandbox.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 87be2fe6 27-Sep-2018 Mario Six <mario.six@gdsys.cc>

test: list: Add tests for hexdump.c

Add tests for the hex2bin, bin2hex, and hex_to_bin functions, which were
recently added to U-Boot.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f11a164b 31-Aug-2018 Heinrich Schuchardt <xypron.glpk@gmx.de>

test: unit tests for Unicode functions

Provide unit tests for Unicode functions.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

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>

# ef11ed82 04-Dec-2017 Simon Glass <sjg@chromium.org>

log: Add a test command

Add a command which exercises the logging system.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e5a9d27f 15-Jun-2017 Simon Glass <sjg@chromium.org>

test: Add a test for snprintf() and the banner/version

Add a simple test to make sure that these functions obey the buffer size
passed into them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Stephen Warren <swarren@nvidia.com>

# c812f722 20-May-2015 Joe Hershberger <joe.hershberger@ni.com>

test: dm: Move the time test over to the ut command

Unify the command for running unit tests further by moving the "ut_time"
command over to "ut time".

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# c617ede0 20-May-2015 Joe Hershberger <joe.hershberger@ni.com>

test: Add a common unit test command

Add a command that all other unit tests should be a sub-command of.
Also include a command that will run all tests.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Acked-by: Simon Glass <sjg@chromium.org>

# e721b882 20-May-2015 Joe Hershberger <joe.hershberger@ni.com>

test: Generalize the unit test framework

Separate the ability to define tests and assert status of test functions
from the dm tests so they can be used more consistently throughout all
tests.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8271f5d4 02-May-2015 Simon Glass <sjg@chromium.org>

test: Add a simple time test

Sometimes the time functions are incorrect due to bad time support on a
board. Add a unit test which tries to detect this.

Signed-off-by: Simon Glass <sjg@chromium.org>

# bcfe8fdf 20-Oct-2013 Masahiro Yamada <yamada.masahiro@socionext.com>

dts, api, test: convert makefiles to Kbuild style

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# 3153e915 16-Aug-2013 Kees Cook <keescook@chromium.org>

sandbox: add compression tests

This adds the "test_compression" command when building the sandbox. This
tests the existing compression and decompression routines for simple
sanity and for buffer overflow conditions.

Signed-off-by: Kees Cook <keescook@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 1a459660 08-Jul-2013 Wolfgang Denk <wd@denx.de>

Add GPL-2.0+ SPDX-License-Identifier to source files

Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini <trini@ti.com>

# a72007d9 30-Mar-2012 Simon Glass <sjg@chromium.org>

sandbox: Add basic test for command execution

Since run_command() and run_command_list() are important and a little
confusing, add some basic tests to check that the behaviour is correct.

Note: I am not sure that this should be committed, nor where it should go
in the source tree. Comments welcome.

To run the unit tests use the ut_cmd command available in sandbox:

make sandbox_config
make
./u-boot -c ut_cmd

(To test both hush and built-in parsers, you need to manually change
CONFIG_SYS_HUSH_PARSER in include/configs/sandbox.h and build/run again)

Signed-off-by: Simon Glass <sjg@chromium.org>

# 36f641c5 30-May-2022 Andrew Scull <ascull@google.com>

test: fuzz: Add framework for fuzzing

Add the basic infrastructure for declaring fuzz tests and a command to
invoke them.

Signed-off-by: Andrew Scull <ascull@google.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# fb1451be 24-Apr-2022 Simon Glass <sjg@chromium.org>

bootstd: Add tests for bootstd including all uclasses

Add a set of combined tests for the bootdev, bootflow and bootmeth
commands, along with associated functionality.

Expand the sandbox console-recording limit so that these can work.

These tests rely on a filesystem script which is not yet added to the
Python tests. It is included here as a shell script.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 25c8b9f2 08-Jul-2021 Steffen Jaeckel <jaeckel-floss@eyet-services.de>

test: add first autoboot unit tests

This adds tests for the crypt-based and plain SHA256-based password hashing
algorithms in the autoboot flow.

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f093f864 05-Jul-2021 Simon Glass <sjg@chromium.org>

test: Allow CONFIG_SPL_LOAD_FIT to be disabled

At present if this is not enabled on a sandbox build, the build fails. Add
a condition to avoid this.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 2e059e4a 07-Mar-2021 Simon Glass <sjg@chromium.org>

spl: test: Add a test for spl_load_simple_fit()

As an example of an SPL test, add a new test for loading a FIT within
SPL. This runs on sandbox_spl. For this to work, the text base is adjusted
so that there is plenty of space available.

While we are here, document struct spl_load_info properly, since this is
currently ambiguous.

This test only verifies the logic path. It does not actually check that
the image is loaded correctly. It is not possible for sandbox's SPL to
actually run u-boot.img since it currently includes u-boot.bin rather than
u-boot. Further work could expand the test in that direction.

The need for this was noted at:

http://patchwork.ozlabs.org/project/uboot/patch/20201216000944.2832585-3-mr.nuke.me@gmail.com/

Signed-off-by: Simon Glass <sjg@chromium.org>

# 1c721751 07-Mar-2021 Simon Glass <sjg@chromium.org>

test: Add an overall test runner

Add a new test runner that will eventually be able to run any test. For
now, have it run the 'command' unit tests, so that the functionality in
cmd_ut_category() moves into it.

Signed-off-by: Simon Glass <sjg@chromium.org>

# fe158657 17-Jan-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

test: inconsistent bootm tests

Excluding ut bootm in test/cmd_ut.c but compiling test/bootm.c results in
failure of the Python test invoking the C unit tests as observed on
sipeed_riscv_smode_defconfig:

FAILED test/py/tests/test_ut.py::test_ut[ut_bootm_nop]
FAILED test/py/tests/test_ut.py::test_ut[ut_bootm_nospace]
FAILED test/py/tests/test_ut.py::test_ut[ut_bootm_silent]
FAILED test/py/tests/test_ut.py::test_ut[ut_bootm_silent_var]
FAILED test/py/tests/test_ut.py::test_ut[ut_bootm_subst]
FAILED test/py/tests/test_ut.py::test_ut[ut_bootm_subst_both]
FAILED test/py/tests/test_ut.py::test_ut[ut_bootm_subst_var]

Only compile test/bootm.c on the sandbox.

Fixes: f158ba15ee0f ("bootm: Add tests for fixup_silent_linux()")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6ea5df39 08-Nov-2020 Simon Glass <sjg@chromium.org>

test: Only enable bloblist test when supported

This test cannot work unless CONFIG_BLOBLIST is enabled. Update it to add
that condition.

Reported-by: Kever Yang <kever.yang@rock-chips.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# f158ba15 05-Nov-2020 Simon Glass <sjg@chromium.org>

bootm: Add tests for fixup_silent_linux()

This function currently has no tests. Export it so that we can implement
a simple test on sandbox. Use IS_ENABLED() to remove the unused code,
instead #ifdef.

Signed-off-by: Simon Glass <sjg@chromium.org>

# de429d7b 31-Oct-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

test: linking test/compression.c fails

Building U-Boot with unit tests on a non-sandbox systems fails:

ld.bfd: test/built-in.o: in function `compress_using_gzip':
test/compression.c:138: undefined reference to `gzip'
ld.bfd: test/built-in.o: in function `uncompress_using_bzip2':
test/compression.c:187: undefined reference to `BZ2_bzBuffToBuffDecompress'
ld.bfd: test/built-in.o: in function `uncompress_using_lzma':
test/compression.c:222: undefined reference to `lzmaBuffToBuffDecompress'
ld.bfd: test/built-in.o: in function `uncompress_using_lzo':
test/compression.c:257: undefined reference to `lzop_decompress'
ld.bfd: test/built-in.o: in function `uncompress_using_lz4':
test/compression.c:292: undefined reference to `ulz4fn

Add the missing dependencies.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c961b1b5 31-Oct-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

test: test/bloblist.c depends on asm/state.h

Building test/bloblist.c fails for non sandbox devices:

test/bloblist.c:10:10: fatal error: asm/state.h: No such file or directory
#include <asm/state.h>
^~~~~~~~~~~~~

Build the test only on the sandbox.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 627988f9 03-Oct-2020 Simon Glass <sjg@chromium.org>

dm: test: Disable some tests that should not run in SPL

Tests are easier to run in U-Boot proper. Running them in SPL does not add
test coverage in most cases. Also some tests use features that are not
available in SPL.

Update the build rules to disable these tests in SPL. We still need
test-main to be able to actually run SPL tests.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 16a50683 03-Oct-2020 Simon Glass <sjg@chromium.org>

dm: test: Make use of CONFIG_UNIT_TEST

At present we always include test/dm from the main Makefile. We have a
CONFIG_UNIT_TEST that should control whether the test/ directory is built,
so rely on that instead.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 82c468a0 03-Oct-2020 Simon Glass <sjg@chromium.org>

dm: test: Update Makefile conditions

At present most of the tests in test/Makefile are dependent on
CONFIG_SANDBOX. But this is not ideal since they rely on commands being
available and SPL does not support commands.

Use CONFIG_COMMAND instead. This has the dual purpose of allowing these
tests to be used on other boards and allowing SPL to skip them.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 1cadc761 03-Oct-2020 Simon Glass <sjg@chromium.org>

dm: test: Sort the Makefile

Move everything into alphabetical order.

Signed-off-by: Simon Glass <sjg@chromium.org>

# bdded201 02-Jun-2020 Simon Glass <sjg@chromium.org>

cmd: Add a memory-search command

It is useful to be able to find hex values and strings in a memory range.
Add a command to support this.

cmd: Fix 'md' and add a memory-search command
At present 'md.q' is broken. This series provides a fix for this. It also
implements a new memory-search command called 'ms'. It allows searching
memory for hex and string data.
END

Signed-off-by: Simon Glass <sjg@chromium.org>

# 4f04d549 08-Apr-2020 Simon Glass <sjg@chromium.org>

test: Add the beginnings of some string tests

There are quite a few string functions in U-Boot with no tests. Make a
start by adding a test for strtoul().

Signed-off-by: Simon Glass <sjg@chromium.org>

# 395041b2 26-Feb-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

test: log functions with CONFIG_LOG=n

If CONFIG_LOG=n, we still expect output for log_err(), log_warning(),
log_notice(), log_info() and in case of DEBUG=1 also for log_debug().

Provide unit tests verifying this.

The tests depend on:

CONFIG_CONSOLE_RECORD=y
CONFIG_LOG=n
CONFIG_UT_LOG=y

It may be necessary to increase the value of CONFIG_SYS_MALLOC_F_LEN to
accommodate CONFIG_CONSOLE_RECORD=y.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 919e7a8f 15-Nov-2018 Simon Glass <sjg@chromium.org>

test: Add a simple test for bloblist

Add a unit test for the bloblist functionality and enable bloblist for
sandbox.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 87be2fe6 27-Sep-2018 Mario Six <mario.six@gdsys.cc>

test: list: Add tests for hexdump.c

Add tests for the hex2bin, bin2hex, and hex_to_bin functions, which were
recently added to U-Boot.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f11a164b 31-Aug-2018 Heinrich Schuchardt <xypron.glpk@gmx.de>

test: unit tests for Unicode functions

Provide unit tests for Unicode functions.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

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>

# ef11ed82 04-Dec-2017 Simon Glass <sjg@chromium.org>

log: Add a test command

Add a command which exercises the logging system.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e5a9d27f 15-Jun-2017 Simon Glass <sjg@chromium.org>

test: Add a test for snprintf() and the banner/version

Add a simple test to make sure that these functions obey the buffer size
passed into them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Stephen Warren <swarren@nvidia.com>

# c812f722 20-May-2015 Joe Hershberger <joe.hershberger@ni.com>

test: dm: Move the time test over to the ut command

Unify the command for running unit tests further by moving the "ut_time"
command over to "ut time".

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# c617ede0 20-May-2015 Joe Hershberger <joe.hershberger@ni.com>

test: Add a common unit test command

Add a command that all other unit tests should be a sub-command of.
Also include a command that will run all tests.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Acked-by: Simon Glass <sjg@chromium.org>

# e721b882 20-May-2015 Joe Hershberger <joe.hershberger@ni.com>

test: Generalize the unit test framework

Separate the ability to define tests and assert status of test functions
from the dm tests so they can be used more consistently throughout all
tests.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8271f5d4 02-May-2015 Simon Glass <sjg@chromium.org>

test: Add a simple time test

Sometimes the time functions are incorrect due to bad time support on a
board. Add a unit test which tries to detect this.

Signed-off-by: Simon Glass <sjg@chromium.org>

# bcfe8fdf 20-Oct-2013 Masahiro Yamada <yamada.masahiro@socionext.com>

dts, api, test: convert makefiles to Kbuild style

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# 3153e915 16-Aug-2013 Kees Cook <keescook@chromium.org>

sandbox: add compression tests

This adds the "test_compression" command when building the sandbox. This
tests the existing compression and decompression routines for simple
sanity and for buffer overflow conditions.

Signed-off-by: Kees Cook <keescook@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 1a459660 08-Jul-2013 Wolfgang Denk <wd@denx.de>

Add GPL-2.0+ SPDX-License-Identifier to source files

Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini <trini@ti.com>

# a72007d9 30-Mar-2012 Simon Glass <sjg@chromium.org>

sandbox: Add basic test for command execution

Since run_command() and run_command_list() are important and a little
confusing, add some basic tests to check that the behaviour is correct.

Note: I am not sure that this should be committed, nor where it should go
in the source tree. Comments welcome.

To run the unit tests use the ut_cmd command available in sandbox:

make sandbox_config
make
./u-boot -c ut_cmd

(To test both hush and built-in parsers, you need to manually change
CONFIG_SYS_HUSH_PARSER in include/configs/sandbox.h and build/run again)

Signed-off-by: Simon Glass <sjg@chromium.org>

# fb1451be 24-Apr-2022 Simon Glass <sjg@chromium.org>

bootstd: Add tests for bootstd including all uclasses

Add a set of combined tests for the bootdev, bootflow and bootmeth
commands, along with associated functionality.

Expand the sandbox console-recording limit so that these can work.

These tests rely on a filesystem script which is not yet added to the
Python tests. It is included here as a shell script.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 25c8b9f2 08-Jul-2021 Steffen Jaeckel <jaeckel-floss@eyet-services.de>

test: add first autoboot unit tests

This adds tests for the crypt-based and plain SHA256-based password hashing
algorithms in the autoboot flow.

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f093f864 05-Jul-2021 Simon Glass <sjg@chromium.org>

test: Allow CONFIG_SPL_LOAD_FIT to be disabled

At present if this is not enabled on a sandbox build, the build fails. Add
a condition to avoid this.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 2e059e4a 07-Mar-2021 Simon Glass <sjg@chromium.org>

spl: test: Add a test for spl_load_simple_fit()

As an example of an SPL test, add a new test for loading a FIT within
SPL. This runs on sandbox_spl. For this to work, the text base is adjusted
so that there is plenty of space available.

While we are here, document struct spl_load_info properly, since this is
currently ambiguous.

This test only verifies the logic path. It does not actually check that
the image is loaded correctly. It is not possible for sandbox's SPL to
actually run u-boot.img since it currently includes u-boot.bin rather than
u-boot. Further work could expand the test in that direction.

The need for this was noted at:

http://patchwork.ozlabs.org/project/uboot/patch/20201216000944.2832585-3-mr.nuke.me@gmail.com/

Signed-off-by: Simon Glass <sjg@chromium.org>

# 1c721751 07-Mar-2021 Simon Glass <sjg@chromium.org>

test: Add an overall test runner

Add a new test runner that will eventually be able to run any test. For
now, have it run the 'command' unit tests, so that the functionality in
cmd_ut_category() moves into it.

Signed-off-by: Simon Glass <sjg@chromium.org>

# fe158657 17-Jan-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

test: inconsistent bootm tests

Excluding ut bootm in test/cmd_ut.c but compiling test/bootm.c results in
failure of the Python test invoking the C unit tests as observed on
sipeed_riscv_smode_defconfig:

FAILED test/py/tests/test_ut.py::test_ut[ut_bootm_nop]
FAILED test/py/tests/test_ut.py::test_ut[ut_bootm_nospace]
FAILED test/py/tests/test_ut.py::test_ut[ut_bootm_silent]
FAILED test/py/tests/test_ut.py::test_ut[ut_bootm_silent_var]
FAILED test/py/tests/test_ut.py::test_ut[ut_bootm_subst]
FAILED test/py/tests/test_ut.py::test_ut[ut_bootm_subst_both]
FAILED test/py/tests/test_ut.py::test_ut[ut_bootm_subst_var]

Only compile test/bootm.c on the sandbox.

Fixes: f158ba15ee0f ("bootm: Add tests for fixup_silent_linux()")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6ea5df39 08-Nov-2020 Simon Glass <sjg@chromium.org>

test: Only enable bloblist test when supported

This test cannot work unless CONFIG_BLOBLIST is enabled. Update it to add
that condition.

Reported-by: Kever Yang <kever.yang@rock-chips.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# f158ba15 05-Nov-2020 Simon Glass <sjg@chromium.org>

bootm: Add tests for fixup_silent_linux()

This function currently has no tests. Export it so that we can implement
a simple test on sandbox. Use IS_ENABLED() to remove the unused code,
instead #ifdef.

Signed-off-by: Simon Glass <sjg@chromium.org>

# de429d7b 31-Oct-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

test: linking test/compression.c fails

Building U-Boot with unit tests on a non-sandbox systems fails:

ld.bfd: test/built-in.o: in function `compress_using_gzip':
test/compression.c:138: undefined reference to `gzip'
ld.bfd: test/built-in.o: in function `uncompress_using_bzip2':
test/compression.c:187: undefined reference to `BZ2_bzBuffToBuffDecompress'
ld.bfd: test/built-in.o: in function `uncompress_using_lzma':
test/compression.c:222: undefined reference to `lzmaBuffToBuffDecompress'
ld.bfd: test/built-in.o: in function `uncompress_using_lzo':
test/compression.c:257: undefined reference to `lzop_decompress'
ld.bfd: test/built-in.o: in function `uncompress_using_lz4':
test/compression.c:292: undefined reference to `ulz4fn

Add the missing dependencies.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c961b1b5 31-Oct-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

test: test/bloblist.c depends on asm/state.h

Building test/bloblist.c fails for non sandbox devices:

test/bloblist.c:10:10: fatal error: asm/state.h: No such file or directory
#include <asm/state.h>
^~~~~~~~~~~~~

Build the test only on the sandbox.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 627988f9 03-Oct-2020 Simon Glass <sjg@chromium.org>

dm: test: Disable some tests that should not run in SPL

Tests are easier to run in U-Boot proper. Running them in SPL does not add
test coverage in most cases. Also some tests use features that are not
available in SPL.

Update the build rules to disable these tests in SPL. We still need
test-main to be able to actually run SPL tests.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 16a50683 03-Oct-2020 Simon Glass <sjg@chromium.org>

dm: test: Make use of CONFIG_UNIT_TEST

At present we always include test/dm from the main Makefile. We have a
CONFIG_UNIT_TEST that should control whether the test/ directory is built,
so rely on that instead.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 82c468a0 03-Oct-2020 Simon Glass <sjg@chromium.org>

dm: test: Update Makefile conditions

At present most of the tests in test/Makefile are dependent on
CONFIG_SANDBOX. But this is not ideal since they rely on commands being
available and SPL does not support commands.

Use CONFIG_COMMAND instead. This has the dual purpose of allowing these
tests to be used on other boards and allowing SPL to skip them.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 1cadc761 03-Oct-2020 Simon Glass <sjg@chromium.org>

dm: test: Sort the Makefile

Move everything into alphabetical order.

Signed-off-by: Simon Glass <sjg@chromium.org>

# bdded201 02-Jun-2020 Simon Glass <sjg@chromium.org>

cmd: Add a memory-search command

It is useful to be able to find hex values and strings in a memory range.
Add a command to support this.

cmd: Fix 'md' and add a memory-search command
At present 'md.q' is broken. This series provides a fix for this. It also
implements a new memory-search command called 'ms'. It allows searching
memory for hex and string data.
END

Signed-off-by: Simon Glass <sjg@chromium.org>

# 4f04d549 08-Apr-2020 Simon Glass <sjg@chromium.org>

test: Add the beginnings of some string tests

There are quite a few string functions in U-Boot with no tests. Make a
start by adding a test for strtoul().

Signed-off-by: Simon Glass <sjg@chromium.org>

# 395041b2 26-Feb-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

test: log functions with CONFIG_LOG=n

If CONFIG_LOG=n, we still expect output for log_err(), log_warning(),
log_notice(), log_info() and in case of DEBUG=1 also for log_debug().

Provide unit tests verifying this.

The tests depend on:

CONFIG_CONSOLE_RECORD=y
CONFIG_LOG=n
CONFIG_UT_LOG=y

It may be necessary to increase the value of CONFIG_SYS_MALLOC_F_LEN to
accommodate CONFIG_CONSOLE_RECORD=y.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 919e7a8f 15-Nov-2018 Simon Glass <sjg@chromium.org>

test: Add a simple test for bloblist

Add a unit test for the bloblist functionality and enable bloblist for
sandbox.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 87be2fe6 27-Sep-2018 Mario Six <mario.six@gdsys.cc>

test: list: Add tests for hexdump.c

Add tests for the hex2bin, bin2hex, and hex_to_bin functions, which were
recently added to U-Boot.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f11a164b 31-Aug-2018 Heinrich Schuchardt <xypron.glpk@gmx.de>

test: unit tests for Unicode functions

Provide unit tests for Unicode functions.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

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>

# ef11ed82 04-Dec-2017 Simon Glass <sjg@chromium.org>

log: Add a test command

Add a command which exercises the logging system.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e5a9d27f 15-Jun-2017 Simon Glass <sjg@chromium.org>

test: Add a test for snprintf() and the banner/version

Add a simple test to make sure that these functions obey the buffer size
passed into them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Stephen Warren <swarren@nvidia.com>

# c812f722 20-May-2015 Joe Hershberger <joe.hershberger@ni.com>

test: dm: Move the time test over to the ut command

Unify the command for running unit tests further by moving the "ut_time"
command over to "ut time".

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# c617ede0 20-May-2015 Joe Hershberger <joe.hershberger@ni.com>

test: Add a common unit test command

Add a command that all other unit tests should be a sub-command of.
Also include a command that will run all tests.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Acked-by: Simon Glass <sjg@chromium.org>

# e721b882 20-May-2015 Joe Hershberger <joe.hershberger@ni.com>

test: Generalize the unit test framework

Separate the ability to define tests and assert status of test functions
from the dm tests so they can be used more consistently throughout all
tests.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8271f5d4 02-May-2015 Simon Glass <sjg@chromium.org>

test: Add a simple time test

Sometimes the time functions are incorrect due to bad time support on a
board. Add a unit test which tries to detect this.

Signed-off-by: Simon Glass <sjg@chromium.org>

# bcfe8fdf 20-Oct-2013 Masahiro Yamada <yamada.masahiro@socionext.com>

dts, api, test: convert makefiles to Kbuild style

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# 3153e915 16-Aug-2013 Kees Cook <keescook@chromium.org>

sandbox: add compression tests

This adds the "test_compression" command when building the sandbox. This
tests the existing compression and decompression routines for simple
sanity and for buffer overflow conditions.

Signed-off-by: Kees Cook <keescook@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 1a459660 08-Jul-2013 Wolfgang Denk <wd@denx.de>

Add GPL-2.0+ SPDX-License-Identifier to source files

Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini <trini@ti.com>

# a72007d9 30-Mar-2012 Simon Glass <sjg@chromium.org>

sandbox: Add basic test for command execution

Since run_command() and run_command_list() are important and a little
confusing, add some basic tests to check that the behaviour is correct.

Note: I am not sure that this should be committed, nor where it should go
in the source tree. Comments welcome.

To run the unit tests use the ut_cmd command available in sandbox:

make sandbox_config
make
./u-boot -c ut_cmd

(To test both hush and built-in parsers, you need to manually change
CONFIG_SYS_HUSH_PARSER in include/configs/sandbox.h and build/run again)

Signed-off-by: Simon Glass <sjg@chromium.org>

# 25c8b9f2 08-Jul-2021 Steffen Jaeckel <jaeckel-floss@eyet-services.de>

test: add first autoboot unit tests

This adds tests for the crypt-based and plain SHA256-based password hashing
algorithms in the autoboot flow.

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f093f864 05-Jul-2021 Simon Glass <sjg@chromium.org>

test: Allow CONFIG_SPL_LOAD_FIT to be disabled

At present if this is not enabled on a sandbox build, the build fails. Add
a condition to avoid this.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 2e059e4a 07-Mar-2021 Simon Glass <sjg@chromium.org>

spl: test: Add a test for spl_load_simple_fit()

As an example of an SPL test, add a new test for loading a FIT within
SPL. This runs on sandbox_spl. For this to work, the text base is adjusted
so that there is plenty of space available.

While we are here, document struct spl_load_info properly, since this is
currently ambiguous.

This test only verifies the logic path. It does not actually check that
the image is loaded correctly. It is not possible for sandbox's SPL to
actually run u-boot.img since it currently includes u-boot.bin rather than
u-boot. Further work could expand the test in that direction.

The need for this was noted at:

http://patchwork.ozlabs.org/project/uboot/patch/20201216000944.2832585-3-mr.nuke.me@gmail.com/

Signed-off-by: Simon Glass <sjg@chromium.org>

# 1c721751 07-Mar-2021 Simon Glass <sjg@chromium.org>

test: Add an overall test runner

Add a new test runner that will eventually be able to run any test. For
now, have it run the 'command' unit tests, so that the functionality in
cmd_ut_category() moves into it.

Signed-off-by: Simon Glass <sjg@chromium.org>

# fe158657 17-Jan-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

test: inconsistent bootm tests

Excluding ut bootm in test/cmd_ut.c but compiling test/bootm.c results in
failure of the Python test invoking the C unit tests as observed on
sipeed_riscv_smode_defconfig:

FAILED test/py/tests/test_ut.py::test_ut[ut_bootm_nop]
FAILED test/py/tests/test_ut.py::test_ut[ut_bootm_nospace]
FAILED test/py/tests/test_ut.py::test_ut[ut_bootm_silent]
FAILED test/py/tests/test_ut.py::test_ut[ut_bootm_silent_var]
FAILED test/py/tests/test_ut.py::test_ut[ut_bootm_subst]
FAILED test/py/tests/test_ut.py::test_ut[ut_bootm_subst_both]
FAILED test/py/tests/test_ut.py::test_ut[ut_bootm_subst_var]

Only compile test/bootm.c on the sandbox.

Fixes: f158ba15ee0f ("bootm: Add tests for fixup_silent_linux()")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6ea5df39 08-Nov-2020 Simon Glass <sjg@chromium.org>

test: Only enable bloblist test when supported

This test cannot work unless CONFIG_BLOBLIST is enabled. Update it to add
that condition.

Reported-by: Kever Yang <kever.yang@rock-chips.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# f158ba15 05-Nov-2020 Simon Glass <sjg@chromium.org>

bootm: Add tests for fixup_silent_linux()

This function currently has no tests. Export it so that we can implement
a simple test on sandbox. Use IS_ENABLED() to remove the unused code,
instead #ifdef.

Signed-off-by: Simon Glass <sjg@chromium.org>

# de429d7b 31-Oct-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

test: linking test/compression.c fails

Building U-Boot with unit tests on a non-sandbox systems fails:

ld.bfd: test/built-in.o: in function `compress_using_gzip':
test/compression.c:138: undefined reference to `gzip'
ld.bfd: test/built-in.o: in function `uncompress_using_bzip2':
test/compression.c:187: undefined reference to `BZ2_bzBuffToBuffDecompress'
ld.bfd: test/built-in.o: in function `uncompress_using_lzma':
test/compression.c:222: undefined reference to `lzmaBuffToBuffDecompress'
ld.bfd: test/built-in.o: in function `uncompress_using_lzo':
test/compression.c:257: undefined reference to `lzop_decompress'
ld.bfd: test/built-in.o: in function `uncompress_using_lz4':
test/compression.c:292: undefined reference to `ulz4fn

Add the missing dependencies.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c961b1b5 31-Oct-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

test: test/bloblist.c depends on asm/state.h

Building test/bloblist.c fails for non sandbox devices:

test/bloblist.c:10:10: fatal error: asm/state.h: No such file or directory
#include <asm/state.h>
^~~~~~~~~~~~~

Build the test only on the sandbox.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 627988f9 03-Oct-2020 Simon Glass <sjg@chromium.org>

dm: test: Disable some tests that should not run in SPL

Tests are easier to run in U-Boot proper. Running them in SPL does not add
test coverage in most cases. Also some tests use features that are not
available in SPL.

Update the build rules to disable these tests in SPL. We still need
test-main to be able to actually run SPL tests.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 16a50683 03-Oct-2020 Simon Glass <sjg@chromium.org>

dm: test: Make use of CONFIG_UNIT_TEST

At present we always include test/dm from the main Makefile. We have a
CONFIG_UNIT_TEST that should control whether the test/ directory is built,
so rely on that instead.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 82c468a0 03-Oct-2020 Simon Glass <sjg@chromium.org>

dm: test: Update Makefile conditions

At present most of the tests in test/Makefile are dependent on
CONFIG_SANDBOX. But this is not ideal since they rely on commands being
available and SPL does not support commands.

Use CONFIG_COMMAND instead. This has the dual purpose of allowing these
tests to be used on other boards and allowing SPL to skip them.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 1cadc761 03-Oct-2020 Simon Glass <sjg@chromium.org>

dm: test: Sort the Makefile

Move everything into alphabetical order.

Signed-off-by: Simon Glass <sjg@chromium.org>

# bdded201 02-Jun-2020 Simon Glass <sjg@chromium.org>

cmd: Add a memory-search command

It is useful to be able to find hex values and strings in a memory range.
Add a command to support this.

cmd: Fix 'md' and add a memory-search command
At present 'md.q' is broken. This series provides a fix for this. It also
implements a new memory-search command called 'ms'. It allows searching
memory for hex and string data.
END

Signed-off-by: Simon Glass <sjg@chromium.org>

# 4f04d549 08-Apr-2020 Simon Glass <sjg@chromium.org>

test: Add the beginnings of some string tests

There are quite a few string functions in U-Boot with no tests. Make a
start by adding a test for strtoul().

Signed-off-by: Simon Glass <sjg@chromium.org>

# 395041b2 26-Feb-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

test: log functions with CONFIG_LOG=n

If CONFIG_LOG=n, we still expect output for log_err(), log_warning(),
log_notice(), log_info() and in case of DEBUG=1 also for log_debug().

Provide unit tests verifying this.

The tests depend on:

CONFIG_CONSOLE_RECORD=y
CONFIG_LOG=n
CONFIG_UT_LOG=y

It may be necessary to increase the value of CONFIG_SYS_MALLOC_F_LEN to
accommodate CONFIG_CONSOLE_RECORD=y.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 919e7a8f 15-Nov-2018 Simon Glass <sjg@chromium.org>

test: Add a simple test for bloblist

Add a unit test for the bloblist functionality and enable bloblist for
sandbox.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 87be2fe6 27-Sep-2018 Mario Six <mario.six@gdsys.cc>

test: list: Add tests for hexdump.c

Add tests for the hex2bin, bin2hex, and hex_to_bin functions, which were
recently added to U-Boot.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f11a164b 31-Aug-2018 Heinrich Schuchardt <xypron.glpk@gmx.de>

test: unit tests for Unicode functions

Provide unit tests for Unicode functions.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

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>

# ef11ed82 04-Dec-2017 Simon Glass <sjg@chromium.org>

log: Add a test command

Add a command which exercises the logging system.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e5a9d27f 15-Jun-2017 Simon Glass <sjg@chromium.org>

test: Add a test for snprintf() and the banner/version

Add a simple test to make sure that these functions obey the buffer size
passed into them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Stephen Warren <swarren@nvidia.com>

# c812f722 20-May-2015 Joe Hershberger <joe.hershberger@ni.com>

test: dm: Move the time test over to the ut command

Unify the command for running unit tests further by moving the "ut_time"
command over to "ut time".

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# c617ede0 20-May-2015 Joe Hershberger <joe.hershberger@ni.com>

test: Add a common unit test command

Add a command that all other unit tests should be a sub-command of.
Also include a command that will run all tests.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Acked-by: Simon Glass <sjg@chromium.org>

# e721b882 20-May-2015 Joe Hershberger <joe.hershberger@ni.com>

test: Generalize the unit test framework

Separate the ability to define tests and assert status of test functions
from the dm tests so they can be used more consistently throughout all
tests.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8271f5d4 02-May-2015 Simon Glass <sjg@chromium.org>

test: Add a simple time test

Sometimes the time functions are incorrect due to bad time support on a
board. Add a unit test which tries to detect this.

Signed-off-by: Simon Glass <sjg@chromium.org>

# bcfe8fdf 20-Oct-2013 Masahiro Yamada <yamada.m@jp.panasonic.com>

dts, api, test: convert makefiles to Kbuild style

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# 3153e915 16-Aug-2013 Kees Cook <keescook@chromium.org>

sandbox: add compression tests

This adds the "test_compression" command when building the sandbox. This
tests the existing compression and decompression routines for simple
sanity and for buffer overflow conditions.

Signed-off-by: Kees Cook <keescook@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 1a459660 08-Jul-2013 Wolfgang Denk <wd@denx.de>

Add GPL-2.0+ SPDX-License-Identifier to source files

Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini <trini@ti.com>

# a72007d9 30-Mar-2012 Simon Glass <sjg@chromium.org>

sandbox: Add basic test for command execution

Since run_command() and run_command_list() are important and a little
confusing, add some basic tests to check that the behaviour is correct.

Note: I am not sure that this should be committed, nor where it should go
in the source tree. Comments welcome.

To run the unit tests use the ut_cmd command available in sandbox:

make sandbox_config
make
./u-boot -c ut_cmd

(To test both hush and built-in parsers, you need to manually change
CONFIG_SYS_HUSH_PARSER in include/configs/sandbox.h and build/run again)

Signed-off-by: Simon Glass <sjg@chromium.org>

# f093f864 05-Jul-2021 Simon Glass <sjg@chromium.org>

test: Allow CONFIG_SPL_LOAD_FIT to be disabled

At present if this is not enabled on a sandbox build, the build fails. Add
a condition to avoid this.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 2e059e4a 07-Mar-2021 Simon Glass <sjg@chromium.org>

spl: test: Add a test for spl_load_simple_fit()

As an example of an SPL test, add a new test for loading a FIT within
SPL. This runs on sandbox_spl. For this to work, the text base is adjusted
so that there is plenty of space available.

While we are here, document struct spl_load_info properly, since this is
currently ambiguous.

This test only verifies the logic path. It does not actually check that
the image is loaded correctly. It is not possible for sandbox's SPL to
actually run u-boot.img since it currently includes u-boot.bin rather than
u-boot. Further work could expand the test in that direction.

The need for this was noted at:

http://patchwork.ozlabs.org/project/uboot/patch/20201216000944.2832585-3-mr.nuke.me@gmail.com/

Signed-off-by: Simon Glass <sjg@chromium.org>

# 1c721751 07-Mar-2021 Simon Glass <sjg@chromium.org>

test: Add an overall test runner

Add a new test runner that will eventually be able to run any test. For
now, have it run the 'command' unit tests, so that the functionality in
cmd_ut_category() moves into it.

Signed-off-by: Simon Glass <sjg@chromium.org>

# fe158657 17-Jan-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

test: inconsistent bootm tests

Excluding ut bootm in test/cmd_ut.c but compiling test/bootm.c results in
failure of the Python test invoking the C unit tests as observed on
sipeed_riscv_smode_defconfig:

FAILED test/py/tests/test_ut.py::test_ut[ut_bootm_nop]
FAILED test/py/tests/test_ut.py::test_ut[ut_bootm_nospace]
FAILED test/py/tests/test_ut.py::test_ut[ut_bootm_silent]
FAILED test/py/tests/test_ut.py::test_ut[ut_bootm_silent_var]
FAILED test/py/tests/test_ut.py::test_ut[ut_bootm_subst]
FAILED test/py/tests/test_ut.py::test_ut[ut_bootm_subst_both]
FAILED test/py/tests/test_ut.py::test_ut[ut_bootm_subst_var]

Only compile test/bootm.c on the sandbox.

Fixes: f158ba15ee0f ("bootm: Add tests for fixup_silent_linux()")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6ea5df39 08-Nov-2020 Simon Glass <sjg@chromium.org>

test: Only enable bloblist test when supported

This test cannot work unless CONFIG_BLOBLIST is enabled. Update it to add
that condition.

Reported-by: Kever Yang <kever.yang@rock-chips.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# f158ba15 05-Nov-2020 Simon Glass <sjg@chromium.org>

bootm: Add tests for fixup_silent_linux()

This function currently has no tests. Export it so that we can implement
a simple test on sandbox. Use IS_ENABLED() to remove the unused code,
instead #ifdef.

Signed-off-by: Simon Glass <sjg@chromium.org>

# de429d7b 31-Oct-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

test: linking test/compression.c fails

Building U-Boot with unit tests on a non-sandbox systems fails:

ld.bfd: test/built-in.o: in function `compress_using_gzip':
test/compression.c:138: undefined reference to `gzip'
ld.bfd: test/built-in.o: in function `uncompress_using_bzip2':
test/compression.c:187: undefined reference to `BZ2_bzBuffToBuffDecompress'
ld.bfd: test/built-in.o: in function `uncompress_using_lzma':
test/compression.c:222: undefined reference to `lzmaBuffToBuffDecompress'
ld.bfd: test/built-in.o: in function `uncompress_using_lzo':
test/compression.c:257: undefined reference to `lzop_decompress'
ld.bfd: test/built-in.o: in function `uncompress_using_lz4':
test/compression.c:292: undefined reference to `ulz4fn

Add the missing dependencies.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c961b1b5 31-Oct-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

test: test/bloblist.c depends on asm/state.h

Building test/bloblist.c fails for non sandbox devices:

test/bloblist.c:10:10: fatal error: asm/state.h: No such file or directory
#include <asm/state.h>
^~~~~~~~~~~~~

Build the test only on the sandbox.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 627988f9 03-Oct-2020 Simon Glass <sjg@chromium.org>

dm: test: Disable some tests that should not run in SPL

Tests are easier to run in U-Boot proper. Running them in SPL does not add
test coverage in most cases. Also some tests use features that are not
available in SPL.

Update the build rules to disable these tests in SPL. We still need
test-main to be able to actually run SPL tests.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 16a50683 03-Oct-2020 Simon Glass <sjg@chromium.org>

dm: test: Make use of CONFIG_UNIT_TEST

At present we always include test/dm from the main Makefile. We have a
CONFIG_UNIT_TEST that should control whether the test/ directory is built,
so rely on that instead.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 82c468a0 03-Oct-2020 Simon Glass <sjg@chromium.org>

dm: test: Update Makefile conditions

At present most of the tests in test/Makefile are dependent on
CONFIG_SANDBOX. But this is not ideal since they rely on commands being
available and SPL does not support commands.

Use CONFIG_COMMAND instead. This has the dual purpose of allowing these
tests to be used on other boards and allowing SPL to skip them.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 1cadc761 03-Oct-2020 Simon Glass <sjg@chromium.org>

dm: test: Sort the Makefile

Move everything into alphabetical order.

Signed-off-by: Simon Glass <sjg@chromium.org>

# bdded201 02-Jun-2020 Simon Glass <sjg@chromium.org>

cmd: Add a memory-search command

It is useful to be able to find hex values and strings in a memory range.
Add a command to support this.

cmd: Fix 'md' and add a memory-search command
At present 'md.q' is broken. This series provides a fix for this. It also
implements a new memory-search command called 'ms'. It allows searching
memory for hex and string data.
END

Signed-off-by: Simon Glass <sjg@chromium.org>

# 4f04d549 08-Apr-2020 Simon Glass <sjg@chromium.org>

test: Add the beginnings of some string tests

There are quite a few string functions in U-Boot with no tests. Make a
start by adding a test for strtoul().

Signed-off-by: Simon Glass <sjg@chromium.org>

# 395041b2 26-Feb-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

test: log functions with CONFIG_LOG=n

If CONFIG_LOG=n, we still expect output for log_err(), log_warning(),
log_notice(), log_info() and in case of DEBUG=1 also for log_debug().

Provide unit tests verifying this.

The tests depend on:

CONFIG_CONSOLE_RECORD=y
CONFIG_LOG=n
CONFIG_UT_LOG=y

It may be necessary to increase the value of CONFIG_SYS_MALLOC_F_LEN to
accommodate CONFIG_CONSOLE_RECORD=y.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 919e7a8f 15-Nov-2018 Simon Glass <sjg@chromium.org>

test: Add a simple test for bloblist

Add a unit test for the bloblist functionality and enable bloblist for
sandbox.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 87be2fe6 27-Sep-2018 Mario Six <mario.six@gdsys.cc>

test: list: Add tests for hexdump.c

Add tests for the hex2bin, bin2hex, and hex_to_bin functions, which were
recently added to U-Boot.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f11a164b 31-Aug-2018 Heinrich Schuchardt <xypron.glpk@gmx.de>

test: unit tests for Unicode functions

Provide unit tests for Unicode functions.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

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>

# ef11ed82 04-Dec-2017 Simon Glass <sjg@chromium.org>

log: Add a test command

Add a command which exercises the logging system.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e5a9d27f 15-Jun-2017 Simon Glass <sjg@chromium.org>

test: Add a test for snprintf() and the banner/version

Add a simple test to make sure that these functions obey the buffer size
passed into them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Stephen Warren <swarren@nvidia.com>

# c812f722 20-May-2015 Joe Hershberger <joe.hershberger@ni.com>

test: dm: Move the time test over to the ut command

Unify the command for running unit tests further by moving the "ut_time"
command over to "ut time".

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# c617ede0 20-May-2015 Joe Hershberger <joe.hershberger@ni.com>

test: Add a common unit test command

Add a command that all other unit tests should be a sub-command of.
Also include a command that will run all tests.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Acked-by: Simon Glass <sjg@chromium.org>

# e721b882 20-May-2015 Joe Hershberger <joe.hershberger@ni.com>

test: Generalize the unit test framework

Separate the ability to define tests and assert status of test functions
from the dm tests so they can be used more consistently throughout all
tests.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8271f5d4 02-May-2015 Simon Glass <sjg@chromium.org>

test: Add a simple time test

Sometimes the time functions are incorrect due to bad time support on a
board. Add a unit test which tries to detect this.

Signed-off-by: Simon Glass <sjg@chromium.org>

# bcfe8fdf 20-Oct-2013 Masahiro Yamada <yamada.m@jp.panasonic.com>

dts, api, test: convert makefiles to Kbuild style

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# 3153e915 16-Aug-2013 Kees Cook <keescook@chromium.org>

sandbox: add compression tests

This adds the "test_compression" command when building the sandbox. This
tests the existing compression and decompression routines for simple
sanity and for buffer overflow conditions.

Signed-off-by: Kees Cook <keescook@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 1a459660 08-Jul-2013 Wolfgang Denk <wd@denx.de>

Add GPL-2.0+ SPDX-License-Identifier to source files

Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini <trini@ti.com>

# a72007d9 30-Mar-2012 Simon Glass <sjg@chromium.org>

sandbox: Add basic test for command execution

Since run_command() and run_command_list() are important and a little
confusing, add some basic tests to check that the behaviour is correct.

Note: I am not sure that this should be committed, nor where it should go
in the source tree. Comments welcome.

To run the unit tests use the ut_cmd command available in sandbox:

make sandbox_config
make
./u-boot -c ut_cmd

(To test both hush and built-in parsers, you need to manually change
CONFIG_SYS_HUSH_PARSER in include/configs/sandbox.h and build/run again)

Signed-off-by: Simon Glass <sjg@chromium.org>

# 2e059e4a 07-Mar-2021 Simon Glass <sjg@chromium.org>

spl: test: Add a test for spl_load_simple_fit()

As an example of an SPL test, add a new test for loading a FIT within
SPL. This runs on sandbox_spl. For this to work, the text base is adjusted
so that there is plenty of space available.

While we are here, document struct spl_load_info properly, since this is
currently ambiguous.

This test only verifies the logic path. It does not actually check that
the image is loaded correctly. It is not possible for sandbox's SPL to
actually run u-boot.img since it currently includes u-boot.bin rather than
u-boot. Further work could expand the test in that direction.

The need for this was noted at:

http://patchwork.ozlabs.org/project/uboot/patch/20201216000944.2832585-3-mr.nuke.me@gmail.com/

Signed-off-by: Simon Glass <sjg@chromium.org>

# 1c721751 07-Mar-2021 Simon Glass <sjg@chromium.org>

test: Add an overall test runner

Add a new test runner that will eventually be able to run any test. For
now, have it run the 'command' unit tests, so that the functionality in
cmd_ut_category() moves into it.

Signed-off-by: Simon Glass <sjg@chromium.org>

# fe158657 17-Jan-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

test: inconsistent bootm tests

Excluding ut bootm in test/cmd_ut.c but compiling test/bootm.c results in
failure of the Python test invoking the C unit tests as observed on
sipeed_riscv_smode_defconfig:

FAILED test/py/tests/test_ut.py::test_ut[ut_bootm_nop]
FAILED test/py/tests/test_ut.py::test_ut[ut_bootm_nospace]
FAILED test/py/tests/test_ut.py::test_ut[ut_bootm_silent]
FAILED test/py/tests/test_ut.py::test_ut[ut_bootm_silent_var]
FAILED test/py/tests/test_ut.py::test_ut[ut_bootm_subst]
FAILED test/py/tests/test_ut.py::test_ut[ut_bootm_subst_both]
FAILED test/py/tests/test_ut.py::test_ut[ut_bootm_subst_var]

Only compile test/bootm.c on the sandbox.

Fixes: f158ba15ee0f ("bootm: Add tests for fixup_silent_linux()")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6ea5df39 08-Nov-2020 Simon Glass <sjg@chromium.org>

test: Only enable bloblist test when supported

This test cannot work unless CONFIG_BLOBLIST is enabled. Update it to add
that condition.

Reported-by: Kever Yang <kever.yang@rock-chips.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# f158ba15 05-Nov-2020 Simon Glass <sjg@chromium.org>

bootm: Add tests for fixup_silent_linux()

This function currently has no tests. Export it so that we can implement
a simple test on sandbox. Use IS_ENABLED() to remove the unused code,
instead #ifdef.

Signed-off-by: Simon Glass <sjg@chromium.org>

# de429d7b 31-Oct-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

test: linking test/compression.c fails

Building U-Boot with unit tests on a non-sandbox systems fails:

ld.bfd: test/built-in.o: in function `compress_using_gzip':
test/compression.c:138: undefined reference to `gzip'
ld.bfd: test/built-in.o: in function `uncompress_using_bzip2':
test/compression.c:187: undefined reference to `BZ2_bzBuffToBuffDecompress'
ld.bfd: test/built-in.o: in function `uncompress_using_lzma':
test/compression.c:222: undefined reference to `lzmaBuffToBuffDecompress'
ld.bfd: test/built-in.o: in function `uncompress_using_lzo':
test/compression.c:257: undefined reference to `lzop_decompress'
ld.bfd: test/built-in.o: in function `uncompress_using_lz4':
test/compression.c:292: undefined reference to `ulz4fn

Add the missing dependencies.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c961b1b5 31-Oct-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

test: test/bloblist.c depends on asm/state.h

Building test/bloblist.c fails for non sandbox devices:

test/bloblist.c:10:10: fatal error: asm/state.h: No such file or directory
#include <asm/state.h>
^~~~~~~~~~~~~

Build the test only on the sandbox.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 627988f9 03-Oct-2020 Simon Glass <sjg@chromium.org>

dm: test: Disable some tests that should not run in SPL

Tests are easier to run in U-Boot proper. Running them in SPL does not add
test coverage in most cases. Also some tests use features that are not
available in SPL.

Update the build rules to disable these tests in SPL. We still need
test-main to be able to actually run SPL tests.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 16a50683 03-Oct-2020 Simon Glass <sjg@chromium.org>

dm: test: Make use of CONFIG_UNIT_TEST

At present we always include test/dm from the main Makefile. We have a
CONFIG_UNIT_TEST that should control whether the test/ directory is built,
so rely on that instead.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 82c468a0 03-Oct-2020 Simon Glass <sjg@chromium.org>

dm: test: Update Makefile conditions

At present most of the tests in test/Makefile are dependent on
CONFIG_SANDBOX. But this is not ideal since they rely on commands being
available and SPL does not support commands.

Use CONFIG_COMMAND instead. This has the dual purpose of allowing these
tests to be used on other boards and allowing SPL to skip them.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 1cadc761 03-Oct-2020 Simon Glass <sjg@chromium.org>

dm: test: Sort the Makefile

Move everything into alphabetical order.

Signed-off-by: Simon Glass <sjg@chromium.org>

# bdded201 02-Jun-2020 Simon Glass <sjg@chromium.org>

cmd: Add a memory-search command

It is useful to be able to find hex values and strings in a memory range.
Add a command to support this.

cmd: Fix 'md' and add a memory-search command
At present 'md.q' is broken. This series provides a fix for this. It also
implements a new memory-search command called 'ms'. It allows searching
memory for hex and string data.
END

Signed-off-by: Simon Glass <sjg@chromium.org>

# 4f04d549 08-Apr-2020 Simon Glass <sjg@chromium.org>

test: Add the beginnings of some string tests

There are quite a few string functions in U-Boot with no tests. Make a
start by adding a test for strtoul().

Signed-off-by: Simon Glass <sjg@chromium.org>

# 395041b2 26-Feb-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

test: log functions with CONFIG_LOG=n

If CONFIG_LOG=n, we still expect output for log_err(), log_warning(),
log_notice(), log_info() and in case of DEBUG=1 also for log_debug().

Provide unit tests verifying this.

The tests depend on:

CONFIG_CONSOLE_RECORD=y
CONFIG_LOG=n
CONFIG_UT_LOG=y

It may be necessary to increase the value of CONFIG_SYS_MALLOC_F_LEN to
accommodate CONFIG_CONSOLE_RECORD=y.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 919e7a8f 15-Nov-2018 Simon Glass <sjg@chromium.org>

test: Add a simple test for bloblist

Add a unit test for the bloblist functionality and enable bloblist for
sandbox.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 87be2fe6 27-Sep-2018 Mario Six <mario.six@gdsys.cc>

test: list: Add tests for hexdump.c

Add tests for the hex2bin, bin2hex, and hex_to_bin functions, which were
recently added to U-Boot.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f11a164b 31-Aug-2018 Heinrich Schuchardt <xypron.glpk@gmx.de>

test: unit tests for Unicode functions

Provide unit tests for Unicode functions.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

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>

# ef11ed82 04-Dec-2017 Simon Glass <sjg@chromium.org>

log: Add a test command

Add a command which exercises the logging system.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e5a9d27f 15-Jun-2017 Simon Glass <sjg@chromium.org>

test: Add a test for snprintf() and the banner/version

Add a simple test to make sure that these functions obey the buffer size
passed into them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Stephen Warren <swarren@nvidia.com>

# c812f722 20-May-2015 Joe Hershberger <joe.hershberger@ni.com>

test: dm: Move the time test over to the ut command

Unify the command for running unit tests further by moving the "ut_time"
command over to "ut time".

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# c617ede0 20-May-2015 Joe Hershberger <joe.hershberger@ni.com>

test: Add a common unit test command

Add a command that all other unit tests should be a sub-command of.
Also include a command that will run all tests.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Acked-by: Simon Glass <sjg@chromium.org>

# e721b882 20-May-2015 Joe Hershberger <joe.hershberger@ni.com>

test: Generalize the unit test framework

Separate the ability to define tests and assert status of test functions
from the dm tests so they can be used more consistently throughout all
tests.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8271f5d4 02-May-2015 Simon Glass <sjg@chromium.org>

test: Add a simple time test

Sometimes the time functions are incorrect due to bad time support on a
board. Add a unit test which tries to detect this.

Signed-off-by: Simon Glass <sjg@chromium.org>

# bcfe8fdf 20-Oct-2013 Masahiro Yamada <yamada.m@jp.panasonic.com>

dts, api, test: convert makefiles to Kbuild style

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# 3153e915 16-Aug-2013 Kees Cook <keescook@chromium.org>

sandbox: add compression tests

This adds the "test_compression" command when building the sandbox. This
tests the existing compression and decompression routines for simple
sanity and for buffer overflow conditions.

Signed-off-by: Kees Cook <keescook@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 1a459660 08-Jul-2013 Wolfgang Denk <wd@denx.de>

Add GPL-2.0+ SPDX-License-Identifier to source files

Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini <trini@ti.com>

# a72007d9 30-Mar-2012 Simon Glass <sjg@chromium.org>

sandbox: Add basic test for command execution

Since run_command() and run_command_list() are important and a little
confusing, add some basic tests to check that the behaviour is correct.

Note: I am not sure that this should be committed, nor where it should go
in the source tree. Comments welcome.

To run the unit tests use the ut_cmd command available in sandbox:

make sandbox_config
make
./u-boot -c ut_cmd

(To test both hush and built-in parsers, you need to manually change
CONFIG_SYS_HUSH_PARSER in include/configs/sandbox.h and build/run again)

Signed-off-by: Simon Glass <sjg@chromium.org>

# fe158657 17-Jan-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

test: inconsistent bootm tests

Excluding ut bootm in test/cmd_ut.c but compiling test/bootm.c results in
failure of the Python test invoking the C unit tests as observed on
sipeed_riscv_smode_defconfig:

FAILED test/py/tests/test_ut.py::test_ut[ut_bootm_nop]
FAILED test/py/tests/test_ut.py::test_ut[ut_bootm_nospace]
FAILED test/py/tests/test_ut.py::test_ut[ut_bootm_silent]
FAILED test/py/tests/test_ut.py::test_ut[ut_bootm_silent_var]
FAILED test/py/tests/test_ut.py::test_ut[ut_bootm_subst]
FAILED test/py/tests/test_ut.py::test_ut[ut_bootm_subst_both]
FAILED test/py/tests/test_ut.py::test_ut[ut_bootm_subst_var]

Only compile test/bootm.c on the sandbox.

Fixes: f158ba15ee0f ("bootm: Add tests for fixup_silent_linux()")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6ea5df39 08-Nov-2020 Simon Glass <sjg@chromium.org>

test: Only enable bloblist test when supported

This test cannot work unless CONFIG_BLOBLIST is enabled. Update it to add
that condition.

Reported-by: Kever Yang <kever.yang@rock-chips.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# f158ba15 05-Nov-2020 Simon Glass <sjg@chromium.org>

bootm: Add tests for fixup_silent_linux()

This function currently has no tests. Export it so that we can implement
a simple test on sandbox. Use IS_ENABLED() to remove the unused code,
instead #ifdef.

Signed-off-by: Simon Glass <sjg@chromium.org>

# de429d7b 31-Oct-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

test: linking test/compression.c fails

Building U-Boot with unit tests on a non-sandbox systems fails:

ld.bfd: test/built-in.o: in function `compress_using_gzip':
test/compression.c:138: undefined reference to `gzip'
ld.bfd: test/built-in.o: in function `uncompress_using_bzip2':
test/compression.c:187: undefined reference to `BZ2_bzBuffToBuffDecompress'
ld.bfd: test/built-in.o: in function `uncompress_using_lzma':
test/compression.c:222: undefined reference to `lzmaBuffToBuffDecompress'
ld.bfd: test/built-in.o: in function `uncompress_using_lzo':
test/compression.c:257: undefined reference to `lzop_decompress'
ld.bfd: test/built-in.o: in function `uncompress_using_lz4':
test/compression.c:292: undefined reference to `ulz4fn

Add the missing dependencies.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c961b1b5 31-Oct-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

test: test/bloblist.c depends on asm/state.h

Building test/bloblist.c fails for non sandbox devices:

test/bloblist.c:10:10: fatal error: asm/state.h: No such file or directory
#include <asm/state.h>
^~~~~~~~~~~~~

Build the test only on the sandbox.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 627988f9 03-Oct-2020 Simon Glass <sjg@chromium.org>

dm: test: Disable some tests that should not run in SPL

Tests are easier to run in U-Boot proper. Running them in SPL does not add
test coverage in most cases. Also some tests use features that are not
available in SPL.

Update the build rules to disable these tests in SPL. We still need
test-main to be able to actually run SPL tests.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 16a50683 03-Oct-2020 Simon Glass <sjg@chromium.org>

dm: test: Make use of CONFIG_UNIT_TEST

At present we always include test/dm from the main Makefile. We have a
CONFIG_UNIT_TEST that should control whether the test/ directory is built,
so rely on that instead.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 82c468a0 03-Oct-2020 Simon Glass <sjg@chromium.org>

dm: test: Update Makefile conditions

At present most of the tests in test/Makefile are dependent on
CONFIG_SANDBOX. But this is not ideal since they rely on commands being
available and SPL does not support commands.

Use CONFIG_COMMAND instead. This has the dual purpose of allowing these
tests to be used on other boards and allowing SPL to skip them.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 1cadc761 03-Oct-2020 Simon Glass <sjg@chromium.org>

dm: test: Sort the Makefile

Move everything into alphabetical order.

Signed-off-by: Simon Glass <sjg@chromium.org>

# bdded201 02-Jun-2020 Simon Glass <sjg@chromium.org>

cmd: Add a memory-search command

It is useful to be able to find hex values and strings in a memory range.
Add a command to support this.

cmd: Fix 'md' and add a memory-search command
At present 'md.q' is broken. This series provides a fix for this. It also
implements a new memory-search command called 'ms'. It allows searching
memory for hex and string data.
END

Signed-off-by: Simon Glass <sjg@chromium.org>

# 4f04d549 08-Apr-2020 Simon Glass <sjg@chromium.org>

test: Add the beginnings of some string tests

There are quite a few string functions in U-Boot with no tests. Make a
start by adding a test for strtoul().

Signed-off-by: Simon Glass <sjg@chromium.org>

# 395041b2 26-Feb-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

test: log functions with CONFIG_LOG=n

If CONFIG_LOG=n, we still expect output for log_err(), log_warning(),
log_notice(), log_info() and in case of DEBUG=1 also for log_debug().

Provide unit tests verifying this.

The tests depend on:

CONFIG_CONSOLE_RECORD=y
CONFIG_LOG=n
CONFIG_UT_LOG=y

It may be necessary to increase the value of CONFIG_SYS_MALLOC_F_LEN to
accommodate CONFIG_CONSOLE_RECORD=y.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 919e7a8f 15-Nov-2018 Simon Glass <sjg@chromium.org>

test: Add a simple test for bloblist

Add a unit test for the bloblist functionality and enable bloblist for
sandbox.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 87be2fe6 27-Sep-2018 Mario Six <mario.six@gdsys.cc>

test: list: Add tests for hexdump.c

Add tests for the hex2bin, bin2hex, and hex_to_bin functions, which were
recently added to U-Boot.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f11a164b 31-Aug-2018 Heinrich Schuchardt <xypron.glpk@gmx.de>

test: unit tests for Unicode functions

Provide unit tests for Unicode functions.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

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>

# ef11ed82 04-Dec-2017 Simon Glass <sjg@chromium.org>

log: Add a test command

Add a command which exercises the logging system.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e5a9d27f 15-Jun-2017 Simon Glass <sjg@chromium.org>

test: Add a test for snprintf() and the banner/version

Add a simple test to make sure that these functions obey the buffer size
passed into them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Stephen Warren <swarren@nvidia.com>

# c812f722 20-May-2015 Joe Hershberger <joe.hershberger@ni.com>

test: dm: Move the time test over to the ut command

Unify the command for running unit tests further by moving the "ut_time"
command over to "ut time".

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# c617ede0 20-May-2015 Joe Hershberger <joe.hershberger@ni.com>

test: Add a common unit test command

Add a command that all other unit tests should be a sub-command of.
Also include a command that will run all tests.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Acked-by: Simon Glass <sjg@chromium.org>

# e721b882 20-May-2015 Joe Hershberger <joe.hershberger@ni.com>

test: Generalize the unit test framework

Separate the ability to define tests and assert status of test functions
from the dm tests so they can be used more consistently throughout all
tests.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8271f5d4 02-May-2015 Simon Glass <sjg@chromium.org>

test: Add a simple time test

Sometimes the time functions are incorrect due to bad time support on a
board. Add a unit test which tries to detect this.

Signed-off-by: Simon Glass <sjg@chromium.org>

# bcfe8fdf 20-Oct-2013 Masahiro Yamada <yamada.m@jp.panasonic.com>

dts, api, test: convert makefiles to Kbuild style

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# 3153e915 16-Aug-2013 Kees Cook <keescook@chromium.org>

sandbox: add compression tests

This adds the "test_compression" command when building the sandbox. This
tests the existing compression and decompression routines for simple
sanity and for buffer overflow conditions.

Signed-off-by: Kees Cook <keescook@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 1a459660 08-Jul-2013 Wolfgang Denk <wd@denx.de>

Add GPL-2.0+ SPDX-License-Identifier to source files

Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini <trini@ti.com>

# a72007d9 30-Mar-2012 Simon Glass <sjg@chromium.org>

sandbox: Add basic test for command execution

Since run_command() and run_command_list() are important and a little
confusing, add some basic tests to check that the behaviour is correct.

Note: I am not sure that this should be committed, nor where it should go
in the source tree. Comments welcome.

To run the unit tests use the ut_cmd command available in sandbox:

make sandbox_config
make
./u-boot -c ut_cmd

(To test both hush and built-in parsers, you need to manually change
CONFIG_SYS_HUSH_PARSER in include/configs/sandbox.h and build/run again)

Signed-off-by: Simon Glass <sjg@chromium.org>

# 6ea5df39 08-Nov-2020 Simon Glass <sjg@chromium.org>

test: Only enable bloblist test when supported

This test cannot work unless CONFIG_BLOBLIST is enabled. Update it to add
that condition.

Reported-by: Kever Yang <kever.yang@rock-chips.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# f158ba15 05-Nov-2020 Simon Glass <sjg@chromium.org>

bootm: Add tests for fixup_silent_linux()

This function currently has no tests. Export it so that we can implement
a simple test on sandbox. Use IS_ENABLED() to remove the unused code,
instead #ifdef.

Signed-off-by: Simon Glass <sjg@chromium.org>

# de429d7b 31-Oct-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

test: linking test/compression.c fails

Building U-Boot with unit tests on a non-sandbox systems fails:

ld.bfd: test/built-in.o: in function `compress_using_gzip':
test/compression.c:138: undefined reference to `gzip'
ld.bfd: test/built-in.o: in function `uncompress_using_bzip2':
test/compression.c:187: undefined reference to `BZ2_bzBuffToBuffDecompress'
ld.bfd: test/built-in.o: in function `uncompress_using_lzma':
test/compression.c:222: undefined reference to `lzmaBuffToBuffDecompress'
ld.bfd: test/built-in.o: in function `uncompress_using_lzo':
test/compression.c:257: undefined reference to `lzop_decompress'
ld.bfd: test/built-in.o: in function `uncompress_using_lz4':
test/compression.c:292: undefined reference to `ulz4fn

Add the missing dependencies.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c961b1b5 31-Oct-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

test: test/bloblist.c depends on asm/state.h

Building test/bloblist.c fails for non sandbox devices:

test/bloblist.c:10:10: fatal error: asm/state.h: No such file or directory
#include <asm/state.h>
^~~~~~~~~~~~~

Build the test only on the sandbox.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 627988f9 03-Oct-2020 Simon Glass <sjg@chromium.org>

dm: test: Disable some tests that should not run in SPL

Tests are easier to run in U-Boot proper. Running them in SPL does not add
test coverage in most cases. Also some tests use features that are not
available in SPL.

Update the build rules to disable these tests in SPL. We still need
test-main to be able to actually run SPL tests.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 16a50683 03-Oct-2020 Simon Glass <sjg@chromium.org>

dm: test: Make use of CONFIG_UNIT_TEST

At present we always include test/dm from the main Makefile. We have a
CONFIG_UNIT_TEST that should control whether the test/ directory is built,
so rely on that instead.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 82c468a0 03-Oct-2020 Simon Glass <sjg@chromium.org>

dm: test: Update Makefile conditions

At present most of the tests in test/Makefile are dependent on
CONFIG_SANDBOX. But this is not ideal since they rely on commands being
available and SPL does not support commands.

Use CONFIG_COMMAND instead. This has the dual purpose of allowing these
tests to be used on other boards and allowing SPL to skip them.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 1cadc761 03-Oct-2020 Simon Glass <sjg@chromium.org>

dm: test: Sort the Makefile

Move everything into alphabetical order.

Signed-off-by: Simon Glass <sjg@chromium.org>

# bdded201 02-Jun-2020 Simon Glass <sjg@chromium.org>

cmd: Add a memory-search command

It is useful to be able to find hex values and strings in a memory range.
Add a command to support this.

cmd: Fix 'md' and add a memory-search command
At present 'md.q' is broken. This series provides a fix for this. It also
implements a new memory-search command called 'ms'. It allows searching
memory for hex and string data.
END

Signed-off-by: Simon Glass <sjg@chromium.org>

# 4f04d549 08-Apr-2020 Simon Glass <sjg@chromium.org>

test: Add the beginnings of some string tests

There are quite a few string functions in U-Boot with no tests. Make a
start by adding a test for strtoul().

Signed-off-by: Simon Glass <sjg@chromium.org>

# 395041b2 26-Feb-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

test: log functions with CONFIG_LOG=n

If CONFIG_LOG=n, we still expect output for log_err(), log_warning(),
log_notice(), log_info() and in case of DEBUG=1 also for log_debug().

Provide unit tests verifying this.

The tests depend on:

CONFIG_CONSOLE_RECORD=y
CONFIG_LOG=n
CONFIG_UT_LOG=y

It may be necessary to increase the value of CONFIG_SYS_MALLOC_F_LEN to
accommodate CONFIG_CONSOLE_RECORD=y.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 919e7a8f 15-Nov-2018 Simon Glass <sjg@chromium.org>

test: Add a simple test for bloblist

Add a unit test for the bloblist functionality and enable bloblist for
sandbox.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 87be2fe6 27-Sep-2018 Mario Six <mario.six@gdsys.cc>

test: list: Add tests for hexdump.c

Add tests for the hex2bin, bin2hex, and hex_to_bin functions, which were
recently added to U-Boot.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f11a164b 31-Aug-2018 Heinrich Schuchardt <xypron.glpk@gmx.de>

test: unit tests for Unicode functions

Provide unit tests for Unicode functions.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

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>

# ef11ed82 04-Dec-2017 Simon Glass <sjg@chromium.org>

log: Add a test command

Add a command which exercises the logging system.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e5a9d27f 15-Jun-2017 Simon Glass <sjg@chromium.org>

test: Add a test for snprintf() and the banner/version

Add a simple test to make sure that these functions obey the buffer size
passed into them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Stephen Warren <swarren@nvidia.com>

# c812f722 20-May-2015 Joe Hershberger <joe.hershberger@ni.com>

test: dm: Move the time test over to the ut command

Unify the command for running unit tests further by moving the "ut_time"
command over to "ut time".

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# c617ede0 20-May-2015 Joe Hershberger <joe.hershberger@ni.com>

test: Add a common unit test command

Add a command that all other unit tests should be a sub-command of.
Also include a command that will run all tests.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Acked-by: Simon Glass <sjg@chromium.org>

# e721b882 20-May-2015 Joe Hershberger <joe.hershberger@ni.com>

test: Generalize the unit test framework

Separate the ability to define tests and assert status of test functions
from the dm tests so they can be used more consistently throughout all
tests.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8271f5d4 02-May-2015 Simon Glass <sjg@chromium.org>

test: Add a simple time test

Sometimes the time functions are incorrect due to bad time support on a
board. Add a unit test which tries to detect this.

Signed-off-by: Simon Glass <sjg@chromium.org>

# bcfe8fdf 20-Oct-2013 Masahiro Yamada <yamada.m@jp.panasonic.com>

dts, api, test: convert makefiles to Kbuild style

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# 3153e915 16-Aug-2013 Kees Cook <keescook@chromium.org>

sandbox: add compression tests

This adds the "test_compression" command when building the sandbox. This
tests the existing compression and decompression routines for simple
sanity and for buffer overflow conditions.

Signed-off-by: Kees Cook <keescook@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 1a459660 08-Jul-2013 Wolfgang Denk <wd@denx.de>

Add GPL-2.0+ SPDX-License-Identifier to source files

Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini <trini@ti.com>

# a72007d9 30-Mar-2012 Simon Glass <sjg@chromium.org>

sandbox: Add basic test for command execution

Since run_command() and run_command_list() are important and a little
confusing, add some basic tests to check that the behaviour is correct.

Note: I am not sure that this should be committed, nor where it should go
in the source tree. Comments welcome.

To run the unit tests use the ut_cmd command available in sandbox:

make sandbox_config
make
./u-boot -c ut_cmd

(To test both hush and built-in parsers, you need to manually change
CONFIG_SYS_HUSH_PARSER in include/configs/sandbox.h and build/run again)

Signed-off-by: Simon Glass <sjg@chromium.org>

# f158ba15 05-Nov-2020 Simon Glass <sjg@chromium.org>

bootm: Add tests for fixup_silent_linux()

This function currently has no tests. Export it so that we can implement
a simple test on sandbox. Use IS_ENABLED() to remove the unused code,
instead #ifdef.

Signed-off-by: Simon Glass <sjg@chromium.org>

# de429d7b 31-Oct-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

test: linking test/compression.c fails

Building U-Boot with unit tests on a non-sandbox systems fails:

ld.bfd: test/built-in.o: in function `compress_using_gzip':
test/compression.c:138: undefined reference to `gzip'
ld.bfd: test/built-in.o: in function `uncompress_using_bzip2':
test/compression.c:187: undefined reference to `BZ2_bzBuffToBuffDecompress'
ld.bfd: test/built-in.o: in function `uncompress_using_lzma':
test/compression.c:222: undefined reference to `lzmaBuffToBuffDecompress'
ld.bfd: test/built-in.o: in function `uncompress_using_lzo':
test/compression.c:257: undefined reference to `lzop_decompress'
ld.bfd: test/built-in.o: in function `uncompress_using_lz4':
test/compression.c:292: undefined reference to `ulz4fn

Add the missing dependencies.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c961b1b5 31-Oct-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

test: test/bloblist.c depends on asm/state.h

Building test/bloblist.c fails for non sandbox devices:

test/bloblist.c:10:10: fatal error: asm/state.h: No such file or directory
#include <asm/state.h>
^~~~~~~~~~~~~

Build the test only on the sandbox.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 627988f9 03-Oct-2020 Simon Glass <sjg@chromium.org>

dm: test: Disable some tests that should not run in SPL

Tests are easier to run in U-Boot proper. Running them in SPL does not add
test coverage in most cases. Also some tests use features that are not
available in SPL.

Update the build rules to disable these tests in SPL. We still need
test-main to be able to actually run SPL tests.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 16a50683 03-Oct-2020 Simon Glass <sjg@chromium.org>

dm: test: Make use of CONFIG_UNIT_TEST

At present we always include test/dm from the main Makefile. We have a
CONFIG_UNIT_TEST that should control whether the test/ directory is built,
so rely on that instead.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 82c468a0 03-Oct-2020 Simon Glass <sjg@chromium.org>

dm: test: Update Makefile conditions

At present most of the tests in test/Makefile are dependent on
CONFIG_SANDBOX. But this is not ideal since they rely on commands being
available and SPL does not support commands.

Use CONFIG_COMMAND instead. This has the dual purpose of allowing these
tests to be used on other boards and allowing SPL to skip them.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 1cadc761 03-Oct-2020 Simon Glass <sjg@chromium.org>

dm: test: Sort the Makefile

Move everything into alphabetical order.

Signed-off-by: Simon Glass <sjg@chromium.org>

# bdded201 02-Jun-2020 Simon Glass <sjg@chromium.org>

cmd: Add a memory-search command

It is useful to be able to find hex values and strings in a memory range.
Add a command to support this.

cmd: Fix 'md' and add a memory-search command
At present 'md.q' is broken. This series provides a fix for this. It also
implements a new memory-search command called 'ms'. It allows searching
memory for hex and string data.
END

Signed-off-by: Simon Glass <sjg@chromium.org>

# 4f04d549 08-Apr-2020 Simon Glass <sjg@chromium.org>

test: Add the beginnings of some string tests

There are quite a few string functions in U-Boot with no tests. Make a
start by adding a test for strtoul().

Signed-off-by: Simon Glass <sjg@chromium.org>

# 395041b2 26-Feb-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

test: log functions with CONFIG_LOG=n

If CONFIG_LOG=n, we still expect output for log_err(), log_warning(),
log_notice(), log_info() and in case of DEBUG=1 also for log_debug().

Provide unit tests verifying this.

The tests depend on:

CONFIG_CONSOLE_RECORD=y
CONFIG_LOG=n
CONFIG_UT_LOG=y

It may be necessary to increase the value of CONFIG_SYS_MALLOC_F_LEN to
accommodate CONFIG_CONSOLE_RECORD=y.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 919e7a8f 15-Nov-2018 Simon Glass <sjg@chromium.org>

test: Add a simple test for bloblist

Add a unit test for the bloblist functionality and enable bloblist for
sandbox.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 87be2fe6 27-Sep-2018 Mario Six <mario.six@gdsys.cc>

test: list: Add tests for hexdump.c

Add tests for the hex2bin, bin2hex, and hex_to_bin functions, which were
recently added to U-Boot.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f11a164b 31-Aug-2018 Heinrich Schuchardt <xypron.glpk@gmx.de>

test: unit tests for Unicode functions

Provide unit tests for Unicode functions.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

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>

# ef11ed82 04-Dec-2017 Simon Glass <sjg@chromium.org>

log: Add a test command

Add a command which exercises the logging system.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e5a9d27f 15-Jun-2017 Simon Glass <sjg@chromium.org>

test: Add a test for snprintf() and the banner/version

Add a simple test to make sure that these functions obey the buffer size
passed into them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Stephen Warren <swarren@nvidia.com>

# c812f722 20-May-2015 Joe Hershberger <joe.hershberger@ni.com>

test: dm: Move the time test over to the ut command

Unify the command for running unit tests further by moving the "ut_time"
command over to "ut time".

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# c617ede0 20-May-2015 Joe Hershberger <joe.hershberger@ni.com>

test: Add a common unit test command

Add a command that all other unit tests should be a sub-command of.
Also include a command that will run all tests.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Acked-by: Simon Glass <sjg@chromium.org>

# e721b882 20-May-2015 Joe Hershberger <joe.hershberger@ni.com>

test: Generalize the unit test framework

Separate the ability to define tests and assert status of test functions
from the dm tests so they can be used more consistently throughout all
tests.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8271f5d4 02-May-2015 Simon Glass <sjg@chromium.org>

test: Add a simple time test

Sometimes the time functions are incorrect due to bad time support on a
board. Add a unit test which tries to detect this.

Signed-off-by: Simon Glass <sjg@chromium.org>

# bcfe8fdf 20-Oct-2013 Masahiro Yamada <yamada.m@jp.panasonic.com>

dts, api, test: convert makefiles to Kbuild style

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# 3153e915 16-Aug-2013 Kees Cook <keescook@chromium.org>

sandbox: add compression tests

This adds the "test_compression" command when building the sandbox. This
tests the existing compression and decompression routines for simple
sanity and for buffer overflow conditions.

Signed-off-by: Kees Cook <keescook@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 1a459660 08-Jul-2013 Wolfgang Denk <wd@denx.de>

Add GPL-2.0+ SPDX-License-Identifier to source files

Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini <trini@ti.com>

# a72007d9 30-Mar-2012 Simon Glass <sjg@chromium.org>

sandbox: Add basic test for command execution

Since run_command() and run_command_list() are important and a little
confusing, add some basic tests to check that the behaviour is correct.

Note: I am not sure that this should be committed, nor where it should go
in the source tree. Comments welcome.

To run the unit tests use the ut_cmd command available in sandbox:

make sandbox_config
make
./u-boot -c ut_cmd

(To test both hush and built-in parsers, you need to manually change
CONFIG_SYS_HUSH_PARSER in include/configs/sandbox.h and build/run again)

Signed-off-by: Simon Glass <sjg@chromium.org>

# de429d7b 31-Oct-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

test: linking test/compression.c fails

Building U-Boot with unit tests on a non-sandbox systems fails:

ld.bfd: test/built-in.o: in function `compress_using_gzip':
test/compression.c:138: undefined reference to `gzip'
ld.bfd: test/built-in.o: in function `uncompress_using_bzip2':
test/compression.c:187: undefined reference to `BZ2_bzBuffToBuffDecompress'
ld.bfd: test/built-in.o: in function `uncompress_using_lzma':
test/compression.c:222: undefined reference to `lzmaBuffToBuffDecompress'
ld.bfd: test/built-in.o: in function `uncompress_using_lzo':
test/compression.c:257: undefined reference to `lzop_decompress'
ld.bfd: test/built-in.o: in function `uncompress_using_lz4':
test/compression.c:292: undefined reference to `ulz4fn

Add the missing dependencies.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c961b1b5 31-Oct-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

test: test/bloblist.c depends on asm/state.h

Building test/bloblist.c fails for non sandbox devices:

test/bloblist.c:10:10: fatal error: asm/state.h: No such file or directory
#include <asm/state.h>
^~~~~~~~~~~~~

Build the test only on the sandbox.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 627988f9 03-Oct-2020 Simon Glass <sjg@chromium.org>

dm: test: Disable some tests that should not run in SPL

Tests are easier to run in U-Boot proper. Running them in SPL does not add
test coverage in most cases. Also some tests use features that are not
available in SPL.

Update the build rules to disable these tests in SPL. We still need
test-main to be able to actually run SPL tests.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 16a50683 03-Oct-2020 Simon Glass <sjg@chromium.org>

dm: test: Make use of CONFIG_UNIT_TEST

At present we always include test/dm from the main Makefile. We have a
CONFIG_UNIT_TEST that should control whether the test/ directory is built,
so rely on that instead.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 82c468a0 03-Oct-2020 Simon Glass <sjg@chromium.org>

dm: test: Update Makefile conditions

At present most of the tests in test/Makefile are dependent on
CONFIG_SANDBOX. But this is not ideal since they rely on commands being
available and SPL does not support commands.

Use CONFIG_COMMAND instead. This has the dual purpose of allowing these
tests to be used on other boards and allowing SPL to skip them.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 1cadc761 03-Oct-2020 Simon Glass <sjg@chromium.org>

dm: test: Sort the Makefile

Move everything into alphabetical order.

Signed-off-by: Simon Glass <sjg@chromium.org>

# bdded201 02-Jun-2020 Simon Glass <sjg@chromium.org>

cmd: Add a memory-search command

It is useful to be able to find hex values and strings in a memory range.
Add a command to support this.

cmd: Fix 'md' and add a memory-search command
At present 'md.q' is broken. This series provides a fix for this. It also
implements a new memory-search command called 'ms'. It allows searching
memory for hex and string data.
END

Signed-off-by: Simon Glass <sjg@chromium.org>

# 4f04d549 08-Apr-2020 Simon Glass <sjg@chromium.org>

test: Add the beginnings of some string tests

There are quite a few string functions in U-Boot with no tests. Make a
start by adding a test for strtoul().

Signed-off-by: Simon Glass <sjg@chromium.org>

# 395041b2 26-Feb-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

test: log functions with CONFIG_LOG=n

If CONFIG_LOG=n, we still expect output for log_err(), log_warning(),
log_notice(), log_info() and in case of DEBUG=1 also for log_debug().

Provide unit tests verifying this.

The tests depend on:

CONFIG_CONSOLE_RECORD=y
CONFIG_LOG=n
CONFIG_UT_LOG=y

It may be necessary to increase the value of CONFIG_SYS_MALLOC_F_LEN to
accommodate CONFIG_CONSOLE_RECORD=y.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 919e7a8f 15-Nov-2018 Simon Glass <sjg@chromium.org>

test: Add a simple test for bloblist

Add a unit test for the bloblist functionality and enable bloblist for
sandbox.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 87be2fe6 27-Sep-2018 Mario Six <mario.six@gdsys.cc>

test: list: Add tests for hexdump.c

Add tests for the hex2bin, bin2hex, and hex_to_bin functions, which were
recently added to U-Boot.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f11a164b 31-Aug-2018 Heinrich Schuchardt <xypron.glpk@gmx.de>

test: unit tests for Unicode functions

Provide unit tests for Unicode functions.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

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>

# ef11ed82 04-Dec-2017 Simon Glass <sjg@chromium.org>

log: Add a test command

Add a command which exercises the logging system.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e5a9d27f 15-Jun-2017 Simon Glass <sjg@chromium.org>

test: Add a test for snprintf() and the banner/version

Add a simple test to make sure that these functions obey the buffer size
passed into them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Stephen Warren <swarren@nvidia.com>

# c812f722 20-May-2015 Joe Hershberger <joe.hershberger@ni.com>

test: dm: Move the time test over to the ut command

Unify the command for running unit tests further by moving the "ut_time"
command over to "ut time".

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# c617ede0 20-May-2015 Joe Hershberger <joe.hershberger@ni.com>

test: Add a common unit test command

Add a command that all other unit tests should be a sub-command of.
Also include a command that will run all tests.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Acked-by: Simon Glass <sjg@chromium.org>

# e721b882 20-May-2015 Joe Hershberger <joe.hershberger@ni.com>

test: Generalize the unit test framework

Separate the ability to define tests and assert status of test functions
from the dm tests so they can be used more consistently throughout all
tests.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8271f5d4 02-May-2015 Simon Glass <sjg@chromium.org>

test: Add a simple time test

Sometimes the time functions are incorrect due to bad time support on a
board. Add a unit test which tries to detect this.

Signed-off-by: Simon Glass <sjg@chromium.org>

# bcfe8fdf 20-Oct-2013 Masahiro Yamada <yamada.m@jp.panasonic.com>

dts, api, test: convert makefiles to Kbuild style

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# 3153e915 16-Aug-2013 Kees Cook <keescook@chromium.org>

sandbox: add compression tests

This adds the "test_compression" command when building the sandbox. This
tests the existing compression and decompression routines for simple
sanity and for buffer overflow conditions.

Signed-off-by: Kees Cook <keescook@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 1a459660 08-Jul-2013 Wolfgang Denk <wd@denx.de>

Add GPL-2.0+ SPDX-License-Identifier to source files

Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini <trini@ti.com>

# a72007d9 30-Mar-2012 Simon Glass <sjg@chromium.org>

sandbox: Add basic test for command execution

Since run_command() and run_command_list() are important and a little
confusing, add some basic tests to check that the behaviour is correct.

Note: I am not sure that this should be committed, nor where it should go
in the source tree. Comments welcome.

To run the unit tests use the ut_cmd command available in sandbox:

make sandbox_config
make
./u-boot -c ut_cmd

(To test both hush and built-in parsers, you need to manually change
CONFIG_SYS_HUSH_PARSER in include/configs/sandbox.h and build/run again)

Signed-off-by: Simon Glass <sjg@chromium.org>

# bdded201 02-Jun-2020 Simon Glass <sjg@chromium.org>

cmd: Add a memory-search command

It is useful to be able to find hex values and strings in a memory range.
Add a command to support this.

cmd: Fix 'md' and add a memory-search command
At present 'md.q' is broken. This series provides a fix for this. It also
implements a new memory-search command called 'ms'. It allows searching
memory for hex and string data.
END

Signed-off-by: Simon Glass <sjg@chromium.org>

# 4f04d549 08-Apr-2020 Simon Glass <sjg@chromium.org>

test: Add the beginnings of some string tests

There are quite a few string functions in U-Boot with no tests. Make a
start by adding a test for strtoul().

Signed-off-by: Simon Glass <sjg@chromium.org>

# 395041b2 26-Feb-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

test: log functions with CONFIG_LOG=n

If CONFIG_LOG=n, we still expect output for log_err(), log_warning(),
log_notice(), log_info() and in case of DEBUG=1 also for log_debug().

Provide unit tests verifying this.

The tests depend on:

CONFIG_CONSOLE_RECORD=y
CONFIG_LOG=n
CONFIG_UT_LOG=y

It may be necessary to increase the value of CONFIG_SYS_MALLOC_F_LEN to
accommodate CONFIG_CONSOLE_RECORD=y.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 919e7a8f 15-Nov-2018 Simon Glass <sjg@chromium.org>

test: Add a simple test for bloblist

Add a unit test for the bloblist functionality and enable bloblist for
sandbox.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 87be2fe6 27-Sep-2018 Mario Six <mario.six@gdsys.cc>

test: list: Add tests for hexdump.c

Add tests for the hex2bin, bin2hex, and hex_to_bin functions, which were
recently added to U-Boot.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f11a164b 31-Aug-2018 Heinrich Schuchardt <xypron.glpk@gmx.de>

test: unit tests for Unicode functions

Provide unit tests for Unicode functions.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

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>

# ef11ed82 04-Dec-2017 Simon Glass <sjg@chromium.org>

log: Add a test command

Add a command which exercises the logging system.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e5a9d27f 15-Jun-2017 Simon Glass <sjg@chromium.org>

test: Add a test for snprintf() and the banner/version

Add a simple test to make sure that these functions obey the buffer size
passed into them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Stephen Warren <swarren@nvidia.com>

# c812f722 20-May-2015 Joe Hershberger <joe.hershberger@ni.com>

test: dm: Move the time test over to the ut command

Unify the command for running unit tests further by moving the "ut_time"
command over to "ut time".

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# c617ede0 20-May-2015 Joe Hershberger <joe.hershberger@ni.com>

test: Add a common unit test command

Add a command that all other unit tests should be a sub-command of.
Also include a command that will run all tests.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Acked-by: Simon Glass <sjg@chromium.org>

# e721b882 20-May-2015 Joe Hershberger <joe.hershberger@ni.com>

test: Generalize the unit test framework

Separate the ability to define tests and assert status of test functions
from the dm tests so they can be used more consistently throughout all
tests.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8271f5d4 02-May-2015 Simon Glass <sjg@chromium.org>

test: Add a simple time test

Sometimes the time functions are incorrect due to bad time support on a
board. Add a unit test which tries to detect this.

Signed-off-by: Simon Glass <sjg@chromium.org>

# bcfe8fdf 20-Oct-2013 Masahiro Yamada <yamada.m@jp.panasonic.com>

dts, api, test: convert makefiles to Kbuild style

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# 3153e915 16-Aug-2013 Kees Cook <keescook@chromium.org>

sandbox: add compression tests

This adds the "test_compression" command when building the sandbox. This
tests the existing compression and decompression routines for simple
sanity and for buffer overflow conditions.

Signed-off-by: Kees Cook <keescook@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 1a459660 08-Jul-2013 Wolfgang Denk <wd@denx.de>

Add GPL-2.0+ SPDX-License-Identifier to source files

Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini <trini@ti.com>

# a72007d9 30-Mar-2012 Simon Glass <sjg@chromium.org>

sandbox: Add basic test for command execution

Since run_command() and run_command_list() are important and a little
confusing, add some basic tests to check that the behaviour is correct.

Note: I am not sure that this should be committed, nor where it should go
in the source tree. Comments welcome.

To run the unit tests use the ut_cmd command available in sandbox:

make sandbox_config
make
./u-boot -c ut_cmd

(To test both hush and built-in parsers, you need to manually change
CONFIG_SYS_HUSH_PARSER in include/configs/sandbox.h and build/run again)

Signed-off-by: Simon Glass <sjg@chromium.org>

# 4f04d549 08-Apr-2020 Simon Glass <sjg@chromium.org>

test: Add the beginnings of some string tests

There are quite a few string functions in U-Boot with no tests. Make a
start by adding a test for strtoul().

Signed-off-by: Simon Glass <sjg@chromium.org>

# 395041b2 26-Feb-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

test: log functions with CONFIG_LOG=n

If CONFIG_LOG=n, we still expect output for log_err(), log_warning(),
log_notice(), log_info() and in case of DEBUG=1 also for log_debug().

Provide unit tests verifying this.

The tests depend on:

CONFIG_CONSOLE_RECORD=y
CONFIG_LOG=n
CONFIG_UT_LOG=y

It may be necessary to increase the value of CONFIG_SYS_MALLOC_F_LEN to
accommodate CONFIG_CONSOLE_RECORD=y.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 919e7a8f 15-Nov-2018 Simon Glass <sjg@chromium.org>

test: Add a simple test for bloblist

Add a unit test for the bloblist functionality and enable bloblist for
sandbox.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 87be2fe6 27-Sep-2018 Mario Six <mario.six@gdsys.cc>

test: list: Add tests for hexdump.c

Add tests for the hex2bin, bin2hex, and hex_to_bin functions, which were
recently added to U-Boot.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f11a164b 31-Aug-2018 Heinrich Schuchardt <xypron.glpk@gmx.de>

test: unit tests for Unicode functions

Provide unit tests for Unicode functions.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

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>

# ef11ed82 04-Dec-2017 Simon Glass <sjg@chromium.org>

log: Add a test command

Add a command which exercises the logging system.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e5a9d27f 15-Jun-2017 Simon Glass <sjg@chromium.org>

test: Add a test for snprintf() and the banner/version

Add a simple test to make sure that these functions obey the buffer size
passed into them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Stephen Warren <swarren@nvidia.com>

# c812f722 20-May-2015 Joe Hershberger <joe.hershberger@ni.com>

test: dm: Move the time test over to the ut command

Unify the command for running unit tests further by moving the "ut_time"
command over to "ut time".

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# c617ede0 20-May-2015 Joe Hershberger <joe.hershberger@ni.com>

test: Add a common unit test command

Add a command that all other unit tests should be a sub-command of.
Also include a command that will run all tests.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Acked-by: Simon Glass <sjg@chromium.org>

# e721b882 20-May-2015 Joe Hershberger <joe.hershberger@ni.com>

test: Generalize the unit test framework

Separate the ability to define tests and assert status of test functions
from the dm tests so they can be used more consistently throughout all
tests.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8271f5d4 02-May-2015 Simon Glass <sjg@chromium.org>

test: Add a simple time test

Sometimes the time functions are incorrect due to bad time support on a
board. Add a unit test which tries to detect this.

Signed-off-by: Simon Glass <sjg@chromium.org>

# bcfe8fdf 20-Oct-2013 Masahiro Yamada <yamada.m@jp.panasonic.com>

dts, api, test: convert makefiles to Kbuild style

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# 3153e915 16-Aug-2013 Kees Cook <keescook@chromium.org>

sandbox: add compression tests

This adds the "test_compression" command when building the sandbox. This
tests the existing compression and decompression routines for simple
sanity and for buffer overflow conditions.

Signed-off-by: Kees Cook <keescook@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 1a459660 08-Jul-2013 Wolfgang Denk <wd@denx.de>

Add GPL-2.0+ SPDX-License-Identifier to source files

Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini <trini@ti.com>

# a72007d9 30-Mar-2012 Simon Glass <sjg@chromium.org>

sandbox: Add basic test for command execution

Since run_command() and run_command_list() are important and a little
confusing, add some basic tests to check that the behaviour is correct.

Note: I am not sure that this should be committed, nor where it should go
in the source tree. Comments welcome.

To run the unit tests use the ut_cmd command available in sandbox:

make sandbox_config
make
./u-boot -c ut_cmd

(To test both hush and built-in parsers, you need to manually change
CONFIG_SYS_HUSH_PARSER in include/configs/sandbox.h and build/run again)

Signed-off-by: Simon Glass <sjg@chromium.org>

# 395041b2 26-Feb-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

test: log functions with CONFIG_LOG=n

If CONFIG_LOG=n, we still expect output for log_err(), log_warning(),
log_notice(), log_info() and in case of DEBUG=1 also for log_debug().

Provide unit tests verifying this.

The tests depend on:

CONFIG_CONSOLE_RECORD=y
CONFIG_LOG=n
CONFIG_UT_LOG=y

It may be necessary to increase the value of CONFIG_SYS_MALLOC_F_LEN to
accommodate CONFIG_CONSOLE_RECORD=y.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 919e7a8f 15-Nov-2018 Simon Glass <sjg@chromium.org>

test: Add a simple test for bloblist

Add a unit test for the bloblist functionality and enable bloblist for
sandbox.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 87be2fe6 27-Sep-2018 Mario Six <mario.six@gdsys.cc>

test: list: Add tests for hexdump.c

Add tests for the hex2bin, bin2hex, and hex_to_bin functions, which were
recently added to U-Boot.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f11a164b 31-Aug-2018 Heinrich Schuchardt <xypron.glpk@gmx.de>

test: unit tests for Unicode functions

Provide unit tests for Unicode functions.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

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>

# ef11ed82 04-Dec-2017 Simon Glass <sjg@chromium.org>

log: Add a test command

Add a command which exercises the logging system.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e5a9d27f 15-Jun-2017 Simon Glass <sjg@chromium.org>

test: Add a test for snprintf() and the banner/version

Add a simple test to make sure that these functions obey the buffer size
passed into them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Stephen Warren <swarren@nvidia.com>

# c812f722 20-May-2015 Joe Hershberger <joe.hershberger@ni.com>

test: dm: Move the time test over to the ut command

Unify the command for running unit tests further by moving the "ut_time"
command over to "ut time".

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# c617ede0 20-May-2015 Joe Hershberger <joe.hershberger@ni.com>

test: Add a common unit test command

Add a command that all other unit tests should be a sub-command of.
Also include a command that will run all tests.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Acked-by: Simon Glass <sjg@chromium.org>

# e721b882 20-May-2015 Joe Hershberger <joe.hershberger@ni.com>

test: Generalize the unit test framework

Separate the ability to define tests and assert status of test functions
from the dm tests so they can be used more consistently throughout all
tests.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8271f5d4 02-May-2015 Simon Glass <sjg@chromium.org>

test: Add a simple time test

Sometimes the time functions are incorrect due to bad time support on a
board. Add a unit test which tries to detect this.

Signed-off-by: Simon Glass <sjg@chromium.org>

# bcfe8fdf 20-Oct-2013 Masahiro Yamada <yamada.m@jp.panasonic.com>

dts, api, test: convert makefiles to Kbuild style

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# 3153e915 16-Aug-2013 Kees Cook <keescook@chromium.org>

sandbox: add compression tests

This adds the "test_compression" command when building the sandbox. This
tests the existing compression and decompression routines for simple
sanity and for buffer overflow conditions.

Signed-off-by: Kees Cook <keescook@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 1a459660 08-Jul-2013 Wolfgang Denk <wd@denx.de>

Add GPL-2.0+ SPDX-License-Identifier to source files

Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini <trini@ti.com>

# a72007d9 30-Mar-2012 Simon Glass <sjg@chromium.org>

sandbox: Add basic test for command execution

Since run_command() and run_command_list() are important and a little
confusing, add some basic tests to check that the behaviour is correct.

Note: I am not sure that this should be committed, nor where it should go
in the source tree. Comments welcome.

To run the unit tests use the ut_cmd command available in sandbox:

make sandbox_config
make
./u-boot -c ut_cmd

(To test both hush and built-in parsers, you need to manually change
CONFIG_SYS_HUSH_PARSER in include/configs/sandbox.h and build/run again)

Signed-off-by: Simon Glass <sjg@chromium.org>

# 919e7a8f 15-Nov-2018 Simon Glass <sjg@chromium.org>

test: Add a simple test for bloblist

Add a unit test for the bloblist functionality and enable bloblist for
sandbox.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 87be2fe6 27-Sep-2018 Mario Six <mario.six@gdsys.cc>

test: list: Add tests for hexdump.c

Add tests for the hex2bin, bin2hex, and hex_to_bin functions, which were
recently added to U-Boot.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f11a164b 31-Aug-2018 Heinrich Schuchardt <xypron.glpk@gmx.de>

test: unit tests for Unicode functions

Provide unit tests for Unicode functions.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

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>

# ef11ed82 04-Dec-2017 Simon Glass <sjg@chromium.org>

log: Add a test command

Add a command which exercises the logging system.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e5a9d27f 15-Jun-2017 Simon Glass <sjg@chromium.org>

test: Add a test for snprintf() and the banner/version

Add a simple test to make sure that these functions obey the buffer size
passed into them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Stephen Warren <swarren@nvidia.com>

# c812f722 20-May-2015 Joe Hershberger <joe.hershberger@ni.com>

test: dm: Move the time test over to the ut command

Unify the command for running unit tests further by moving the "ut_time"
command over to "ut time".

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# c617ede0 20-May-2015 Joe Hershberger <joe.hershberger@ni.com>

test: Add a common unit test command

Add a command that all other unit tests should be a sub-command of.
Also include a command that will run all tests.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Acked-by: Simon Glass <sjg@chromium.org>

# e721b882 20-May-2015 Joe Hershberger <joe.hershberger@ni.com>

test: Generalize the unit test framework

Separate the ability to define tests and assert status of test functions
from the dm tests so they can be used more consistently throughout all
tests.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8271f5d4 02-May-2015 Simon Glass <sjg@chromium.org>

test: Add a simple time test

Sometimes the time functions are incorrect due to bad time support on a
board. Add a unit test which tries to detect this.

Signed-off-by: Simon Glass <sjg@chromium.org>

# bcfe8fdf 20-Oct-2013 Masahiro Yamada <yamada.m@jp.panasonic.com>

dts, api, test: convert makefiles to Kbuild style

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# 3153e915 16-Aug-2013 Kees Cook <keescook@chromium.org>

sandbox: add compression tests

This adds the "test_compression" command when building the sandbox. This
tests the existing compression and decompression routines for simple
sanity and for buffer overflow conditions.

Signed-off-by: Kees Cook <keescook@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 1a459660 08-Jul-2013 Wolfgang Denk <wd@denx.de>

Add GPL-2.0+ SPDX-License-Identifier to source files

Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini <trini@ti.com>

# a72007d9 30-Mar-2012 Simon Glass <sjg@chromium.org>

sandbox: Add basic test for command execution

Since run_command() and run_command_list() are important and a little
confusing, add some basic tests to check that the behaviour is correct.

Note: I am not sure that this should be committed, nor where it should go
in the source tree. Comments welcome.

To run the unit tests use the ut_cmd command available in sandbox:

make sandbox_config
make
./u-boot -c ut_cmd

(To test both hush and built-in parsers, you need to manually change
CONFIG_SYS_HUSH_PARSER in include/configs/sandbox.h and build/run again)

Signed-off-by: Simon Glass <sjg@chromium.org>

# 87be2fe6 27-Sep-2018 Mario Six <mario.six@gdsys.cc>

test: list: Add tests for hexdump.c

Add tests for the hex2bin, bin2hex, and hex_to_bin functions, which were
recently added to U-Boot.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>


# f11a164b 31-Aug-2018 Heinrich Schuchardt <xypron.glpk@gmx.de>

test: unit tests for Unicode functions

Provide unit tests for Unicode functions.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>


# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

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>


# ef11ed82 04-Dec-2017 Simon Glass <sjg@chromium.org>

log: Add a test command

Add a command which exercises the logging system.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e5a9d27f 15-Jun-2017 Simon Glass <sjg@chromium.org>

test: Add a test for snprintf() and the banner/version

Add a simple test to make sure that these functions obey the buffer size
passed into them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Stephen Warren <swarren@nvidia.com>


# c812f722 20-May-2015 Joe Hershberger <joe.hershberger@ni.com>

test: dm: Move the time test over to the ut command

Unify the command for running unit tests further by moving the "ut_time"
command over to "ut time".

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>


# c617ede0 20-May-2015 Joe Hershberger <joe.hershberger@ni.com>

test: Add a common unit test command

Add a command that all other unit tests should be a sub-command of.
Also include a command that will run all tests.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Acked-by: Simon Glass <sjg@chromium.org>


# e721b882 20-May-2015 Joe Hershberger <joe.hershberger@ni.com>

test: Generalize the unit test framework

Separate the ability to define tests and assert status of test functions
from the dm tests so they can be used more consistently throughout all
tests.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>


# 8271f5d4 02-May-2015 Simon Glass <sjg@chromium.org>

test: Add a simple time test

Sometimes the time functions are incorrect due to bad time support on a
board. Add a unit test which tries to detect this.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bcfe8fdf 20-Oct-2013 Masahiro Yamada <yamada.m@jp.panasonic.com>

dts, api, test: convert makefiles to Kbuild style

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>


# 3153e915 16-Aug-2013 Kees Cook <keescook@chromium.org>

sandbox: add compression tests

This adds the "test_compression" command when building the sandbox. This
tests the existing compression and decompression routines for simple
sanity and for buffer overflow conditions.

Signed-off-by: Kees Cook <keescook@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>


# 1a459660 08-Jul-2013 Wolfgang Denk <wd@denx.de>

Add GPL-2.0+ SPDX-License-Identifier to source files

Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini <trini@ti.com>


# a72007d9 30-Mar-2012 Simon Glass <sjg@chromium.org>

sandbox: Add basic test for command execution

Since run_command() and run_command_list() are important and a little
confusing, add some basic tests to check that the behaviour is correct.

Note: I am not sure that this should be committed, nor where it should go
in the source tree. Comments welcome.

To run the unit tests use the ut_cmd command available in sandbox:

make sandbox_config
make
./u-boot -c ut_cmd

(To test both hush and built-in parsers, you need to manually change
CONFIG_SYS_HUSH_PARSER in include/configs/sandbox.h and build/run again)

Signed-off-by: Simon Glass <sjg@chromium.org>