[Concept,17/19] test: boot: Restore default addr env vars in extlinux tests

Message ID 20260314231618.338113-18-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>

The PXE tests set kernel_addr_r to 0x2000000 and do not restore the
original value. When bootflow_extlinux_localboot or
bootflow_scan_extlinux run later, they read the wrong address from
the environment and fail.

Restore kernel_addr_r and ramdisk_addr_r to their default values at
the start of each test so they do not depend on test ordering.

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

 test/boot/bootflow.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
  

Patch

diff --git a/test/boot/bootflow.c b/test/boot/bootflow.c
index 9aab3ea807a..53fa88ae080 100644
--- a/test/boot/bootflow.c
+++ b/test/boot/bootflow.c
@@ -1677,6 +1677,11 @@  static int bootflow_scan_extlinux(struct unit_test_state *uts)
 	const void *fdt;
 	int node;
 
+	/* restore default addresses in case PXE tests changed them */
+	ut_assertok(env_set("kernel_addr_r", "1000000"));
+	ut_assertok(env_set("ramdisk_addr_r", "2000000"));
+	ut_assertok(env_set("fdt_addr_r", "c00000"));
+
 	ut_assertok(run_command("bootflow scan", 0));
 	ut_assert_console_end();
 	ut_assertok(bootstd_get_priv(&std));
@@ -1745,6 +1750,11 @@  static int bootflow_extlinux_localboot(struct unit_test_state *uts)
 	const char **old_order;
 	struct bootflow *bflow;
 
+	/* restore default addresses in case PXE tests changed them */
+	ut_assertok(env_set("kernel_addr_r", "1000000"));
+	ut_assertok(env_set("ramdisk_addr_r", "2000000"));
+	ut_assertok(env_set("fdt_addr_r", "c00000"));
+
 	ut_assertok(prep_mmc_bootdev(uts, "mmc9", false, &old_order));
 
 	ut_assertok(run_command("bootflow scan", 0));