diff mbox series

[meta-python,2/5] python3-dnspython: seed resolv.conf from /proc/net/pnp in run-ptest

Message ID 20261015043859.3073445-2-khem.raj@oss.qualcomm.com
State New
Headers show
Series [meta-networking,1/5] openl2tp: fix rpcbind status check in run-ptest | expand

Commit Message

Khem Raj Oct. 15, 2026, 4:38 a.m. UTC
The live resolver tests use the system resolver configuration. When the
network is configured by the kernel ip= parameter and nothing in userspace
writes /etc/resolv.conf, the nameserver is only available in /proc/net/pnp
and the tests fail with "no nameservers". Seed resolv.conf from it when
it has no nameserver entry.

AI-Generated: Uses Claude Code
Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
---
 .../recipes-devtools/python/python3-dnspython/run-ptest  | 9 +++++++++
 1 file changed, 9 insertions(+)
diff mbox series

Patch

diff --git a/meta-python/recipes-devtools/python/python3-dnspython/run-ptest b/meta-python/recipes-devtools/python/python3-dnspython/run-ptest
index 8d2017d39c..cb674db8a0 100644
--- a/meta-python/recipes-devtools/python/python3-dnspython/run-ptest
+++ b/meta-python/recipes-devtools/python/python3-dnspython/run-ptest
@@ -1,3 +1,12 @@ 
 #!/bin/sh

+# The live resolver tests use the system resolver configuration. When the
+# network is set up by the kernel's ip= parameter and nothing in userspace
+# (e.g. systemd-resolved) writes /etc/resolv.conf from it, the nameserver is
+# only available in /proc/net/pnp, so the tests fail with "no nameservers"
+# even though the Internet is reachable. Seed resolv.conf from it in that case.
+if ! grep -qs '^nameserver' /etc/resolv.conf && grep -qs '^nameserver' /proc/net/pnp; then
+    grep '^nameserver' /proc/net/pnp >> /etc/resolv.conf
+fi
+
 pytest --automake