1 // SPDX-License-Identifier: GPL-2.0+
12 #include <test/test.h>
15 #include "../../drivers/sysinfo/sandbox.h"
17 static int dm_test_sysinfo(struct unit_test_state *uts)
19 struct udevice *sysinfo;
20 bool called_detect = false;
24 ut_assertok(sysinfo_get(&sysinfo));
27 ut_asserteq(-EPERM, sysinfo_get_bool(sysinfo, BOOL_CALLED_DETECT,
29 ut_assert(!called_detect);
31 sysinfo_detect(sysinfo);
33 ut_assertok(sysinfo_get_bool(sysinfo, BOOL_CALLED_DETECT,
35 ut_assert(called_detect);
37 ut_assertok(sysinfo_get_str(sysinfo, STR_VACATIONSPOT, sizeof(str),
39 ut_assertok(strcmp(str, "R'lyeh"));
41 ut_assertok(sysinfo_get_int(sysinfo, INT_TEST1, &i));
44 ut_assertok(sysinfo_get_int(sysinfo, INT_TEST2, &i));
47 ut_assertok(sysinfo_get_str(sysinfo, STR_VACATIONSPOT, sizeof(str),
49 ut_assertok(strcmp(str, "Carcosa"));
51 ut_assertok(sysinfo_get_int(sysinfo, INT_TEST1, &i));
54 ut_assertok(sysinfo_get_int(sysinfo, INT_TEST2, &i));
57 ut_assertok(sysinfo_get_str(sysinfo, STR_VACATIONSPOT, sizeof(str),
59 ut_assertok(strcmp(str, "Yuggoth"));
64 DM_TEST(dm_test_sysinfo, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT);