From: Haixiao Yan <[email protected]>

Fix ptest:
The openvpn 2.7.0 upgrade refactored
tests/unit_tests/openvpn/Makefile.am, changing how test_binaries is
defined. This caused autoreconf to generate Makefiles where
buildtest-TESTS and runtest-TESTS no longer have rule bodies, breaking
the existing ptest recipe which relied on these targets for compilation
and execution. The fix replaces these internal automake targets with
stable interfaces: check-am for compilation and direct binary execution
on target.

Release notes:
https://community.openvpn.net/ReleaseHistory#openvpn-270-released-11-february-2026

Signed-off-by: Haixiao Yan <[email protected]>
---
 ...-test-execution-when-cross-compiling.patch | 34 ++++++++++++++++++
 .../recipes-support/openvpn/openvpn/run-ptest | 16 +++++++--
 .../{openvpn_2.6.17.bb => openvpn_2.7.0.bb}   | 35 +++++++++++--------
 3 files changed, 68 insertions(+), 17 deletions(-)
 create mode 100644 
meta-networking/recipes-support/openvpn/openvpn/0001-tests-skip-test-execution-when-cross-compiling.patch
 rename meta-networking/recipes-support/openvpn/{openvpn_2.6.17.bb => 
openvpn_2.7.0.bb} (80%)

diff --git 
a/meta-networking/recipes-support/openvpn/openvpn/0001-tests-skip-test-execution-when-cross-compiling.patch
 
b/meta-networking/recipes-support/openvpn/openvpn/0001-tests-skip-test-execution-when-cross-compiling.patch
new file mode 100644
index 000000000000..f8f2d2907f2c
--- /dev/null
+++ 
b/meta-networking/recipes-support/openvpn/openvpn/0001-tests-skip-test-execution-when-cross-compiling.patch
@@ -0,0 +1,34 @@
+From 93f7f6ca0c916427d28610d3e263fa556587532d Mon Sep 17 00:00:00 2001
+From: Haixiao Yan <[email protected]>
+Date: Thu, 26 Mar 2026 13:43:50 +0800
+Subject: [PATCH] tests: skip test execution when cross-compiling
+
+The auth-pam unit test Makefile.am unconditionally assigns the TESTS variable,
+causing test execution to fail during cross-compilation because the target
+binaries are not executable on the build host.
+
+Upstream-Status: Pending
+
+Signed-off-by: Haixiao Yan <[email protected]>
+---
+ tests/unit_tests/plugins/auth-pam/Makefile.am | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/tests/unit_tests/plugins/auth-pam/Makefile.am 
b/tests/unit_tests/plugins/auth-pam/Makefile.am
+index ba32013ac920..7da299ccde92 100644
+--- a/tests/unit_tests/plugins/auth-pam/Makefile.am
++++ b/tests/unit_tests/plugins/auth-pam/Makefile.am
+@@ -4,8 +4,10 @@ AM_TESTSUITE_SUMMARY_HEADER = ' for $(PACKAGE_STRING) 
auth_pam Plugin Unit-Tests
+ 
+ if ENABLE_PLUGIN_AUTH_PAM
+ check_PROGRAMS = auth_pam_testdriver
++if !CROSS_COMPILING
+ TESTS = $(check_PROGRAMS)
+ endif
++endif
+ 
+ auth_pam_testdriver_SOURCES = test_search_and_replace.c  
$(top_srcdir)/src/plugins/auth-pam/utils.h 
$(top_srcdir)/src/plugins/auth-pam/utils.c
+ auth_pam_testdriver_CFLAGS  = @TEST_CFLAGS@ 
-I$(top_srcdir)/src/plugins/auth-pam
+-- 
+2.43.0
+
diff --git a/meta-networking/recipes-support/openvpn/openvpn/run-ptest 
b/meta-networking/recipes-support/openvpn/openvpn/run-ptest
index 19f66b5c565e..b0f5699e57dd 100644
--- a/meta-networking/recipes-support/openvpn/openvpn/run-ptest
+++ b/meta-networking/recipes-support/openvpn/openvpn/run-ptest
@@ -1,8 +1,20 @@
 #!/bin/sh
 
