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
Signed-off-by: Pratik Farkase <[email protected]>
---
 .../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

diff --git a/meta/conf/distro/include/ptest-packagelists.inc 
b/meta/conf/distro/include/ptest-packagelists.inc
index d8eba9dafa..4012be5f49 100644
--- a/meta/conf/distro/include/ptest-packagelists.inc
+++ b/meta/conf/distro/include/ptest-packagelists.inc
@@ -103,6 +103,7 @@ PTESTS_FAST = "\
     slang \
     utfcpp \
     wayland \
+    wget \
     xz \
     zlib \
 "
diff --git a/meta/recipes-extended/wget/wget/run-ptest 
b/meta/recipes-extended/wget/wget/run-ptest
new file mode 100644
index 0000000000..4677e300dc
--- /dev/null
+++ b/meta/recipes-extended/wget/wget/run-ptest
@@ -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
diff --git a/meta/recipes-extended/wget/wget_1.25.0.bb 
b/meta/recipes-extended/wget/wget_1.25.0.bb
index 00667a1e24..d34696e5b6 100644
--- a/meta/recipes-extended/wget/wget_1.25.0.bb
+++ b/meta/recipes-extended/wget/wget_1.25.0.bb
@@ -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"
-- 
2.43.0

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#244960): 
https://lists.openembedded.org/g/openembedded-core/message/244960
Mute This Topic: https://lists.openembedded.org/mt/121051173/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to