[PATCH 23/32] test: cmd: fdt: Test fdt set
Marek Vasut
marek.vasut at mailbox.org
Thu Mar 2 04:07:22 CET 2023
On 3/1/23 16:02, Simon Glass wrote:
> Hi Marek,
>
> On Mon, 27 Feb 2023 at 12:55, Marek Vasut
> <marek.vasut+renesas at mailbox.org> wrote:
>>
>> Add 'fdt set' test which works as follows:
>> - Create fuller FDT, map it to sysmem
>> - Set either existing property to overwrite it, or new property
>> - Test setting both single properties as well as string and integer arrays
>> - Test setting to non-existent nodes and aliases
>> - Verify set values using 'fdt get value'
>>
>> The test case can be triggered using:
>> "
>> ./u-boot -Dc 'ut fdt'
>> "
>> To dump the full output from commands used during test, add '-v' flag.
>>
>> Signed-off-by: Marek Vasut <marek.vasut+renesas at mailbox.org>
>> ---
>> Cc: Heinrich Schuchardt <heinrich.schuchardt at canonical.com>
>> Cc: Simon Glass <sjg at chromium.org>
>> Cc: Tom Rini <trini at konsulko.com>
>> ---
>> test/cmd/fdt.c | 123 +++++++++++++++++++++++++++++++++++++++++++++++++
>> 1 file changed, 123 insertions(+)
>>
>> diff --git a/test/cmd/fdt.c b/test/cmd/fdt.c
>> index ae67b468b71..42d067090aa 100644
>> --- a/test/cmd/fdt.c
>> +++ b/test/cmd/fdt.c
>> @@ -777,6 +777,129 @@ static int fdt_test_get_size(struct unit_test_state *uts)
>> }
>> FDT_TEST(fdt_test_get_size, UT_TESTF_CONSOLE_REC);
>>
>> +static int fdt_test_set_single(struct unit_test_state *uts,
>> + const char *path, const char *prop,
>> + const char *sval, int ival, bool integer)
>
> Please add a comment for this function.
>
>> +{
>> + ut_assertok(console_record_reset_enable());
>> + if (sval) {
>> + ut_assertok(run_commandf("fdt set %s %s %s", path, prop, sval));
>> + } else if (integer) {
>> + ut_assertok(run_commandf("fdt set %s %s <%d>", path, prop, ival));
>> + } else {
>> + ut_assertok(run_commandf("fdt set %s %s", path, prop));
>> + }
>
> Should drop {} on single-line statements - please check patman
This one isn't as simple as "drop the {}" in fact, I sent a separate
series to address that:
https://patchwork.ozlabs.org/project/uboot/list/?series=344329
More information about the U-Boot
mailing list