Skip to contentSkip to conversation

avahi: add ptest

PATCH In review Stefan Strogin 2 participants 3 messages Nov 8, 2018 – Nov 9, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 avahi: add ptest

---
 meta/recipes-connectivity/avahi/avahi.inc       | 15 ++++++++++++++-
 meta/recipes-connectivity/avahi/avahi_0.7.bb    |  1 +
 meta/recipes-connectivity/avahi/files/run-ptest | 13 +++++++++++++
 3 files changed, 28 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-connectivity/avahi/files/run-ptest
meta/recipes-connectivity/avahi/avahi.inc +14 -1
index 11846849f0..b354817d4d 100644
@@ -35,7 +35,7 @@ PACKAGECONFIG[dbus] = "--enable-dbus,--disable-dbus,dbus"
 PACKAGECONFIG[gtk] = "--enable-gtk,--disable-gtk,gtk+"
 PACKAGECONFIG[gtk3] = "--enable-gtk3,--disable-gtk3,gtk+3"
 
-inherit autotools pkgconfig gettext gobject-introspection
+inherit autotools pkgconfig gettext gobject-introspection ptest
 
 EXTRA_OECONF = "--with-avahi-priv-access-group=adm \
              --disable-stack-protector \
@@ -49,11 +49,13 @@ EXTRA_OECONF = "--with-avahi-priv-access-group=adm \
              --enable-manpages \
              ${EXTRA_OECONF_SYSVINIT} \
              ${EXTRA_OECONF_SYSTEMD} \
+             ${EXTRA_OECONF_PTEST} \
            "
 
 # The distro choice determines what init scripts are installed
 EXTRA_OECONF_SYSVINIT = "${@bb.utils.contains('DISTRO_FEATURES','sysvinit','--with-distro=debian','--with-distro=none',d)}"
 EXTRA_OECONF_SYSTEMD = "${@bb.utils.contains('DISTRO_FEATURES','systemd','--with-systemdsystemunitdir=${systemd_unitdir}/system/','--without-systemdsystemunitdir',d)}"
+EXTRA_OECONF_PTEST = "${@bb.utils.contains('PTEST_ENABLED','1','--enable-tests','',d)}"
 
 do_configure_prepend() {
     sed 's:AM_CHECK_PYMOD:echo "no pymod" #AM_CHECK_PYMOD:g' -i ${S}/configure.ac
@@ -66,6 +68,7 @@ do_compile_prepend() {
     export GIR_EXTRA_LIBS_PATH="${B}/avahi-gobject/.libs:${B}/avahi-common/.libs:${B}/avahi-client/.libs:${B}/avahi-glib/.libs"
 }
 
+RDEPENDS_${PN}-ptest = "bash"
 RRECOMMENDS_${PN}_append_libc-glibc = " libnss-mdns"
 
 do_install() {
@@ -75,3 +78,13 @@ do_install() {
 	test -d ${D}${datadir}/dbus-1 && rmdir --ignore-fail-on-non-empty ${D}${datadir}/dbus-1
 	rm -rf ${D}${libdir}/avahi
 }
+
+do_install_ptest () {
+    install -d ${D}${PTEST_PATH}/test/.libs
+    for t in dns-spin-test dns-test hashmap-test
+    do
+        install -m 0755 ${B}/avahi-core/$t ${D}${PTEST_PATH}/test/
+        sed -e 's/^relink_command=\"\(.*\)\"/relink_command=\"\"/' -i ${D}${PTEST_PATH}/test/$t
+        install -m 0755 ${B}/avahi-core/.libs/$t ${D}${PTEST_PATH}/test/.libs/lt-$t
+    done
+}
meta/recipes-connectivity/avahi/avahi_0.7.bb +1 -0
index 3d5f334a88..6e7767a27b 100644
@@ -4,6 +4,7 @@ SRC_URI += "file://00avahi-autoipd \
            file://99avahi-autoipd \
            file://initscript.patch \
            file://0001-Fix-opening-etc-resolv.conf-error.patch \
+           file://run-ptest \
            "
 
 inherit update-rc.d systemd useradd
meta/recipes-connectivity/avahi/files/run-ptest new file +13 -0
new file mode 100644
index 0000000000..8b4875d5fd
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+cd ./test
+for t in *
+do
+	./$t
+	if [ $? -eq 0 ]
+	then
+		echo "PASS: $t"
+	else
+		echo "FAIL: $t"
+	fi
+done
Signature · 1 line
2.19.1
#1 lore raw

meta/recipes-connectivity/avahi/avahi.inc do_install() { · line 90

Quoted 9 lines · Stefan Strogin via Openembedded-core
meta/recipes-connectivity/avahi/avahi.inc +9 -0
+do_install_ptest () {
+    install -d ${D}${PTEST_PATH}/test/.libs
+    for t in dns-spin-test dns-test hashmap-test
+    do
+        install -m 0755 ${B}/avahi-core/$t ${D}${PTEST_PATH}/test/
+        sed -e 's/^relink_command=\"\(.*\)\"/relink_command=\"\"/' -i ${D}${PTEST_PATH}/test/$t
+        install -m 0755 ${B}/avahi-core/.libs/$t ${D}${PTEST_PATH}/test/.libs/lt-$t
+    done
+}

Whilst I really do want to see more test suites, is this really a useful test suite? hashmap-test is a validation that the hash implementation works, dns-test is low-level parsing, and dns-spin-test is basically a way to verify an Avahi bug doesn't regress. This isn't exactly a full-featured test suite that creates services, ensures they're browsable, enumerate stuff, etc.

Ross

#2 lore raw

Hi Ross,

Quoted 18 lines · Ross

meta/recipes-connectivity/avahi/avahi.inc do_install() { · line 90

Quoted 9 lines · Stefan Strogin via Openembedded-core
meta/recipes-connectivity/avahi/avahi.inc +9 -0
+do_install_ptest () {
+    install -d ${D}${PTEST_PATH}/test/.libs
+    for t in dns-spin-test dns-test hashmap-test
+    do
+        install -m 0755 ${B}/avahi-core/$t ${D}${PTEST_PATH}/test/
+        sed -e 's/^relink_command=\"\(.*\)\"/relink_command=\"\"/' -i ${D}${PTEST_PATH}/test/$t
+        install -m 0755 ${B}/avahi-core/.libs/$t ${D}${PTEST_PATH}/test/.libs/lt-$t
+    done
+}

Whilst I really do want to see more test suites, is this really a useful test suite? hashmap-test is a validation that the hash implementation works, dns-test is low-level parsing, and dns-spin-test is basically a way to verify an Avahi bug doesn't regress. This isn't exactly a full-featured test suite that creates services, ensures they're browsable, enumerate stuff, etc.

Thanks for the good comment. In our distro we also want to cover with tests as many packages as possible. There are more tests in avahi source code like avahi-test, conformance-test, querier-test, update-test...

Unfortunately the test suite is not documented at all (at least I couldn't find any documentation on them), and I'm not very familiar with Avahi API and the source code.
Some of the tests in case of success seem to run in an infinite loop, and exit only in case of error. So I couldn't include them into the recipe. Maybe the tests need to be patched [upstream].
I began to investigate it but unfortunately didn't have time, and now I have some more urgent tasks. So I added only those tests in which I'm sure, perhaps it's too few.
I hope to add more tests some day, or somebody else will be able to do it.

--
Stefan