diff mbox series

[meta-networking,2/2] tinyproxy: add ptest support

Message ID 20251223174926.897953-2-skandigraun@gmail.com
State New
Headers show
Series [meta-networking,1/2] tinyproxy: patch CVE-2025-63938 | expand

Commit Message

Gyorgy Sarvari Dec. 23, 2025, 5:49 p.m. UTC
It takes <10s to execute.

Sample output:

root@qemux86-64:~# ptest-runner
START: ptest-runner
2025-12-23T17:45
BEGIN: /usr/lib/tinyproxy/ptest
starting web server... done (listening on 127.0.0.3:32123)
starting tinyproxy... done (listening on 127.0.0.2:12321)
waiting for 1 seconds.. done
checking direct connection to web server... ok
testing connection through tinyproxy... ok
requesting statspage via stathost url... ok
signaling tinyproxy to reload config...ok
checking direct connection to web server... ok
testing connection through tinyproxy... ok
requesting statspage via stathost url... ok
checking bogus request... ok, got expected error code 400
testing connection to filtered domain... ok, got expected error code 403
requesting connect method to denied port... ok, got expected error code 403
testing unavailable backend... ok, got expected error code 502
0 errors
killing tinyproxy... ok
killing webserver... ok
done
PASS: run_tests.sh
DURATION: 1
END: /usr/lib/tinyproxy/ptest
2025-12-23T17:45
STOP: ptest-runner
TOTAL: 1 FAIL: 0

Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com>
---
 .../ptest-packagelists-meta-networking.inc    |  1 +
 .../tinyproxy/tinyproxy/run-ptest             | 10 +++++++
 .../tinyproxy/tinyproxy_1.11.2.bb             | 26 ++++++++++++++++++-
 3 files changed, 36 insertions(+), 1 deletion(-)
 create mode 100644 meta-networking/recipes-support/tinyproxy/tinyproxy/run-ptest
diff mbox series

Patch

diff --git a/meta-networking/conf/include/ptest-packagelists-meta-networking.inc b/meta-networking/conf/include/ptest-packagelists-meta-networking.inc
index 838aee94d3..0897024e3c 100644
--- a/meta-networking/conf/include/ptest-packagelists-meta-networking.inc
+++ b/meta-networking/conf/include/ptest-packagelists-meta-networking.inc
@@ -23,6 +23,7 @@  PTESTS_FAST_META_NETWORKING = "\
     python3-scapy \
     squid \
     tcpdump \
+    tinyproxy \
     wolfssl \
 "
 PTESTS_FAST_META_NETWORKING:remove:libc-musl = "\
diff --git a/meta-networking/recipes-support/tinyproxy/tinyproxy/run-ptest b/meta-networking/recipes-support/tinyproxy/tinyproxy/run-ptest
new file mode 100644
index 0000000000..267a975c24
--- /dev/null
+++ b/meta-networking/recipes-support/tinyproxy/tinyproxy/run-ptest
@@ -0,0 +1,10 @@ 
+#!/bin/sh
+RET=0
+cd tests/scripts
+if ./run_tests.sh; then
+    echo PASS: run_tests.sh
+else
+    echo FAIL: run_tests.sh
+    RET=1
+fi
+exit $RET
diff --git a/meta-networking/recipes-support/tinyproxy/tinyproxy_1.11.2.bb b/meta-networking/recipes-support/tinyproxy/tinyproxy_1.11.2.bb
index e386d39cdc..222cc8d7c6 100644
--- a/meta-networking/recipes-support/tinyproxy/tinyproxy_1.11.2.bb
+++ b/meta-networking/recipes-support/tinyproxy/tinyproxy_1.11.2.bb
@@ -7,6 +7,7 @@  SRC_URI = "https://github.com/${BPN}/${BPN}/releases/download/${PV}/${BP}.tar.gz
            file://disable-documentation.patch \
            file://tinyproxy.service \
            file://tinyproxy.conf \
+           file://run-ptest \
            file://CVE-2025-63938.patch \
            "
 
@@ -22,7 +23,7 @@  EXTRA_OECONF += " \
 	--enable-xtinyproxy \
 	"
 
-inherit autotools systemd useradd
+inherit autotools systemd useradd ptest
 
 #User specific
 USERADD_PACKAGES = "${PN}"
@@ -40,3 +41,26 @@  do_install:append() {
 	fi
 	install -m 0644 ${UNPACKDIR}/tinyproxy.conf ${D}${sysconfdir}/tinyproxy.conf
 }
+
+do_install_ptest() {
+	install -d ${D}${PTEST_PATH}/tests/scripts
+	install -d ${D}${PTEST_PATH}/data/templates
+	install ${S}/tests/scripts/*.sh ${D}${PTEST_PATH}/tests/scripts
+	install ${S}/tests/scripts/*.pl ${D}${PTEST_PATH}/tests/scripts
+	install -m 0644 ${S}/data/templates/*.html ${D}${PTEST_PATH}/data/templates/
+	# test the installed binary, not the one that was just compiled in the src folder
+	sed -i 's,TINYPROXY_BIN=.*,TINYPROXY_BIN=tinyproxy,' ${D}${PTEST_PATH}/tests/scripts/run_tests.sh
+}
+
+RDEPENDS:${PN}-ptest += "\
+    perl \
+    perl-module-cwd \
+    perl-module-encode-encoding \
+    perl-module-file-spec \
+    perl-module-getopt-long \
+    perl-module-io-socket \
+    perl-module-io-socket-inet \
+    perl-module-pod-text \
+    perl-module-posix \
+    procps \
+"