summaryrefslogtreecommitdiffstats
path: root/meta-networking
diff options
context:
space:
mode:
authorHaixiao Yan <haixiao.yan.cn@windriver.com>2026-03-27 10:12:43 +0800
committerKhem Raj <khem.raj@oss.qualcomm.com>2026-03-27 09:09:05 -0700
commit79201ef95ed1169f21c97710859de5417824c55e (patch)
treef46ba48183a833ce8cd3924ae82b58f410f9b50e /meta-networking
parentf9a520a6bc883c2f670a0b26864103e1f39d17dc (diff)
downloadmeta-openembedded-79201ef95ed1169f21c97710859de5417824c55e.tar.gz
openvpn: 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. Signed-off-by: Haixiao Yan <haixiao.yan.cn@windriver.com> Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
Diffstat (limited to 'meta-networking')
-rw-r--r--meta-networking/recipes-support/openvpn/openvpn/0001-tests-skip-test-execution-when-cross-compiling.patch34
-rw-r--r--meta-networking/recipes-support/openvpn/openvpn/run-ptest16
-rw-r--r--meta-networking/recipes-support/openvpn/openvpn_2.7.0.bb30
3 files changed, 65 insertions, 15 deletions
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 0000000000..f8f2d2907f
--- /dev/null
+++ b/meta-networking/recipes-support/openvpn/openvpn/0001-tests-skip-test-execution-when-cross-compiling.patch
@@ -0,0 +1,34 @@
1From 93f7f6ca0c916427d28610d3e263fa556587532d Mon Sep 17 00:00:00 2001
2From: Haixiao Yan <haixiao.yan.cn@windriver.com>
3Date: Thu, 26 Mar 2026 13:43:50 +0800
4Subject: [PATCH] tests: skip test execution when cross-compiling
5
6The auth-pam unit test Makefile.am unconditionally assigns the TESTS variable,
7causing test execution to fail during cross-compilation because the target
8binaries are not executable on the build host.
9
10Upstream-Status: Pending
11
12Signed-off-by: Haixiao Yan <haixiao.yan.cn@windriver.com>
13---
14 tests/unit_tests/plugins/auth-pam/Makefile.am | 2 ++
15 1 file changed, 2 insertions(+)
16
17diff --git a/tests/unit_tests/plugins/auth-pam/Makefile.am b/tests/unit_tests/plugins/auth-pam/Makefile.am
18index ba32013ac920..7da299ccde92 100644
19--- a/tests/unit_tests/plugins/auth-pam/Makefile.am
20+++ b/tests/unit_tests/plugins/auth-pam/Makefile.am
21@@ -4,8 +4,10 @@ AM_TESTSUITE_SUMMARY_HEADER = ' for $(PACKAGE_STRING) auth_pam Plugin Unit-Tests
22
23 if ENABLE_PLUGIN_AUTH_PAM
24 check_PROGRAMS = auth_pam_testdriver
25+if !CROSS_COMPILING
26 TESTS = $(check_PROGRAMS)
27 endif
28+endif
29
30 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
31 auth_pam_testdriver_CFLAGS = @TEST_CFLAGS@ -I$(top_srcdir)/src/plugins/auth-pam
32--
332.43.0
34
diff --git a/meta-networking/recipes-support/openvpn/openvpn/run-ptest b/meta-networking/recipes-support/openvpn/openvpn/run-ptest
index 19f66b5c56..b0f5699e57 100644
--- a/meta-networking/recipes-support/openvpn/openvpn/run-ptest
+++ b/meta-networking/recipes-support/openvpn/openvpn/run-ptest
@@ -1,8 +1,20 @@
1#!/bin/sh 1#!/bin/sh
2 2
3find ./ -name Makefile | while read -r x; do 3# Run unit tests directly
4 make -C "$(dirname "${x}")" -k runtest-TESTS | sed \ 4find ./ -name "*testdriver" -type f -executable | while read -r t; do
5 dir=$(dirname "${t}")
6 srcdir="${dir}" "${t}" 2>&1 | sed \
5 -e 's/^\(\[ OK \].*\)$/PASS: \1/' \ 7 -e 's/^\(\[ OK \].*\)$/PASS: \1/' \
6 -e 's/^\(\[ FAILED \].*\)$/FAIL: \1/' \ 8 -e 's/^\(\[ FAILED \].*\)$/FAIL: \1/' \
7 -e 's/^\(\[ SKIPPED \].*\)$/SKIP: \1/' 9 -e 's/^\(\[ SKIPPED \].*\)$/SKIP: \1/'
8done 10done
11
12# Run crypto loopback integration test
13if [ -f ./t_lpback.sh ]; then
14 sh ./t_lpback.sh 2>&1
15 if [ $? -eq 0 ]; then
16 echo "PASS: t_lpback"
17 else
18 echo "FAIL: t_lpback"
19 fi
20fi
diff --git a/meta-networking/recipes-support/openvpn/openvpn_2.7.0.bb b/meta-networking/recipes-support/openvpn/openvpn_2.7.0.bb
index 2567747121..0cbe4641cd 100644
--- a/meta-networking/recipes-support/openvpn/openvpn_2.7.0.bb
+++ b/meta-networking/recipes-support/openvpn/openvpn_2.7.0.bb
@@ -9,6 +9,7 @@ inherit autotools systemd update-rc.d pkgconfig ptest
9 9
10SRC_URI = "http://swupdate.openvpn.org/community/releases/${BP}.tar.gz \ 10SRC_URI = "http://swupdate.openvpn.org/community/releases/${BP}.tar.gz \
11 file://0001-configure.ac-eliminate-build-path-from-openvpn-versi.patch \ 11 file://0001-configure.ac-eliminate-build-path-from-openvpn-versi.patch \
12 file://0001-tests-skip-test-execution-when-cross-compiling.patch \
12 file://openvpn \ 13 file://openvpn \
13 file://run-ptest \ 14 file://run-ptest \
14 " 15 "
@@ -47,7 +48,7 @@ PACKAGECONFIG[systemd] = "--enable-systemd,--disable-systemd,systemd"
47PACKAGECONFIG[selinux] = "--enable-selinux,--disable-selinux,libselinux" 48PACKAGECONFIG[selinux] = "--enable-selinux,--disable-selinux,libselinux"
48 49
49RDEPENDS:${PN}:append = " bash" 50RDEPENDS:${PN}:append = " bash"
50RDEPENDS:${PN}-ptest:append = " make bash" 51RDEPENDS:${PN}-ptest:append = " bash"
51 52
52do_install:append() { 53do_install:append() {
53 install -d ${D}/${sysconfdir}/init.d 54 install -d ${D}/${sysconfdir}/init.d
@@ -71,21 +72,21 @@ do_install:append() {
71} 72}
72 73
73do_compile_ptest () { 74do_compile_ptest () {
74 for x in `find ${B}/tests/unit_tests -name Makefile -exec grep -l buildtest-TESTS {} \;`; do 75 for x in `find ${B}/tests/unit_tests -name Makefile -exec grep -l check_PROGRAMS {} \;`; do
75 dir=`dirname ${x}` 76 dir=`dirname ${x}`
76 case $dir in 77 case $dir in
77 *example*) 78 *example*)
78 echo "Skipping directory: $dir" 79 echo "Skipping directory: $dir"
79 ;; 80 ;;
80 *) 81 *)
81 oe_runmake -C ${dir} buildtest-TESTS 82 oe_runmake -C ${dir} check-am
82 ;; 83 ;;
83 esac 84 esac
84 done 85 done
85} 86}
86 87
87do_install_ptest() { 88do_install_ptest() {
88 for x in $(find ${B}/tests/unit_tests -name Makefile -exec grep -l buildtest-TESTS {} \;); do 89 for x in $(find ${B}/tests/unit_tests -name Makefile -exec grep -l check_PROGRAMS {} \;); do
89 dir=$(dirname ${x}) 90 dir=$(dirname ${x})
90 91
91 if [[ "$dir" == *example* ]]; then 92 if [[ "$dir" == *example* ]]; then
@@ -94,21 +95,23 @@ do_install_ptest() {
94 95
95 target_dir="${D}/${PTEST_PATH}/unit_tests/$(basename ${dir})" 96 target_dir="${D}/${PTEST_PATH}/unit_tests/$(basename ${dir})"
96 mkdir -p ${target_dir} 97 mkdir -p ${target_dir}
97 cp -f ${dir}/Makefile ${target_dir}/
98 sed -i "s/^Makefile:/MM:/g" ${target_dir}/Makefile
99 sed -i 's/^#TESTS = $(am__EXEEXT_4)/TESTS = $(am__EXEEXT_4)/' ${target_dir}/Makefile
100 98
101 for testfile in $(find ${dir} -name "*testdriver"); do 99 for testfile in $(find ${dir} -name "*testdriver" -type f -executable); do
102 cp -rf ${testfile} ${target_dir}/ 100 cp -rf ${testfile} ${target_dir}/
103 done 101 done
104 done 102 done
105 sed -i 's|find ./|find ${PTEST_PATH}|g' ${D}${PTEST_PATH}/run-ptest 103
104 # Install test input data files needed by user_pass and misc tests
105 cp -rf ${S}/tests/unit_tests/openvpn/input ${D}/${PTEST_PATH}/unit_tests/openvpn/
106
107 # Install COPYRIGHT.GPL needed by test_list
108 # test_list references srcdir/../../../COPYRIGHT.GPL
109 # srcdir=./unit_tests/openvpn -> resolves to ../COPYRIGHT.GPL from ptest cwd
110 # which is ${libdir}/openvpn/COPYRIGHT.GPL
111 cp -f ${S}/COPYRIGHT.GPL ${D}/${libdir}/openvpn/
112
106 sed -i 's|${top_builddir}/src/openvpn|${sbindir}|g' ${S}/tests/t_lpback.sh 113 sed -i 's|${top_builddir}/src/openvpn|${sbindir}|g' ${S}/tests/t_lpback.sh
107 cp -f ${S}/tests/t_lpback.sh ${D}/${PTEST_PATH} 114 cp -f ${S}/tests/t_lpback.sh ${D}/${PTEST_PATH}
108 cp -f ${B}/tests/Makefile ${D}/${PTEST_PATH}
109 sed -i "s/^Makefile:/MM:/g" ${D}/${PTEST_PATH}/Makefile
110 sed -i "s/^test_scripts = t_client.sh t_lpback.sh t_cltsrv.sh/test_scripts = t_lpback.sh/g" ${D}/${PTEST_PATH}/Makefile
111
112} 115}
113 116
114PACKAGES =+ " ${PN}-sample " 117PACKAGES =+ " ${PN}-sample "
@@ -116,6 +119,7 @@ PACKAGES =+ " ${PN}-sample "
116RRECOMMENDS:${PN} = "kernel-module-tun" 119RRECOMMENDS:${PN} = "kernel-module-tun"
117 120
118FILES:${PN}-dbg += "${libdir}/openvpn/plugins/.debug" 121FILES:${PN}-dbg += "${libdir}/openvpn/plugins/.debug"
122FILES:${PN}-ptest += "${libdir}/openvpn/COPYRIGHT.GPL"
119FILES:${PN} += "${systemd_system_unitdir}/openvpn-server@.service \ 123FILES:${PN} += "${systemd_system_unitdir}/openvpn-server@.service \
120 ${systemd_system_unitdir}/openvpn-client@.service \ 124 ${systemd_system_unitdir}/openvpn-client@.service \
121 ${nonarch_libdir}/tmpfiles.d \ 125 ${nonarch_libdir}/tmpfiles.d \