-find ./ -name Makefile | while read -r x; do
-    make -C "$(dirname "${x}")" -k runtest-TESTS | sed \
+# Run unit tests directly
+find ./ -name "*testdriver" -type f -executable | while read -r t; do
+    dir=$(dirname "${t}")
+    srcdir="${dir}" "${t}" 2>&1 | sed \
         -e 's/^\(\[       OK \].*\)$/PASS: \1/' \
         -e 's/^\(\[  FAILED  \].*\)$/FAIL: \1/' \
         -e 's/^\(\[  SKIPPED \].*\)$/SKIP: \1/'
 done
+
+# Run crypto loopback integration test
+if [ -f ./t_lpback.sh ]; then
+    sh ./t_lpback.sh 2>&1
+    if [ $? -eq 0 ]; then
+        echo "PASS: t_lpback"
+    else
+        echo "FAIL: t_lpback"
+    fi
+fi
diff --git a/meta-networking/recipes-support/openvpn/openvpn_2.6.17.bb 
b/meta-networking/recipes-support/openvpn/openvpn_2.7.0.bb
similarity index 80%
rename from meta-networking/recipes-support/openvpn/openvpn_2.6.17.bb
rename to meta-networking/recipes-support/openvpn/openvpn_2.7.0.bb
index c454a9327647..0cbe4641cd6c 100644
--- a/meta-networking/recipes-support/openvpn/openvpn_2.6.17.bb
+++ b/meta-networking/recipes-support/openvpn/openvpn_2.7.0.bb
@@ -2,20 +2,21 @@ SUMMARY = "A full-featured SSL VPN solution via tun device."
 HOMEPAGE = "https://openvpn.net/";
 SECTION = "net"
 LICENSE = "GPL-2.0-only"
-LIC_FILES_CHKSUM = "file://COPYING;md5=89196bacc47ed37a5b242a535661a049"
+LIC_FILES_CHKSUM = "file://COPYING;md5=924af2c382c415a0a68d0d9e7b483d23"
 DEPENDS = "lzo lz4 openssl libcap-ng ${@bb.utils.contains('DISTRO_FEATURES', 
'pam', 'libpam', '', d)} ${@bb.utils.contains('PTEST_ENABLED', '1', 'cmocka', 
'', d)} "
 
 inherit autotools systemd update-rc.d pkgconfig ptest
 
 SRC_URI = "http://swupdate.openvpn.org/community/releases/${BP}.tar.gz \
            
file://0001-configure.ac-eliminate-build-path-from-openvpn-versi.patch \
+           file://0001-tests-skip-test-execution-when-cross-compiling.patch \
            file://openvpn \
            file://run-ptest \
           "
 
 UPSTREAM_CHECK_URI = "https://openvpn.net/community-downloads";
 
-SRC_URI[sha256sum] = 
"4cc8e63f710d3001493b13d8a32cf22a214d5e4f71dd37d93831e2fd3208b370"
+SRC_URI[sha256sum] = 
"2f0e10eb272be61e8fb25fe1cfa20875ff30ac857ef1418000c02290bd6dfa45"
 
 CVE_STATUS[CVE-2020-27569] = "not-applicable-config: Applies only Aviatrix 
OpenVPN client, not openvpn"
 
@@ -46,7 +47,8 @@ PACKAGECONFIG[iproute2] = 
"--enable-iproute2,,iproute2,iproute2-ip"
 PACKAGECONFIG[systemd] = "--enable-systemd,--disable-systemd,systemd"
 PACKAGECONFIG[selinux] = "--enable-selinux,--disable-selinux,libselinux"
 
