Skip to contentSkip to conversation

mbr: Test tweaks

PATCH In review Simon Glass 2 participants 2 messages Oct 16, 2023 – Oct 24, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mbr: Test tweaks

Rather than do another review on [1] I thought it better to add a patch showing changes. This is intended to be squashed in, if acceptable.

With the patch as is, various bootstd tests fail. This is because the test adds a new mmc6 device. There is nothing really wrong with adding new devices, but it does require quite a few tests to be updated. It is simpler to have mmc6 disabled by default, then just enable it for the one test that uses it.

This patch does that and undoes the changes to blk.c and bootdev.c

[1] https://patchwork.ozlabs.org/project/uboot/patch/ZSNWVGTjPEt2jXn5@alg-gentoo/

---

 arch/Kconfig                       |  2 ++
 arch/sandbox/dts/test.dts          |  1 +
 configs/sandbox_defconfig          |  2 --
 configs/sandbox_flattree_defconfig |  2 ++
 test/boot/bootdev.c                |  2 +-
 test/cmd/mbr.c                     | 13 ++++++++-
 test/dm/blk.c                      | 44 ++++++++++--------------------
 7 files changed, 32 insertions(+), 34 deletions(-)
arch/Kconfig +2 -0
index 19f2891ba1c5..4f5b75129f34 100644
@@ -208,6 +208,8 @@ config SANDBOX
 	imply PHYSMEM
 	imply GENERATE_ACPI_TABLE
 	imply BINMAN
+	imply CMD_MBR
+	imply CMD_MMC
 
 config SH
 	bool "SuperH architecture"
arch/sandbox/dts/test.dts +1 -0
index 3a8c2456d401..9fe2d63dcc50 100644
@@ -1101,6 +1101,7 @@
 
 	/* This is used for mbr tests */
 	mmc6 {
+		status = "disabled";
 		compatible = "sandbox,mmc";
 		filename = "mmc6.img";
 	};
configs/sandbox_defconfig +0 -2
index 01830c7bd255..a1c1a45a08a3 100644
@@ -73,8 +73,6 @@ CONFIG_CMD_IDE=y
 CONFIG_CMD_I2C=y
 CONFIG_CMD_LOADM=y
 CONFIG_CMD_LSBLK=y
-CONFIG_CMD_MBR=y
-CONFIG_CMD_MMC=y
 CONFIG_CMD_MUX=y
 CONFIG_CMD_OSD=y
 CONFIG_CMD_PCI=y
configs/sandbox_flattree_defconfig +2 -0
index 29ae4532c508..44ab80725fc7 100644
@@ -47,10 +47,12 @@ CONFIG_CMD_MBR=y
 CONFIG_CMD_MMC=y
 CONFIG_CMD_OSD=y
 CONFIG_CMD_PCI=y
+CONFIG_CMD_READ=y
 CONFIG_CMD_REMOTEPROC=y
 CONFIG_CMD_SPI=y
 CONFIG_CMD_TEMPERATURE=y
 CONFIG_CMD_USB=y
+CONFIG_CMD_WRITE=y
 CONFIG_BOOTP_DNS2=y
 CONFIG_CMD_TFTPPUT=y
 CONFIG_CMD_TFTPSRV=y
test/boot/bootdev.c +1 -1
index 66c151131edb..c5f14a7a1323 100644
@@ -128,7 +128,7 @@ static int bootdev_test_labels(struct unit_test_state *uts)
 		    bootdev_find_by_label("fred0", &dev, &mflags));
 
 	/* Check unknown sequence number */
-	ut_asserteq(-ENOENT, bootdev_find_by_label("mmc7", &dev, &mflags));
+	ut_asserteq(-ENOENT, bootdev_find_by_label("mmc6", &dev, &mflags));
 
 	return 0;
 }
test/cmd/mbr.c +12 -1
index 4091ea687fc5..751b16d605b7 100644
@@ -7,11 +7,14 @@
  */
 
 #include <common.h>
-#include <asm/global_data.h>
+#include <dm.h>
 #include <console.h>
 #include <dm/test.h>
 #include <mapmem.h>
 #include <part.h>
+#include <asm/global_data.h>
+#include <dm/device-internal.h>
+#include <dm/lists.h>
 #include <test/suites.h>
 #include <test/ut.h>
 
@@ -231,6 +234,14 @@ static int mbr_test_run(struct unit_test_state *uts)
 	unsigned char mbr_wbuf[512], ebr_wbuf[512], rbuf[512];
 	char mbr_parts_buf[256];
 	ulong mbr_wa, ebr_wa, ra, ebr_blk, mbr_parts_max;
+	struct udevice *dev;
+	ofnode root, node;
+
+	/* Enable the mmc6 node for this test */
+	root = oftree_root(oftree_default());
+	node = ofnode_find_subnode(root, "mmc6");
+	ut_assert(ofnode_valid(node));
+	ut_assertok(lists_bind_fdt(gd->dm_root, node, &dev, NULL, false));
 
 	mbr_parts_max = sizeof('\0') + 2 +
 		strlen(mbr_parts_header) +
test/dm/blk.c +14 -30

117 lines not on this page · raw message

Signature · 1 line
2.42.0.655.g421f12c284-goog
#1 lore raw
Quoted 9 lines · Simon Glass

Rather than do another review on [1] I thought it better to add a patch showing changes. This is intended to be squashed in, if acceptable.

With the patch as is, various bootstd tests fail. This is because the test adds a new mmc6 device. There is nothing really wrong with adding new devices, but it does require quite a few tests to be updated. It is simpler to have mmc6 disabled by default, then just enable it for the one test that uses it.

Quoted 5 lines

This patch does that and undoes the changes to blk.c and bootdev.c

[1] https://patchwork.ozlabs.org/project/uboot/patch/ZSNWVGTjPEt2jXn5@alg-gentoo/

I've folded this in to the original patch while applying.

Signature · 1 line
Tom