u-boot/test/dm/simple-bus.c
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

32 lines
873 B
C

// SPDX-License-Identifier: GPL-2.0+
/*
* Copyright (C) 2021, Bin Meng <bmeng.cn@gmail.com>
*/
#include <dm.h>
#include <dm/test.h>
#include <dm/simple_bus.h>
#include <dm/uclass-internal.h>
#include <test/ut.h>
static int dm_test_simple_bus(struct unit_test_state *uts)
{
struct udevice *dev;
struct simple_bus_plat *plat;
/* locate the dummy device @ translation-test node */
ut_assertok(uclass_find_device_by_seq(UCLASS_TEST_DUMMY, 0, &dev));
ut_asserteq_str("dev@0,0", dev->name);
/* locate the parent node which is a simple-bus */
ut_assertnonnull(dev = dev_get_parent(dev));
ut_asserteq_str("translation-test@8000", dev->name);
ut_assertnonnull(plat = dev_get_uclass_plat(dev));
ut_asserteq(0, plat->base);
ut_asserteq(0x8000, plat->target);
ut_asserteq(0x1000, plat->size);
return 0;
}
DM_TEST(dm_test_simple_bus, UTF_SCAN_FDT | UTF_FLAT_TREE);