]> Git Repo - J-u-boot.git/blobdiff - test/boot/bootflow.c
Merge tag 'v2023.10-rc4' into next
[J-u-boot.git] / test / boot / bootflow.c
index 54a878c4bd5d00a8031083efaa13bdf562c17159..f5b2059140acae8f5a9d463ebf99b9c3462e3106 100644 (file)
@@ -27,7 +27,8 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-extern U_BOOT_DRIVER(bootmeth_script);
+extern U_BOOT_DRIVER(bootmeth_cros);
+extern U_BOOT_DRIVER(bootmeth_2script);
 
 static int inject_response(struct unit_test_state *uts)
 {
@@ -514,7 +515,8 @@ BOOTSTD_TEST(bootflow_cmd_boot, UT_TESTF_DM | UT_TESTF_SCAN_FDT);
  * @mmc_dev: MMC device to use, e.g. "mmc4"
  * Returns 0 on success, -ve on failure
  */
-static int prep_mmc_bootdev(struct unit_test_state *uts, const char *mmc_dev)
+static int prep_mmc_bootdev(struct unit_test_state *uts, const char *mmc_dev,
+                           bool bind_cros)
 {
        const char *order[] = {"mmc2", "mmc1", mmc_dev, NULL};
        struct udevice *dev, *bootstd;
@@ -530,9 +532,16 @@ static int prep_mmc_bootdev(struct unit_test_state *uts, const char *mmc_dev)
 
        /* Enable the script bootmeth too */
        ut_assertok(uclass_first_device_err(UCLASS_BOOTSTD, &bootstd));
-       ut_assertok(device_bind(bootstd, DM_DRIVER_REF(bootmeth_script),
+       ut_assertok(device_bind(bootstd, DM_DRIVER_REF(bootmeth_2script),
                                "bootmeth_script", 0, ofnode_null(), &dev));
 
+       /* Enable the cros bootmeth if needed */
+       if (bind_cros) {
+               ut_assertok(uclass_first_device_err(UCLASS_BOOTSTD, &bootstd));
+               ut_assertok(device_bind(bootstd, DM_DRIVER_REF(bootmeth_cros),
+                                       "cros", 0, ofnode_null(), &dev));
+       }
+
        /* Change the order to include the device */
        std = dev_get_priv(bootstd);
        old_order = std->bootdev_order;
@@ -556,7 +565,7 @@ static int prep_mmc_bootdev(struct unit_test_state *uts, const char *mmc_dev)
  */
 static int prep_mmc4_bootdev(struct unit_test_state *uts)
 {
-       ut_assertok(prep_mmc_bootdev(uts, "mmc4"));
+       ut_assertok(prep_mmc_bootdev(uts, "mmc4", false));
 
        return 0;
 }
@@ -963,3 +972,24 @@ static int bootflow_cmdline(struct unit_test_state *uts)
        return 0;
 }
 BOOTSTD_TEST(bootflow_cmdline, 0);
+
+/* Test ChromiumOS bootmeth */
+static int bootflow_cros(struct unit_test_state *uts)
+{
+       ut_assertok(prep_mmc_bootdev(uts, "mmc5", true));
+       ut_assertok(run_command("bootflow list", 0));
+
+       ut_assert_nextlinen("Showing all");
+       ut_assert_nextlinen("Seq");
+       ut_assert_nextlinen("---");
+       ut_assert_nextlinen("  0  extlinux");
+       ut_assert_nextlinen("  1  cros         ready   mmc          2  mmc5.bootdev.part_2       ");
+       ut_assert_nextlinen("  2  cros         ready   mmc          4  mmc5.bootdev.part_4       ");
+       ut_assert_nextlinen("---");
+       ut_assert_skip_to_line("(3 bootflows, 3 valid)");
+
+       ut_assert_console_end();
+
+       return 0;
+}
+BOOTSTD_TEST(bootflow_cros, 0);
This page took 0.026393 seconds and 4 git commands to generate.