Skip to contentSkip to conversation

wget: add ptest support

PATCH New Pratik Farkase 1 participant 1 message Sep 2

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 wget: add ptest support

Add ptest support using wget's upstream testenv Python test suite, which spins up local HTTP servers and runs the installed wget against them, covering downloads, authentication, cookies, redirects, recursive fetching, content-disposition and HTTPS/TLS behaviour.

SSL_TESTS is set in run-ptest so the HTTPS tests run against the bundled non-expiring test certificates.

AI-Generated: Assisted by Claude Sonnet 4

---
 .../distro/include/ptest-packagelists.inc     |  1 +
 meta/recipes-extended/wget/wget/run-ptest     | 21 +++++++++++++++++++
 meta/recipes-extended/wget/wget_1.25.0.bb     | 21 ++++++++++++++++++-
 3 files changed, 42 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-extended/wget/wget/run-ptest
meta/conf/distro/include/ptest-packagelists.inc +1 -0
index d8eba9dafa..4012be5f49 100644
@@ -103,6 +103,7 @@ PTESTS_FAST = "\
     slang \
     utfcpp \
     wayland \
+    wget \
     xz \
     zlib \
 "
meta/recipes-extended/wget/wget/run-ptest new file +21 -0
new file mode 100644
index 0000000000..4677e300dc
@@ -0,0 +1,21 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-3.0-only
+
+cd "$(dirname "$0")/testenv" || exit 1
+
+WGET_PATH="$(command -v wget)"
+export WGET_PATH
+
+export SSL_TESTS=1
+
+for t in Test-*.py test_*.py; do
+    [ -f "$t" ] || continue
+    python3 -O "$t" > "$t.log" 2>&1
+    ret=$?
+    case $ret in
+        0)  echo "PASS: $t" ;;
+        77) echo "SKIP: $t" ;;
+        *)  echo "FAIL: $t" ;;
+    esac
+    rm -f "$t.log"
+done
meta/recipes-extended/wget/wget_1.25.0.bb +20 -1
index 00667a1e24..d34696e5b6 100644
@@ -9,7 +9,7 @@ SECTION = "console/network"
 LICENSE = "GPL-3.0-only"
 LIC_FILES_CHKSUM = "file://COPYING;md5=6f65012d1daf98cb09b386cfb68df26b"
 
-inherit autotools gettext texinfo update-alternatives pkgconfig
+inherit autotools gettext texinfo update-alternatives pkgconfig ptest
 
 DEPENDS += "autoconf-archive-native pod2man-native"
 
@@ -21,6 +21,7 @@ SRC_URI = "${GNU_MIRROR}/wget/wget-${PV}.tar.gz \
            file://CVE-2026-58472.patch \
            file://CVE-2026-58472-regression.patch \
            file://CVE-2026-58471.patch \
+           file://run-ptest \
            "
 
 SRC_URI[sha256sum] = "766e48423e79359ea31e41db9e5c289675947a7fcf2efdcedb726ac9d0da3784"
@@ -49,4 +50,22 @@ ALTERNATIVE_PRIORITY = "100"
 
 RRECOMMENDS:${PN} += "ca-certificates"
 
+do_install_ptest() {
+    install -d ${D}${PTEST_PATH}/testenv
+    cp -r ${S}/testenv/certs ${D}${PTEST_PATH}/testenv/
+    cp -r ${S}/testenv/conf ${D}${PTEST_PATH}/testenv/
+    cp -r ${S}/testenv/exc ${D}${PTEST_PATH}/testenv/
+    cp -r ${S}/testenv/misc ${D}${PTEST_PATH}/testenv/
+    cp -r ${S}/testenv/server ${D}${PTEST_PATH}/testenv/
+    cp -r ${S}/testenv/test ${D}${PTEST_PATH}/testenv/
+    for t in ${S}/testenv/Test-*.py ${S}/testenv/test_*.py; do
+        case $t in
+            */Test-metalink-*) continue ;;
+        esac
+        install -m 0755 $t ${D}${PTEST_PATH}/testenv/
+    done
+}
+
+RDEPENDS:${PN}-ptest += "python3-core python3-modules"
+
 BBCLASSEXTEND = "nativesdk"
Signature · 1 line
2.43.0