mirror of
git://git.openembedded.org/meta-openembedded
synced 2026-04-02 02:49:12 +00:00
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>
This commit is contained in:
parent
f9a520a6bc
commit
79201ef95e
@ -0,0 +1,34 @@
|
|||||||
|
From 93f7f6ca0c916427d28610d3e263fa556587532d Mon Sep 17 00:00:00 2001
|
||||||
|
From: Haixiao Yan <haixiao.yan.cn@windriver.com>
|
||||||
|
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 <haixiao.yan.cn@windriver.com>
|
||||||
|
---
|
||||||
|
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
|
||||||
|
|
||||||
@ -1,8 +1,20 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
find ./ -name Makefile | while read -r x; do
|
# Run unit tests directly
|
||||||
make -C "$(dirname "${x}")" -k runtest-TESTS | sed \
|
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/^\(\[ OK \].*\)$/PASS: \1/' \
|
||||||
-e 's/^\(\[ FAILED \].*\)$/FAIL: \1/' \
|
-e 's/^\(\[ FAILED \].*\)$/FAIL: \1/' \
|
||||||
-e 's/^\(\[ SKIPPED \].*\)$/SKIP: \1/'
|
-e 's/^\(\[ SKIPPED \].*\)$/SKIP: \1/'
|
||||||
done
|
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
|
||||||
|
|||||||
@ -9,6 +9,7 @@ inherit autotools systemd update-rc.d pkgconfig ptest
|
|||||||
|
|
||||||
SRC_URI = "http://swupdate.openvpn.org/community/releases/${BP}.tar.gz \
|
SRC_URI = "http://swupdate.openvpn.org/community/releases/${BP}.tar.gz \
|
||||||
file://0001-configure.ac-eliminate-build-path-from-openvpn-versi.patch \
|
file://0001-configure.ac-eliminate-build-path-from-openvpn-versi.patch \
|
||||||
|
file://0001-tests-skip-test-execution-when-cross-compiling.patch \
|
||||||
file://openvpn \
|
file://openvpn \
|
||||||
file://run-ptest \
|
file://run-ptest \
|
||||||
"
|
"
|
||||||
@ -47,7 +48,7 @@ PACKAGECONFIG[systemd] = "--enable-systemd,--disable-systemd,systemd"
|
|||||||
PACKAGECONFIG[selinux] = "--enable-selinux,--disable-selinux,libselinux"
|
PACKAGECONFIG[selinux] = "--enable-selinux,--disable-selinux,libselinux"
|
||||||
|
|
||||||
RDEPENDS:${PN}:append = " bash"
|
RDEPENDS:${PN}:append = " bash"
|
||||||
RDEPENDS:${PN}-ptest:append = " make bash"
|
RDEPENDS:${PN}-ptest:append = " bash"
|
||||||
|
|
||||||
do_install:append() {
|
do_install:append() {
|
||||||
install -d ${D}/${sysconfdir}/init.d
|
install -d ${D}/${sysconfdir}/init.d
|
||||||
@ -71,21 +72,21 @@ do_install:append() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
do_compile_ptest () {
|
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}`
|
dir=`dirname ${x}`
|
||||||
case $dir in
|
case $dir in
|
||||||
*example*)
|
*example*)
|
||||||
echo "Skipping directory: $dir"
|
echo "Skipping directory: $dir"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
oe_runmake -C ${dir} buildtest-TESTS
|
oe_runmake -C ${dir} check-am
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
do_install_ptest() {
|
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})
|
dir=$(dirname ${x})
|
||||||
|
|
||||||
if [[ "$dir" == *example* ]]; then
|
if [[ "$dir" == *example* ]]; then
|
||||||
@ -94,21 +95,23 @@ do_install_ptest() {
|
|||||||
|
|
||||||
target_dir="${D}/${PTEST_PATH}/unit_tests/$(basename ${dir})"
|
target_dir="${D}/${PTEST_PATH}/unit_tests/$(basename ${dir})"
|
||||||
mkdir -p ${target_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}/
|
cp -rf ${testfile} ${target_dir}/
|
||||||
done
|
done
|
||||||
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
|
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 ${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 "
|
PACKAGES =+ " ${PN}-sample "
|
||||||
@ -116,6 +119,7 @@ PACKAGES =+ " ${PN}-sample "
|
|||||||
RRECOMMENDS:${PN} = "kernel-module-tun"
|
RRECOMMENDS:${PN} = "kernel-module-tun"
|
||||||
|
|
||||||
FILES:${PN}-dbg += "${libdir}/openvpn/plugins/.debug"
|
FILES:${PN}-dbg += "${libdir}/openvpn/plugins/.debug"
|
||||||
|
FILES:${PN}-ptest += "${libdir}/openvpn/COPYRIGHT.GPL"
|
||||||
FILES:${PN} += "${systemd_system_unitdir}/openvpn-server@.service \
|
FILES:${PN} += "${systemd_system_unitdir}/openvpn-server@.service \
|
||||||
${systemd_system_unitdir}/openvpn-client@.service \
|
${systemd_system_unitdir}/openvpn-client@.service \
|
||||||
${nonarch_libdir}/tmpfiles.d \
|
${nonarch_libdir}/tmpfiles.d \
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user