summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2022-07-30 15:52:19 -0600
committerTom Rini <trini@konsulko.com>2022-08-12 08:14:24 -0400
commit988cacaeedae920c13741c9ab2fc580f63a06c3a (patch)
tree5b2d7bc4a9a821179fd89658252469405f0cc747 /test
parent10d16faa436c9f06bbcdeb6da35871a1b329b6b0 (diff)
downloadu-boot-988cacaeedae920c13741c9ab2fc580f63a06c3a.tar.gz
u-boot-988cacaeedae920c13741c9ab2fc580f63a06c3a.tar.bz2
u-boot-988cacaeedae920c13741c9ab2fc580f63a06c3a.zip
bootstd: Provide a bootmeth method to obtain state info
Some bootmeths can provide information about what is available to boot. For example, VBE simple provides access to the firmware state. Add a new method for this, along with a sandbox test. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'test')
-rw-r--r--test/boot/bootmeth.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/boot/bootmeth.c b/test/boot/bootmeth.c
index 81421f550b..5d2e87b1c9 100644
--- a/test/boot/bootmeth.c
+++ b/test/boot/bootmeth.c
@@ -7,7 +7,9 @@
*/
#include <common.h>
+#include <bootmeth.h>
#include <bootstd.h>
+#include <dm.h>
#include <test/suites.h>
#include <test/ut.h>
#include "bootstd_common.h"
@@ -120,3 +122,19 @@ static int bootmeth_env(struct unit_test_state *uts)
return 0;
}
BOOTSTD_TEST(bootmeth_env, UT_TESTF_DM | UT_TESTF_SCAN_FDT);
+
+/* Check the get_state_desc() method */
+static int bootmeth_state(struct unit_test_state *uts)
+{
+ struct udevice *dev;
+ char buf[50];
+
+ ut_assertok(uclass_first_device(UCLASS_BOOTMETH, &dev));
+ ut_assertnonnull(dev);
+
+ ut_assertok(bootmeth_get_state_desc(dev, buf, sizeof(buf)));
+ ut_asserteq_str("OK", buf);
+
+ return 0;
+}
+BOOTSTD_TEST(bootmeth_state, UT_TESTF_DM | UT_TESTF_SCAN_FDT);