lldpd: add ptest for lldpd package

Signed-off-by: Xiangyu Chen <xiangyu.chen@eng.windriver.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
This commit is contained in:
Xiangyu Chen 2022-11-11 16:22:00 +08:00 committed by Khem Raj
parent 5192a8bfc3
commit 7fe87bea09
2 changed files with 35 additions and 1 deletions

View File

@ -0,0 +1,16 @@
#!/bin/sh
num_fail=0
for test in tests/check*
do
./"$test" \
&& echo "PASS: $test" \
|| {
echo "FAIL: $test"
num_fail=$(( ${num_fail} + 1))
}
done
exit $num_fail

View File

@ -9,11 +9,12 @@ SRC_URI = "\
http://media.luffy.cx/files/${BPN}/${BPN}-${PV}.tar.gz \
file://lldpd.init.d \
file://lldpd.default \
file://run-ptest \
"
SRC_URI[sha256sum] = "f7fe3a130be98a19c491479ef60f36b8ee41a9e6bc4d7f2c41033f63956a3126"
inherit autotools update-rc.d useradd systemd pkgconfig bash-completion github-releases
inherit autotools update-rc.d useradd systemd pkgconfig bash-completion github-releases ptest
USERADD_PACKAGES = "${PN}"
USERADD_PARAM:${PN} = "--system -g lldpd --shell /bin/false lldpd"
@ -61,3 +62,20 @@ RDEPENDS:${PN} += "os-release"
FILES:${PN}-zsh-completion += "${datadir}/zsh/"
# FIXME: zsh is broken in meta-oe so this cannot be enabled for now
#RDEPENDS:${PN}-zsh-completion += "zsh"
RDEPENDS:${PN}-ptest = "libcheck"
DEPENDS += "${@bb.utils.contains('PTEST_ENABLED', '1', 'libcheck', '', d)}"
TESTDIR = "tests"
do_compile_ptest () {
# hack to remove the call to `make check-TESTS`
sed -i 's/$(MAKE) $(AM_MAKEFLAGS) check-TESTS//g' ${TESTDIR}/Makefile
oe_runmake check
}
do_install_ptest () {
# install the tests
cp -rf ${B}/${TESTDIR} ${D}${PTEST_PATH}
# remove the object files
rm ${D}${PTEST_PATH}/${TESTDIR}/*.o
}