summaryrefslogtreecommitdiff
path: root/test/boot/bootflow.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/boot/bootflow.c')
-rw-r--r--test/boot/bootflow.c57
1 files changed, 57 insertions, 0 deletions
diff --git a/test/boot/bootflow.c b/test/boot/bootflow.c
index a56435d053f..56ee1952357 100644
--- a/test/boot/bootflow.c
+++ b/test/boot/bootflow.c
@@ -31,6 +31,7 @@ DECLARE_GLOBAL_DATA_PTR;
extern U_BOOT_DRIVER(bootmeth_android);
extern U_BOOT_DRIVER(bootmeth_cros);
+extern U_BOOT_DRIVER(bootmeth_rauc);
extern U_BOOT_DRIVER(bootmeth_2script);
/* Use this as the vendor for EFI to tell the app to exit boot services */
@@ -1392,6 +1393,62 @@ static int bootflow_efi(struct unit_test_state *uts)
}
BOOTSTD_TEST(bootflow_efi, UTF_CONSOLE);
+/* Test RAUC bootmeth */
+static int bootflow_rauc(struct unit_test_state *uts)
+{
+ const char *mmc_dev = "mmc10";
+ struct bootstd_priv *std;
+ struct udevice *bootstd;
+ static const char *order[] = {NULL, NULL};
+ const char **old_order;
+ ofnode root;
+ ofnode node;
+
+ order[0] = mmc_dev;
+
+ if (!CONFIG_IS_ENABLED(BOOTMETH_RAUC))
+ return -EAGAIN;
+
+ /* Enable the requested mmc node since we need a different bootflow */
+ root = oftree_root(oftree_default());
+ node = ofnode_find_subnode(root, mmc_dev);
+ ut_assert(ofnode_valid(node));
+ ut_assertok(lists_bind_fdt(gd->dm_root, node, NULL, NULL, false));
+
+ /* Enable the rauc bootmeth */
+ ut_assertok(uclass_first_device_err(UCLASS_BOOTSTD, &bootstd));
+ ut_assertok(device_bind(bootstd, DM_DRIVER_REF(bootmeth_rauc),
+ "rauc", 0, ofnode_null(), NULL));
+
+ /* Change the device and bootmeth order */
+ std = dev_get_priv(bootstd);
+ old_order = std->bootdev_order;
+ std->bootdev_order = order;
+
+ ut_assertok(bootmeth_set_order("rauc"));
+
+ /* Run scan and list */
+ ut_assertok(run_command("bootflow scan", 0));
+ ut_assert_console_end();
+
+ ut_assertok(run_command("bootflow list", 0));
+
+ ut_assert_nextlinen("Showing all");
+ ut_assert_nextlinen("Seq");
+ ut_assert_nextlinen("---");
+ ut_assert_nextlinen(" 0 rauc ready mmc 0 mmc10.bootdev.whole ");
+ ut_assert_nextlinen("---");
+ ut_assert_skip_to_line("(1 bootflow, 1 valid)");
+
+ ut_assert_console_end();
+
+ /* Restore the order used by the device tree */
+ std->bootdev_order = old_order;
+
+ return 0;
+}
+BOOTSTD_TEST(bootflow_rauc, UTF_CONSOLE | UTF_DM | UTF_SCAN_FDT);
+
/* Check 'bootflow scan' provides a list of images */
static int bootstd_images(struct unit_test_state *uts)
{