Skip to contentSkip to conversation

Move ptest checks from recipes to ptest.bbclass

PATCH New Björn Stenberg 1 participant 5 messages Mar 6, 2013

lore
Share & tools
lore
#0 lore raw

cover Move ptest checks from recipes to ptest.bbclass

In response to feedback about the ptest checks added to recipes when implementing ptest, I have changed it so those checks now only exist in ptest.bbclass and recipes instead use dedicated _ptest functions to define ptest-specific actions.

Björn Stenberg (4):
ptest: Move ptest checks from recipes to ptest.bbclass
dbus: Use new _ptest functions
glib: Use new _ptest functions
bash: Use new _ptest functions

 meta/classes/ptest.bbclass                    |   35 ++++++++++++++++++++----
 meta/recipes-core/dbus/dbus-ptest_1.6.8.bb    |    4 ++-
 meta/recipes-core/glib-2.0/glib-2.0_2.34.3.bb |    2 -
 meta/recipes-extended/bash/bash.inc           |   15 ++++------
 4 files changed, 38 insertions(+), 18 deletions(-)
Signature · 1 line
1.7.5.4
#1 lore raw

PATCH 1/4 ptest: Move ptest checks from recipes to ptest.bbclass

This patch cleans up ptest implementation in recipes by moving ptest specific code parts into dedicated *_ptest functions.

---
 meta/classes/ptest.bbclass |   35 +++++++++++++++++++++++++++++------
 1 files changed, 29 insertions(+), 6 deletions(-)
meta/classes/ptest.bbclass +29 -6
index 131af7b..6ab5ee4 100644
@@ -23,13 +23,36 @@ FILES_${PN}-dbg += "${PTEST_PATH}/.debug \
                     ${PTEST_PATH}/*/*/*/*/.debug \
                    "
 
-ptest_do_install() {
-    if [ "${PN}" = "${BPN}" -a ${PTEST_ENABLED} = "1" ]; then
-        install -D ${WORKDIR}/run-ptest ${D}${PTEST_PATH}/run-ptest
-        if grep -q install-ptest: Makefile; then
-            oe_runmake DESTDIR=${D}${PTEST_PATH} install-ptest
+do_configure_ptest_base() {
+    if [ ${PTEST_ENABLED} = 1 ]; then
+        if [ type -t do_configure_ptest = function ]; then
+            do_configure_ptest
         fi
     fi
 }
 
-EXPORT_FUNCTIONS ptest_do_install
+do_compile_ptest_base() {
+    if [ ${PTEST_ENABLED} = 1 ]; then
+        if [ type -t do_compile_ptest = function ]; then
+            do_compile_ptest
+        fi
+    fi
+}
+
+do_install_ptest_base() {
+    if [ ${PTEST_ENABLED} = 1 ]; then
+        if [ -f ${WORKDIR}/run-ptest ]; then
+            install -D ${WORKDIR}/run-ptest ${D}${PTEST_PATH}/run-ptest
+            if grep -q install-ptest: Makefile; then
+                oe_runmake DESTDIR=${D}${PTEST_PATH} install-ptest
+            fi
+            if [ type -t do_install_ptest = function ]; then
+                do_install_ptest
+            fi
+        fi
+    fi
+}
+
+addtask configure_ptest_base after do_configure before do_compile
+addtask compile_ptest_base   after do_compile   before do_install
+addtask install_ptest_base   after do_install   before do_package
Signature · 1 line
1.7.5.4
#2 lore raw

PATCH 2/4 dbus: Use new _ptest functions

In reply to Björn Stenberg
---
 meta/recipes-core/dbus/dbus-ptest_1.6.8.bb |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
meta/recipes-core/dbus/dbus-ptest_1.6.8.bb +3 -1
index 1382206..d00819a 100644
@@ -41,6 +41,8 @@ EXTRA_OECONF = "--enable-tests \
                 ${EXTRA_OECONF_X}"
 
 do_install() {
-    ptest_do_install
+}
+
+do_install_ptest() {
     find ${D}${PTEST_PATH} -name Makefile | xargs sed -i 's/^Makefile:/_Makefile:/'
 }
Signature · 1 line
1.7.5.4
#3 lore raw

PATCH 3/4 glib: Use new _ptest functions

In reply to Björn Stenberg
---
 meta/recipes-core/glib-2.0/glib-2.0_2.34.3.bb |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)
meta/recipes-core/glib-2.0/glib-2.0_2.34.3.bb +0 -2
index d58d489..7795524 100644
@@ -60,6 +60,4 @@ do_install_append() {
   if [ -f ${D}${bindir}/glib-mkenums ]; then
     sed -i -e '1s,#!.*perl,#! ${USRBINPATH}/env perl,' ${D}${bindir}/glib-mkenums
   fi
-
-  ptest_do_install
 }
Signature · 1 line
1.7.5.4
#4 lore raw

PATCH 4/4 bash: Use new _ptest functions

In reply to Björn Stenberg
---
 meta/recipes-extended/bash/bash.inc |   15 ++++++---------
 1 files changed, 6 insertions(+), 9 deletions(-)
meta/recipes-extended/bash/bash.inc +6 -9
index 20a23f0..c619f82 100644
@@ -25,10 +25,8 @@ do_configure_prepend () {
 	fi
 }
 
-do_compile_append () {
-        if [ "${PN}" = "${BPN}" -a ${PTEST_ENABLED} = "1" ]; then
-            oe_runmake buildtest
-        fi
+do_compile_ptest () {
+	oe_runmake buildtest
 }
 
 do_install_append () {
@@ -37,12 +35,11 @@ do_install_append () {
 		mkdir -p ${D}${base_bindir}
 		mv ${D}${bindir}/bash ${D}${base_bindir}
 	fi
+}
 
-        if [ "${PN}" = "${BPN}" -a ${PTEST_ENABLED} = "1" ]; then
-            ptest_do_install
-            make INSTALL_TEST_DIR=${D}${PTEST_PATH}/tests install-test
-            cp ${B}/Makefile ${D}${PTEST_PATH}
-        fi
+do_install_ptest () {
+	make INSTALL_TEST_DIR=${D}${PTEST_PATH}/tests install-test
+	cp ${B}/Makefile ${D}${PTEST_PATH}
 }
 
 pkg_postinst_${PN} () {
Signature · 1 line
1.7.5.4