Patchwork [4/4] Add ptest for dbus.

login
register
mail settings
Submitter Björn Stenberg
Date Nov. 22, 2012, 4:02 p.m.
Message ID <1353600120-22967-5-git-send-email-bjst@enea.com>
Download mbox | patch
Permalink /patch/39475/
State New
Headers show

Comments

Björn Stenberg - Nov. 22, 2012, 4:02 p.m.
This patch adds a new recipe dbus-test to build and package the dbus test
suite. The reason for a separate recipe is that the dbus test suite depends
on dbus-glib, so it cannot be compiled at the same time as dbus.

An RDEPENDS rule is added to the dbus recipe to include the dbus-test
package into the image when ptest is enabled, since the standard -ptest
suffix mechanism does not apply to this package.

Signed-off-by: Björn Stenberg <bjst@enea.com>
---
 meta/recipes-core/dbus/dbus-1.6.4/run-ptest        |    3 +
 .../dbus/dbus-1.6.4/test-run-path.patch            |   26 ++++++
 meta/recipes-core/dbus/dbus-test_1.6.4.bb          |   84 ++++++++++++++++++++
 meta/recipes-core/dbus/dbus.inc                    |    3 +
 4 files changed, 116 insertions(+), 0 deletions(-)
 create mode 100755 meta/recipes-core/dbus/dbus-1.6.4/run-ptest
 create mode 100644 meta/recipes-core/dbus/dbus-1.6.4/test-run-path.patch
 create mode 100644 meta/recipes-core/dbus/dbus-test_1.6.4.bb
Otavio Salvador - Nov. 22, 2012, 4:06 p.m.
On Thu, Nov 22, 2012 at 2:02 PM, Björn Stenberg <bjst@enea.com> wrote:
> This patch adds a new recipe dbus-test to build and package the dbus test
> suite. The reason for a separate recipe is that the dbus test suite depends
> on dbus-glib, so it cannot be compiled at the same time as dbus.
>
> An RDEPENDS rule is added to the dbus recipe to include the dbus-test
> package into the image when ptest is enabled, since the standard -ptest
> suffix mechanism does not apply to this package.
>
> Signed-off-by: Björn Stenberg <bjst@enea.com>
...
> @@ -9,6 +9,9 @@ X11DEPENDS = "virtual/libx11 libsm"
>  DEPENDS = "expat virtual/libintl ${@base_contains('DISTRO_FEATURES', 'x11', '${X11DEPENDS}', '', d)}"
>  DEPENDS_class-native = "expat-native virtual/libintl-native"
>  DEPENDS_class-nativesdk = "nativesdk-expat virtual/nativesdk-libintl virtual/libx11"
> +RDEPENDS = "${@base_contains('DISTRO_FEATURES', 'ptest', 'dbus-test', '', d)}"
> +RDEPENDS_class-native = ""

Maybe this could be handled in the native.bbclass?
Richard Purdie - Nov. 23, 2012, 9:46 p.m.
On Thu, 2012-11-22 at 17:02 +0100, Björn Stenberg wrote:
> This patch adds a new recipe dbus-test to build and package the dbus test
> suite. The reason for a separate recipe is that the dbus test suite depends
> on dbus-glib, so it cannot be compiled at the same time as dbus.
> 
> An RDEPENDS rule is added to the dbus recipe to include the dbus-test
> package into the image when ptest is enabled, since the standard -ptest
> suffix mechanism does not apply to this package.

Why not call the recipe dbus-ptest, then the standard logic would work?

Cheers,

Richard

Patch

