Patchwork [3/5] Add ptest for glib.

login
register
mail settings
Submitter Björn Stenberg
Date Dec. 19, 2012, 4:18 p.m.
Message ID <1355933911-48562-4-git-send-email-bjst@enea.com>
Download mbox | patch
Permalink /patch/41345/
State Accepted
Commit dec6f912d68f52748f645b6af411f189cf464f85
Headers show

Comments

Björn Stenberg - Dec. 19, 2012, 4:18 p.m.
Signed-off-by: Björn Stenberg <bjst@enea.com>
---
 .../glib-2.0/glib-2.0/Makefile-ptest.patch         |   61 ++++++++++++++++++++
 meta/recipes-core/glib-2.0/glib-2.0/run-ptest      |    3 +
 meta/recipes-core/glib-2.0/glib-2.0_2.34.3.bb      |   25 +++++++-
 meta/recipes-core/glib-2.0/glib.inc                |    7 +-
 4 files changed, 91 insertions(+), 5 deletions(-)
 create mode 100644 meta/recipes-core/glib-2.0/glib-2.0/Makefile-ptest.patch
 create mode 100644 meta/recipes-core/glib-2.0/glib-2.0/run-ptest

Patch

diff --git a/meta/recipes-core/glib-2.0/glib-2.0/Makefile-ptest.patch b/meta/recipes-core/glib-2.0/glib-2.0/Makefile-ptest.patch
new file mode 100644
index 0000000..cb36c09
--- /dev/null
+++ b/meta/recipes-core/glib-2.0/glib-2.0/Makefile-ptest.patch
@@ -0,0 +1,61 @@ 
+Add 'ptest' target to Makefile, to run tests without checking dependencies.
+Add 'install-ptest' target, to copy needed files to ptest dir.
+
+Signed-off-by: Björn Stenberg <bjst@enea.com>
+Upstream-status: Pending
+---
+ Makefile.decl |   43 +++++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 43 insertions(+)
+
+--- a/Makefile.decl	2012-03-12 01:42:39.000000000 +0100
++++ b/Makefile.decl	2012-11-26 13:42:08.436865192 +0100
+@@ -25,6 +25,49 @@
+ test-nonrecursive:
+ endif
+ 
++ptest: ptest-nonrecursive
++	@ for subdir in $(SUBDIRS) .; do \
++	    test -d "$$subdir" -a "$$subdir" != "." -a "$$subdir" != "po" && \
++	    ( test -d $$subdir && cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $@ ) \
++	  done
++
++ptest-nonrecursive:
++	@test -z "${TEST_PROGS}" || ${GTESTER} --keep-going --verbose ${TEST_PROGS}
++
++install-ptest: install-ptest-nonrecursive
++	@test -z "$(SUBDIRS)" || for subdir in $(SUBDIRS); do \
++	    test "$$subdir" == "." || \
++	    (cd $$subdir && $(MAKE) DESTDIR=$(DESTDIR)/$$subdir $@ ) \
++	done
++
++# install files used for ptest:
++# - copy EXTRA_DIST (for test data in glib/tests)
++# - run dist-hook (for glib/tests/bookmarks/ and glib/tests/markups)
++# - copy TEST_PROGS (the test programs)
++# - copy INSTALL_PROGS (for glib/gtester)
++# - avoid libtool wrappers by copying binaries from .libs
++# - strip Makefile: target from all Makefiles
++install-ptest-nonrecursive:
++	@mkdir -p $(DESTDIR)
++	@if [ -n "${TEST_PROGS}" ]; then \
++		if [ -n "${EXTRA_DIST}" ]; then \
++			cp ${EXTRA_DIST} $(DESTDIR); \
++		fi; \
++		grep -q dist-hook: Makefile && \
++			$(MAKE) distdir=$(DESTDIR) dist-hook; \
++		if [ -d .libs ] ; then \
++			cd .libs; \
++		fi; \
++		cp ${TEST_PROGS} $(DESTDIR); \
++	fi;
++	@if [ -n "${INSTALL_PROGS}" ]; then \
++		if [ -d .libs ]  ; then \
++			cd .libs; \
++		fi; \
++		cp ${INSTALL_PROGS} $(DESTDIR); \
++	fi
++	@test -f Makefile && sed 's/^Makefile:/_Makefile:/' <Makefile >$(DESTDIR)/Makefile
++
+ # test-report: run tests in subdirs and generate report
+ # perf-report: run tests in subdirs with -m perf and generate report
+ # full-report: like test-report: with -m perf and -m slow
diff --git a/meta/recipes-core/glib-2.0/glib-2.0/run-ptest b/meta/recipes-core/glib-2.0/glib-2.0/run-ptest
new file mode 100644
index 0000000..3deb586
--- /dev/null
+++ b/meta/recipes-core/glib-2.0/glib-2.0/run-ptest
@@ -0,0 +1,3 @@ 
+#!/bin/sh
+
+make -k ptest
diff --git a/meta/recipes-core/glib-2.0/glib-2.0_2.34.3.bb b/meta/recipes-core/glib-2.0/glib-2.0_2.34.3.bb
index 966a851..9854585 100644
--- a/meta/recipes-core/glib-2.0/glib-2.0_2.34.3.bb
+++ b/meta/recipes-core/glib-2.0/glib-2.0_2.34.3.bb
@@ -12,6 +12,8 @@  SHRT_VER = "${@d.getVar('PV',1).split('.')[0]}.${@d.getVar('PV',1).split('.')[1]
 SRC_URI = "${GNOME_MIRROR}/glib/${SHRT_VER}/glib-${PV}.tar.xz \
            file://configure-libtool.patch \
            file://glib-2.0_fix_for_x32.patch \
+           file://Makefile-ptest.patch \
+           file://run-ptest \
           "
 SRC_URI[md5sum] = "a4ca31e258273c3761e3de2edd607661"
 SRC_URI[sha256sum] = "855fcbf87cb93065b488358e351774d8a39177281023bae58c286f41612658a7"
