[OE-core] [PATCH] cpan.bbclass: allow running module tests in qemu
Jens Rehsack
sno at netbsd.org
Sat Dec 15 12:59:14 UTC 2018
For quick module tests in 99% a qemu environment is enough. Before
developing ptest deployment, give qemu-test-wrapper a chance.
This is far away from being mergable!
Signed-off-by: Jens Rehsack <sno at netbsd.org>
---
meta/classes/cpan.bbclass | 31 +++++++++++++++++++++++++++++--
1 file changed, 29 insertions(+), 2 deletions(-)
diff --git a/meta/classes/cpan.bbclass b/meta/classes/cpan.bbclass
index 121643eecb..1b6f2fc47f 100644
--- a/meta/classes/cpan.bbclass
+++ b/meta/classes/cpan.bbclass
@@ -1,7 +1,9 @@
#
# This is for perl modules that use the old Makefile.PL build system
#
-inherit cpan-base perlnative
+inherit cpan-base perlnative qemu
+
+DEPENDS += "qemu-native qemu-helper-native perl"
EXTRA_CPANFLAGS ?= ""
EXTRA_PERLFLAGS ?= ""
@@ -28,6 +30,21 @@ cpan_do_configure () {
[ -e Makefile ] || bbfatal "No Makefile was generated by Makefile.PL"
if [ "${BUILD_SYS}" != "${HOST_SYS}" ]; then
+ qemu_binary="${@qemu_wrapper_cmdline(d, '${STAGING_DIR_TARGET}', ['${S}', '${STAGING_DIR_TARGET}/${base_libdir}'])}"
+ cat > ${WORKDIR}/qemu-perl-wrapper << EOF
+#!/bin/sh
+set -x
+unset PERLHOSTLIB
+unset PERLHOSTARCHLIB
+for test in "\$@"
+do
+ test -f \$test || continue
+ $qemu_binary -E PERL5LIB="${PERL_ARCHLIB}:${PERL_LIB}" ${STAGING_DIR_TARGET}/usr/bin/perl -Mblib "\$test"
+done
+EOF
+
+ chmod +x ${WORKDIR}/qemu-perl-wrapper
+
. ${STAGING_LIBDIR}${PERL_OWN_DIR}/perl/config.sh
# Use find since there can be a Makefile generated for each Makefile.PL
for f in `find -name Makefile.PL`; do
@@ -36,6 +53,7 @@ cpan_do_configure () {
sed -i -e "s:\(PERL_ARCHLIB = \).*:\1${PERL_ARCHLIB}:" \
-e 's/perl.real/perl/' \
-e "s|^\(CCFLAGS =.*\)|\1 ${CFLAGS}|" \
+ -e 's,$(FULLPERLRUN) "-MExtUtils::Command::MM".* $(TEST_FILES),$(FULLPERLRUN) $(TEST_FILES),' \
$f2
done
fi
@@ -62,4 +80,13 @@ cpan_do_install () {
done
}
-EXPORT_FUNCTIONS do_configure do_compile do_install
+cpan_do_run_module_tests () {
+ cd ${S}
+ oe_runmake test FULLPERLRUN=${WORKDIR}/qemu-perl-wrapper
+}
+
+addtask do_run_module_tests
+
+do_run_module_tests[depends] += "${PN}:do_compile"
+
+EXPORT_FUNCTIONS do_configure do_compile do_run_module_tests do_install
--
2.17.1
More information about the Openembedded-core
mailing list