diff --git a/meta/recipes-core/dbus/dbus-1.6.4/run-ptest b/meta/recipes-core/dbus/dbus-1.6.4/run-ptest
new file mode 100755
index 0000000..e08ecb1
--- /dev/null
+++ b/meta/recipes-core/dbus/dbus-1.6.4/run-ptest
@@ -0,0 +1,3 @@ 
+#!/bin/sh
+cd test
+make -k runtest-TESTS
diff --git a/meta/recipes-core/dbus/dbus-1.6.4/test-run-path.patch b/meta/recipes-core/dbus/dbus-1.6.4/test-run-path.patch
new file mode 100644
index 0000000..5c08c93
--- /dev/null
+++ b/meta/recipes-core/dbus/dbus-1.6.4/test-run-path.patch
@@ -0,0 +1,26 @@ 
+
+
+Signed-off-by: Björn Stenberg <bjst@enea.com>
+Upstream-Status: Pending
+
+--- a/test/Makefile.am	2012-06-15 15:25:43.000000000 +0200
++++ b/test/Makefile.am	2012-11-16 09:24:44.263140840 +0100
+@@ -119,12 +119,13 @@
+ 	DBUS_TEST_HOMEDIR=@abs_top_builddir@/dbus \
+ 	DBUS_TEST_SYSCONFDIR=$(DESTDIR)$(sysconfdir)
+ 
++ptest_run_dir = ..
++
+ TESTS_ENVIRONMENT = \
+-	DBUS_BLOCK_ON_ABORT=1 \
+-	DBUS_FATAL_WARNINGS=1 \
+-	DBUS_TEST_DAEMON=@abs_top_builddir@/bus/dbus-daemon$(EXEEXT) \
+-	DBUS_TEST_DATA=@abs_top_builddir@/test/data \
+-	DBUS_TEST_HOMEDIR=@abs_top_builddir@/dbus \
++	DBUS_FATAL_WARNINGS=0 \
++	DBUS_TEST_DAEMON=$(ptest_run_dir)/bus/dbus-daemon$(EXEEXT) \
++	DBUS_TEST_DATA=$(ptest_run_dir)/test/data \
++	DBUS_TEST_HOMEDIR=$(ptest_run_dir)/dbus \
+ 	$(NULL)
+ 
+ test_corrupt_SOURCES = corrupt.c
diff --git a/meta/recipes-core/dbus/dbus-test_1.6.4.bb b/meta/recipes-core/dbus/dbus-test_1.6.4.bb
new file mode 100644
index 0000000..84829f7
--- /dev/null
+++ b/meta/recipes-core/dbus/dbus-test_1.6.4.bb
@@ -0,0 +1,84 @@ 
+DESCRIPTION = "D-Bus test package, only used for D-bus functionality test."
+HOMEPAGE = "http://dbus.freedesktop.org"
+SECTION = "base"
+LICENSE = "AFL-2 | GPLv2+"
+LIC_FILES_CHKSUM = "file://COPYING;md5=10dded3b58148f3f1fd804b26354af3e \
+                    file://dbus/dbus.h;firstline=6;endline=20;md5=6eea2e0c7750dd8e620dcb1437312fa5"
+
+DEPENDS = "python-pygobject dbus dbus-glib"
+
+SRC_URI = "http://dbus.freedesktop.org/releases/dbus/dbus-${PV}.tar.gz \
+           file://tmpdir.patch \
+           file://test-run-path.patch \
+           file://dbus-1.init  \
+           file://run-ptest \
+           "
+
+S="${WORKDIR}/dbus-${PV}"
+FILESPATH = "${FILE_DIRNAME}/dbus-${PV}"
+
+inherit autotools pkgconfig gettext
+
+EXTRA_OECONF_X = "${@base_contains('DISTRO_FEATURES', 'x11', '--with-x', '--without-x', d)}"
+EXTRA_OECONF_X_virtclass-native = "--without-x"
+
+EXTRA_OECONF = "--enable-tests \
+                --enable-checks \
+                --enable-asserts \
+                --enable-verbose-mode \
+                --disable-xml-docs \
+                --disable-doxygen-docs \
+                --disable-libaudit \
+                --with-xml=expat \
+                --with-systemdsystemunitdir=${systemd_unitdir}/system/ \
+                ${EXTRA_OECONF_X}"
+
+FILES_${PN}-dbg = "\
+                   ${PTEST_PATH}/test/name-test/.debug \
+                   ${PTEST_PATH}/test/.debug \
+                   ${PTEST_PATH}/test/.libs/.debug \
+                   ${PTEST_PATH}/.debug \
+                   ${PTEST_PATH}/bus/.debug \
+                   ${PTEST_PATH}/dbus/.debug \
+                   ${PTEST_PATH}/tools/.debug \
+                   ${PTEST_PATH}/tools/.libs/.debug \
+                   /usr/src \
+                   /usr/src/debug \
+                   /usr/src/debug/${PN}-${PV}/dbus-${PV}/test/name-test/.debug \
+                   /usr/src/debug/${PN}-${PV}/dbus-${PV}/test/.debug \
+                   /usr/src/debug/${PN}-${PV}/dbus-${PV}/test/.libs/.debug \
+                   /usr/src/debug/${PN}-${PV}/dbus-${PV}/.debug \
+                   /usr/src/debug/${PN}-${PV}/dbus-${PV}/bus/.debug \
+                   /usr/src/debug/${PN}-${PV}/dbus-${PV}/tools/.debug \
+                   /usr/src/debug/${PN}-${PV}/dbus-${PV}/tools/.libs/.debug \
+                  "
+
+FILES_${PN}-staticdev = "${PTEST_PATH}/test/.libs \
+                         ${PTEST_PATH}/tools/.libs \
+                        "
+do_install() {
+    mkdir -p ${D}${libdir}/${PN}
+    touch ${D}${libdir}/${PN}/empty_file
+
+    if [ "${PN}" = "${BPN}" -a ${PTEST_ENABLED} = "1" ] ; then
+        mkdir -p ${D}${PTEST_PATH}
+        install -m 0755 ${WORKDIR}/run-ptest ${D}${PTEST_PATH}
+        cp ${S}/Makefile ${D}${PTEST_PATH}
+
+        for subdir in dbus bus tools test doc; do
+            mkdir -p ${D}${PTEST_PATH}/$subdir
+        done
+
+        cp ${S}/bus/bus-test*   ${D}${PTEST_PATH}/bus
+        cp ${S}/bus/dbus-daemon ${D}${PTEST_PATH}/bus
+        cp ${S}/dbus/dbus-test  ${D}${PTEST_PATH}/dbus
+        cp ${S}/tools/.libs/*   ${D}${PTEST_PATH}/tools
+
+        cp -r ${S}/test         ${D}${PTEST_PATH}
+        find ${D}${PTEST_PATH}/test -name "*.[choa]" -o -name "*.la" | xargs rm
+        mv -f ${D}${PTEST_PATH}/test/.libs/* ${D}${PTEST_PATH}/test
+        rm -rf ${D}${PTEST_PATH}/test/.libs
+
+        find ${D}${PTEST_PATH} -name Makefile | xargs sed -i 's/^Makefile:/_Makefile:/'
+    fi
+}
diff --git a/meta/recipes-core/dbus/dbus.inc b/meta/recipes-core/dbus/dbus.inc
index d165cdd..ab7d9f6 100644
--- a/meta/recipes-core/dbus/dbus.inc
+++ b/meta/recipes-core/dbus/dbus.inc
@@ -9,6 +9,9 @@  X11DEPENDS = "virtual/libx11 libsm"
 DEPENDS = "expat virtual/libintl ${@base_contains('DISTRO_FEATURES', 'x11', '${X11DEPENDS}', '', d)}"
 DEPENDS_class-native = "expat-native virtual/libintl-native"
 DEPENDS_class-nativesdk = "nativesdk-expat virtual/nativesdk-libintl virtual/libx11"
+RDEPENDS = "${@base_contains('DISTRO_FEATURES', 'ptest', 'dbus-test', '', d)}"
+RDEPENDS_class-native = ""
+
 
 INC_PR = "r5"