[PATCH 1/4] test: py: network: preserve saved_log_level across _await_prompt
Ahmad Fatoum
a.fatoum at barebox.org
Mon Mar 2 05:47:33 PST 2026
After sendcontrol("c") in tftp_conversation, the call to
_await_prompt() re-queries global.loglevel. At this point, loglevel
has already been silenced to 0 by the previous _run() command's
cleanup, so _await_prompt() saves 0 as the log level to use for
future commands.
This causes the barebox_interfaces fixture's ifup -a to run at
loglevel 0 on the next test, suppressing the dev_info "DHCP client
bound to address" message that the fixture parses to discover
interfaces. The test_barebox_network_real_tftp test then fails with
"Network testing is only possible with at least one DHCP interface".
Fix by saving and restoring saved_log_level across the _await_prompt()
call.
Co-Authored-By: Claude Opus 4.6 <noreply at anthropic.com>
Signed-off-by: Ahmad Fatoum <a.fatoum at barebox.org>
---
test/py/test_network.py | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/test/py/test_network.py b/test/py/test_network.py
index c8c5e9ec7606..922e425a2b9c 100644
--- a/test/py/test_network.py
+++ b/test/py/test_network.py
@@ -68,7 +68,12 @@ def tftp_conversation(barebox, barebox_interface, guestaddr):
finally:
# terminate a timed-out tftp
barebox.console.sendcontrol("c")
+ saved_log_level = barebox.saved_log_level
barebox._await_prompt()
+ # _await_prompt() re-queries global.loglevel, which has been
+ # silenced to 0 by _run(), and saves it. Restore the original
+ # level so subsequent run_check() calls still raise it.
+ barebox.saved_log_level = saved_log_level
tftp_thread.join()
barebox.run_check("ifdown eth0")
--
2.47.3
More information about the barebox
mailing list