new file mode 100755
@@ -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
@@ -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
+}
Signed-off-by: Xiangyu Chen <xiangyu.chen@eng.windriver.com> --- .../recipes-daemons/lldpd/files/run-ptest | 16 +++++++++++++++ .../recipes-daemons/lldpd/lldpd_1.0.15.bb | 20 ++++++++++++++++++- 2 files changed, 35 insertions(+), 1 deletion(-) create mode 100755 meta-networking/recipes-daemons/lldpd/files/run-ptest