u-boot/test/dm/sysinfo.c
Simon Glass 3a8ee3df83 board: Rename uclass to sysinfo
This uclass is intended to provide a way to obtain information about a
U-Boot board. But the concept of a U-Boot 'board' is the whole system,
not just one circuit board, meaning that 'board' is something of a
misnomer for this uclass.

In addition, the name 'board' is a bit overused in U-Boot and we want to
use the same uclass to provide SMBIOS information.

The obvious name is 'system' but that is so vague as to be meaningless.
Use 'sysinfo' instead, since this uclass is aimed at providing information
on the system.

Rename everything accordingly.

Note: Due to the patch delta caused by the symbol renames, this patch
shows some renamed files as being deleted in one place and created in
another.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2020-11-06 10:18:20 +08:00

60 lines
1.3 KiB
C

// SPDX-License-Identifier: GPL-2.0+
/*
* (C) Copyright 2018
* Mario Six, Guntermann & Drunck GmbH, mario.six@gdsys.cc
*/
#include <common.h>
#include <dm.h>
#include <log.h>
#include <dm/test.h>
#include <sysinfo.h>
#include <test/test.h>
#include <test/ut.h>
#include "../../drivers/sysinfo/sandbox.h"
static int dm_test_sysinfo(struct unit_test_state *uts)
{
struct udevice *sysinfo;
bool called_detect;
char str[64];
int i;
ut_assertok(sysinfo_get(&sysinfo));
ut_assert(sysinfo);
sysinfo_get_bool(sysinfo, BOOL_CALLED_DETECT, &called_detect);
ut_assert(!called_detect);
sysinfo_detect(sysinfo);
sysinfo_get_bool(sysinfo, BOOL_CALLED_DETECT, &called_detect);
ut_assert(called_detect);
sysinfo_get_str(sysinfo, STR_VACATIONSPOT, sizeof(str), str);
ut_assertok(strcmp(str, "R'lyeh"));
sysinfo_get_int(sysinfo, INT_TEST1, &i);
ut_asserteq(0, i);
sysinfo_get_int(sysinfo, INT_TEST2, &i);
ut_asserteq(100, i);
sysinfo_get_str(sysinfo, STR_VACATIONSPOT, sizeof(str), str);
ut_assertok(strcmp(str, "Carcosa"));
sysinfo_get_int(sysinfo, INT_TEST1, &i);
ut_asserteq(1, i);
sysinfo_get_int(sysinfo, INT_TEST2, &i);
ut_asserteq(99, i);
sysinfo_get_str(sysinfo, STR_VACATIONSPOT, sizeof(str), str);
ut_assertok(strcmp(str, "Yuggoth"));
return 0;
}
DM_TEST(dm_test_sysinfo, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT);