diff mbox series

[meta-perl,kirkstone] libnet-dns-perl: fix ptests

Message ID 20251031154411.1238514-1-skandigraun@gmail.com
State New
Headers show
Series [meta-perl,kirkstone] libnet-dns-perl: fix ptests | expand

Commit Message

Gyorgy Sarvari Oct. 31, 2025, 3:44 p.m. UTC
Enable network connection to get a test unstuck that was trying to access the network.

Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com>
---
 meta-perl/recipes-perl/libnet/files/run-ptest         |  6 ++++++
 meta-perl/recipes-perl/libnet/libnet-dns-perl_1.33.bb | 11 ++++++++++-
 2 files changed, 16 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/meta-perl/recipes-perl/libnet/files/run-ptest b/meta-perl/recipes-perl/libnet/files/run-ptest
index c9f9ca94d0..48d72a78fa 100644
--- a/meta-perl/recipes-perl/libnet/files/run-ptest
+++ b/meta-perl/recipes-perl/libnet/files/run-ptest
@@ -1,5 +1,11 @@ 
 #!/bin/sh
 
+if ! nslookup example.com; then
+    mv /etc/resolv.conf /etc/resolv.conf.bak
+    echo "nameserver 8.8.8.8" > /etc/resolv.conf
+    trap "mv /etc/resolv.conf.bak /etc/resolv.conf" INT EXIT
+fi
+
 for case in `find t -type f -name '*.t'`; do
     perl $case >$case.output 2>&1
     ret=$?
diff --git a/meta-perl/recipes-perl/libnet/libnet-dns-perl_1.33.bb b/meta-perl/recipes-perl/libnet/libnet-dns-perl_1.33.bb
index c768d64e32..3432076ade 100644
--- a/meta-perl/recipes-perl/libnet/libnet-dns-perl_1.33.bb
+++ b/meta-perl/recipes-perl/libnet/libnet-dns-perl_1.33.bb
@@ -7,7 +7,8 @@  LIC_FILES_CHKSUM = "file://README;beginline=252;endline=269;md5=de95b6a896d5f861
 
 DEPENDS += "perl"
 
-SRC_URI = "http://search.cpan.org/CPAN/authors/id/N/NL/NLNETLABS/Net-DNS-${PV}.tar.gz"
+SRC_URI = "http://search.cpan.org/CPAN/authors/id/N/NL/NLNETLABS/Net-DNS-${PV}.tar.gz \
+           file://run-ptest"
 
 SRC_URI[sha256sum] = "5a40e7cf524e4bd2c33cf03b82b47d5308b712083aa5ee180b0b5af54c71fbd2"
 
@@ -49,6 +50,14 @@  RDEPENDS:${PN}-ptest += " \
     perl-module-overload \
 "
 
+do_install_ptest_perl:append(){
+    # This test tries to reconcile the MANIFEST file content with the actual
+    # package content. While this might be useful for package integrity
+    # verification, it is not much for runtime testing. It also requires the
+    # whole source package to be installed. Rather just drop this test.
+    rm ${D}${PTEST_PATH}/t/00-install.t
+}
+
 python __anonymous () {
     # rather than use "find" to determine libc-*.so,
     # statically export the known paths for glibc and musl