@@ -19,6 +21,24 @@  SRC_URI[sha256sum] = "855fcbf87cb93065b488358e351774d8a39177281023bae58c286f4161
 SRC_URI_append_class-native = " file://glib-gettextize-dir.patch"
 BBCLASSEXTEND = "native nativesdk"
 
+RDEPENDS_${PN}-ptest += "\
+            eglibc-gconv-utf-16 \
+            eglibc-charmap-utf-8 \
+            eglibc-gconv-cp1255 \
+            eglibc-charmap-cp1255 \
+            eglibc-gconv-utf-32 \
+            eglibc-gconv-utf-7 \
+            eglibc-charmap-invariant \
+            eglibc-localedata-translit-cjk-variants \
+            tzdata \
+            tzdata-americas \
+            tzdata-asia \
+            tzdata-europe \
+            tzdata-posix \
+            python-pygobject \
+            python-dbus \
+           "
+
 do_configure_prepend() {
 	sed -i -e '1s,#!.*,#!${USRBINPATH}/env python,' ${S}/gio/gdbus-2.0/codegen/gdbus-codegen.in
 }
@@ -28,12 +48,13 @@  do_install_append() {
   rm -f ${D}${libdir}/gdbus-2.0/codegen/*.pyc
   rm -f ${D}${libdir}/gdbus-2.0/codegen/*.pyo
   # and empty dirs
-  rmdir ${D}${libdir}/gio/modules/
-  rmdir ${D}${libdir}/gio/
+  rm -rf ${D}${libdir}/gio
 
   # Some distros have both /bin/perl and /usr/bin/perl, but we set perl location
   # for target as /usr/bin/perl, so fix it to /usr/bin/perl.
   if [ -f ${D}${bindir}/glib-mkenums ]; then
     sed -i -e '1s,#!.*perl,#! ${USRBINPATH}/env perl,' ${D}${bindir}/glib-mkenums
   fi
+
+  ptest_do_install
 }
diff --git a/meta/recipes-core/glib-2.0/glib.inc b/meta/recipes-core/glib-2.0/glib.inc
index bc831e6..53b20b6 100644
--- a/meta/recipes-core/glib-2.0/glib.inc
+++ b/meta/recipes-core/glib-2.0/glib.inc
@@ -21,13 +21,14 @@  PACKAGES =+ "${PN}-utils ${PN}-bash-completion ${PN}-codegen"
 LEAD_SONAME = "libglib-2.0.*"
 FILES_${PN}-utils = "${bindir}/* ${datadir}/glib-2.0/gettext"
 
-inherit autotools gettext gtk-doc pkgconfig
+inherit autotools gettext gtk-doc pkgconfig ptest
 
 S = "${WORKDIR}/glib-${PV}"
 
-CORECONF = "--disable-dtrace --disable-fam --disable-libelf --disable-systemtap --disable-modular-tests"
+CORECONF = "--disable-dtrace --disable-fam --disable-libelf --disable-systemtap"
 
-EXTRA_OECONF = "--enable-included-printf=no ${CORECONF}"
+PTEST_CONF = "${@base_contains('DISTRO_FEATURES', 'ptest', '', '--disable-modular-tests', d)}"
+EXTRA_OECONF = "--enable-included-printf=no ${CORECONF} ${PTEST_CONF}"
 EXTRA_OECONF_class-native = "${CORECONF}"
 EXTRA_OECONF_linuxstdbase = "--enable-included-printf=no ${CORECONF}"