Commit graph

19 commits

Author SHA1 Message Date
Simon Glass
32aba887e3 test: Drop suites.h
This file is empty now. Remove it and its uses.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-02-11 20:12:36 -06:00
Simon Glass
1ade3afa2d test: Drop the function for running mbr tests
Use the new suite-runner to run these tests instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-01-24 14:34:40 -06:00
Simon Glass
4ba3ab4901 test: Drop the _test suffix on linker lists
Most test suites have a _test suffix. This is not necessary as there is
also a ut_ prefix.

Drop the suffix so that (with future work) the suite name can be used as
the linker-list name.

Remove the suffix from the pytest regex as well, moving it to the top of
the file, as it is a constant.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-01-24 14:34:40 -06:00
Heinrich Schuchardt
5430a5f67e test: use %zd for size_t in mbr_test_run()
For printing size_t we must use %zd and not %ld to avoid
a -Wformat error on 32-bit systems.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2024-11-14 18:14:06 -06:00
Heinrich Schuchardt
d8c5bcbd22 test: cmd/mbr: pass correct buffer size to init_write_buffers
We want to completely initialize the mbr and embr buffers. This requires
passing the buffer size and not the size of a pointer to the buffer.

Addresses-Coverity-ID: 510454 Wrong sizeof argument
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2024-11-14 18:14:06 -06:00
Simon Glass
017b441b2e test: mbr: Drop a duplicate test
The test currently runs twice as it is declared twice. Unwind this.

Signed-off-by: Simon Glass <sjg@chromium.org>
2024-09-18 13:01:00 -06:00
Simon Glass
6cfc777b96 test: mbr: Use RAM for the buffers
The normal approach with sandbox is to use a fixed memory address in the
RAM, to avoid needing to create a map for transient local variables.

Update this test to use this approach.

Signed-off-by: Simon Glass <sjg@chromium.org>
2024-09-18 13:01:00 -06:00
Simon Glass
e9d899591c test: mbr: Use a constant for the block size
It isn't that important to factor out constants in tests, but in this
case we have 0x200 and 512 used. The commands don't use the constant
as they use a block count ('1'). It doesn't create more code to use a
constant, so create one.

Signed-off-by: Simon Glass <sjg@chromium.org>
2024-09-18 13:01:00 -06:00
Simon Glass
705cc13ce7 test: mbr: Unmap the buffers after use
This tests maps some local variables into sandbox's address space. Make
sure to unmap them afterwards.

Note that the normal approach with sandbox is to use a fixed memory
address in the RAM, to avoid needing to create a map for transient local
variables.

Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: 04291ee0ab ("cmd: mbr: Allow 4 MBR partitions without need...")
2024-09-18 13:01:00 -06:00
Simon Glass
e7474ac689 test: mbr: Adjust test to drop 0x
U-Boot commands typically don't need 0x to specify hex, since they use
hex by default. Adding 0x in this test is confusing since it suggests
that it is necessary. Drop it from the file.

Also use the %#x construct to get the 0x when needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
2024-09-18 13:01:00 -06:00
Simon Glass
1c9b37ec03 test: mbr: Adjust test to use lower-case hex
Switch to lower-case hex which is more commonly used in U-Boot.

Signed-off-by: Simon Glass <sjg@chromium.org>
2024-09-18 13:01:00 -06:00
Simon Glass
e6f498e70b test: Tidy up checking for console end
Use the ut_assert_console_end() function provided, rather than doing it
separately.

Signed-off-by: Simon Glass <sjg@chromium.org>
2024-08-26 18:51:49 -06:00
Simon Glass
0af38d12d9 test: cmd: Drop unnecessary console_record_reset_enable()
It is seldom necessary to call this function. Drop its use in the
command tests.

Add a few extra checks to the wget test so that resetting is not
needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
2024-08-26 18:51:49 -06:00
Simon Glass
9b99762eff test: Rename UTF_CONSOLE_REC to UTF_CONSOLE
The _REC suffix doesn't add much. Really what we want to know is whether
the test uses the console, so rename this flag.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
2024-08-26 18:51:49 -06:00
Simon Glass
b073d48e8d test: Drop the blank line before test macros
Most tests don't have this. It helps to keep the test declaration
clearly associated with the function it relates to, rather than the next
one in the file. Remove the extra blank line and mention this in the
docs.

Signed-off-by: Simon Glass <sjg@chromium.org>
2024-08-26 18:51:49 -06:00
Simon Glass
725c438c62 test: Rename unit-test flags
The UT_TESTF_ macros read as 'unit test test flags' which is not right.
Rename to UTF ('unit test flags').

This has the benefit of being shorter, which helps keep UNIT_TEST()
declarations on a single line.

Give the enum a name and reference it from the UNIT_TEST() macros while
we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
2024-08-26 18:51:48 -06:00
Alexander Gendin
8904e933a3 test: cmd: mbr: Fix Smatch static checker warning
This patch fixes Smatch static checker warning:
        test/cmd/mbr.c:243 mbr_test_run()
        warn: sizeof(NUMBER)?

Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: Alexander Gendin <agendin@matrox.com>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2024-03-02 12:25:20 -05:00
Alexander Gendin
a40f35f069 test: cmd: mbr: Remove unreachable code
Fix an issue reported by Coverity scan, and fix code indentation.

Addresses-Coverity-ID: 467404 ("Control flow issues (DEADCODE)")
Signed-off-by: Alexander Gendin <agendin@matrox.com>
2023-11-10 11:01:10 -05:00
Alexander Gendin
04291ee0ab cmd: mbr: Allow 4 MBR partitions without need for extended
Current code allows up to 3 MBR partitions without extended one.
If more than 3 partitions are required, then extended partition(s)
must be used.
This commit allows up to 4 primary MBR partitions without the
need for extended partition.

Add mbr test unit. In order to run the test manually, mmc6.img file
of size 12 MiB or greater is required in the same directory as u-boot.
Test also runs automatically via ./test/py/test.py tool.
Running mbr test is only supported in sandbox mode.

Signed-off-by: Alex Gendin <agendin@matrox.com>
[ And due to some further changes for testing ]
Signed-off-by: Simon Glass <sjg@chromium.org>
2023-10-24 17:05:24 -04:00