-RDEPENDS:${PN}-ptest:append = " make bash"
+RDEPENDS:${PN}:append = " bash"
+RDEPENDS:${PN}-ptest:append = " bash"
 
 do_install:append() {
     install -d ${D}/${sysconfdir}/init.d
@@ -70,21 +72,21 @@ do_install:append() {
 }
 
 do_compile_ptest () {
-    for x in `find ${B}/tests/unit_tests -name Makefile -exec grep -l 
buildtest-TESTS {} \;`; do
+    for x in `find ${B}/tests/unit_tests -name Makefile -exec grep -l 
check_PROGRAMS {} \;`; do
         dir=`dirname ${x}`
         case $dir in
             *example*)   
                 echo "Skipping directory: $dir"
                 ;;
             *)           
-                oe_runmake -C ${dir} buildtest-TESTS
+                oe_runmake -C ${dir} check-am
                 ;;
         esac
     done
 }
 
 do_install_ptest() {
-    for x in $(find ${B}/tests/unit_tests -name Makefile -exec grep -l 
buildtest-TESTS {} \;); do
+    for x in $(find ${B}/tests/unit_tests -name Makefile -exec grep -l 
check_PROGRAMS {} \;); do
         dir=$(dirname ${x})
 
         if [[ "$dir" == *example* ]]; then
@@ -93,21 +95,23 @@ do_install_ptest() {
 
         target_dir="${D}/${PTEST_PATH}/unit_tests/$(basename ${dir})"
         mkdir -p ${target_dir}
-        cp -f ${dir}/Makefile ${target_dir}/        
-        sed -i "s/^Makefile:/MM:/g" ${target_dir}/Makefile
-        sed -i 's/^#TESTS = $(am__EXEEXT_4)/TESTS = $(am__EXEEXT_4)/' 
${target_dir}/Makefile
 
-        for testfile in $(find ${dir} -name "*testdriver"); do
+        for testfile in $(find ${dir} -name "*testdriver" -type f 
-executable); do
             cp -rf ${testfile} ${target_dir}/
         done
     done
-    sed -i 's|find ./|find ${PTEST_PATH}|g' ${D}${PTEST_PATH}/run-ptest
+
+    # Install test input data files needed by user_pass and misc tests
+    cp -rf ${S}/tests/unit_tests/openvpn/input 
${D}/${PTEST_PATH}/unit_tests/openvpn/
+
+    # Install COPYRIGHT.GPL needed by test_list
+    # test_list references srcdir/../../../COPYRIGHT.GPL
+    # srcdir=./unit_tests/openvpn -> resolves to ../COPYRIGHT.GPL from ptest 
cwd
+    # which is ${libdir}/openvpn/COPYRIGHT.GPL
+    cp -f ${S}/COPYRIGHT.GPL ${D}/${libdir}/openvpn/
+
     sed -i 's|${top_builddir}/src/openvpn|${sbindir}|g' ${S}/tests/t_lpback.sh
     cp -f ${S}/tests/t_lpback.sh ${D}/${PTEST_PATH}
-    cp -f ${B}/tests/Makefile ${D}/${PTEST_PATH}
-    sed -i "s/^Makefile:/MM:/g" ${D}/${PTEST_PATH}/Makefile
-    sed -i "s/^test_scripts = t_client.sh t_lpback.sh t_cltsrv.sh/test_scripts 
= t_lpback.sh/g" ${D}/${PTEST_PATH}/Makefile
-    
 }
 
 PACKAGES =+ " ${PN}-sample "
@@ -115,6 +119,7 @@ PACKAGES =+ " ${PN}-sample "
 RRECOMMENDS:${PN} = "kernel-module-tun"
 
 FILES:${PN}-dbg += "${libdir}/openvpn/plugins/.debug"
+FILES:${PN}-ptest += "${libdir}/openvpn/COPYRIGHT.GPL"
 FILES:${PN} += "${systemd_system_unitdir}/[email protected] \
                 ${systemd_system_unitdir}/[email protected] \
                 ${nonarch_libdir}/tmpfiles.d \
-- 
2.25.1

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

  • [oe] [PATCH] openvpn: upgrade... Yan, Haixiao (CN) via lists.openembedded.org

Reply via email to