[Concept,09/19] test: pxe: Fix ipappend test to clear board env var

Message ID 20260314231618.338113-10-sjg@u-boot.org
State New
Headers
Series test: Fix pytest inter-test side effects |

Commit Message

Simon Glass March 14, 2026, 11:16 p.m. UTC
  From: Simon Glass <sjg@chromium.org>

pxe_test_ipappend_norun() clears fdtfile to test the fdtdir fallback
path, but the fallback code in pxe_utils.c constructs the DTB filename
from the board env var (which is 'sandbox'). This causes the test to
try /dtb/sandbox.dtb instead of /dtb/.dtb

Clear the board env var alongside fdtfile, and restore it in the
cleanup section.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 test/boot/pxe.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
  

Patch

diff --git a/test/boot/pxe.c b/test/boot/pxe.c
index e691ceebc61..237481d5ee8 100644
--- a/test/boot/pxe.c
+++ b/test/boot/pxe.c
@@ -958,8 +958,12 @@  static int pxe_test_ipappend_norun(struct unit_test_state *uts)
 	ut_assertok(env_set("gatewayip", "192.168.1.254"));
 	ut_assertok(env_set("netmask", "255.255.255.0"));
 
-	/* Clear fdtfile to ensure rescue label's fdtdir tries /dtb/.dtb */
+	/*
+	 * Clear fdtfile and board so the rescue label's fdtdir tries
+	 * /dtb/.dtb (the fallback constructs soc-board.dtb from env)
+	 */
 	ut_assertok(env_set("fdtfile", NULL));
+	ut_assertok(env_set("board", NULL));
 
 	/* Override to boot the rescue label which has ipappend=3 */
 	ut_assertok(env_set("pxe_label_override", "rescue"));
@@ -996,6 +1000,7 @@  static int pxe_test_ipappend_norun(struct unit_test_state *uts)
 	ut_assert_console_end();
 
 	/* Clean up */
+	env_set("board", "sandbox");
 	env_set("ipaddr", NULL);
 	env_set("serverip", NULL);
 	env_set("gatewayip", NULL);