[OE-core] [PATCH] avahi: add ptest

2018-11-08 Thread Stefan Strogin via Openembedded-core
Signed-off-by: Stefan Strogin 
---
 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

diff --git a/meta/recipes-connectivity/avahi/avahi.inc 
b/meta/recipes-connectivity/avahi/avahi.inc
index 11846849f0..b354817d4d 100644
--- a/meta/recipes-connectivity/avahi/avahi.inc
+++ b/meta/recipes-connectivity/avahi/avahi.inc
@@ -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
+}
diff --git a/meta/recipes-connectivity/avahi/avahi_0.7.bb 
b/meta/recipes-connectivity/avahi/avahi_0.7.bb
index 3d5f334a88..6e7767a27b 100644
--- a/meta/recipes-connectivity/avahi/avahi_0.7.bb
+++ b/meta/recipes-connectivity/avahi/avahi_0.7.bb
@@ -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
diff --git a/meta/recipes-connectivity/avahi/files/run-ptest 
b/meta/recipes-connectivity/avahi/files/run-ptest
new file mode 100644
index 00..8b4875d5fd
--- /dev/null
+++ b/meta/recipes-connectivity/avahi/files/run-ptest
@@ -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
-- 
2.19.1

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


Re: [OE-core] [PATCH] avahi: add ptest

2018-11-09 Thread Stefan Strogin via Openembedded-core
Hi Ross,

On 09/11/2018 15:29, Burton, Ross wrote:
> On Thu, 8 Nov 2018 at 09:44, Stefan Strogin via Openembedded-core
>  wrote:
>> +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
-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core