All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/7] Enable easier ptest of perl modules
@ 2018-03-04 12:41 Tim Orling
  2018-03-04 12:41 ` [PATCH 1/7] meta/classes: add ptest-perl.bbclass Tim Orling
                   ` (6 more replies)
  0 siblings, 7 replies; 10+ messages in thread
From: Tim Orling @ 2018-03-04 12:41 UTC (permalink / raw)
  To: openembedded-core

We need run-time testing in order to ensure recipe quality and
automating this is easiest with ptest.

* Add a new ptest-perl.bbclass which:
  - copies tests that almost all perl modules will have in t/ to PTEST_PATH
  - uses a common run-ptest script (from meta-perl recipes)
  - runs install_ptest_perl task after install_ptest
    = checks that run-ptest is not already present

For many perl recipes, using this class will be as simple as:
"inherit ptest-perl"

To run the tests, follow the ptest instructions in the dev-manual [1] and
then run "ptest-runner libfoo-perl" on target.

Tested on qemux86 with all oe-core lib*-perl recipes with no failures.

[1] http://www.yoctoproject.org/docs/current/dev-manual/dev-manual.html#testing-packages-with-ptest

The following changes since commit 8e4ece7bf0b09275a34ce8e7cc3e1e54a366c361:

  glibc: Enable static PIE support when security_flags are enabled (2018-03-01 22:18:00 +0000)

are available in the Git repository at:

  git://git.openembedded.org/openembedded-core-contrib timo/ptest-perl
  http://cgit.openembedded.org//log/?h=timo/ptest-perl

Tim Orling (7):
  meta/classes: add ptest-perl.bbclass
  libtest-needs-perl: add 0.002005
  liberror-perl: inherit ptest-perl
  liburi-perl: inherit ptest-perl
  libxml-parser-perl: inherit ptest-perl
  libxml-perl: inherit ptest-perl
  libxml-simple-perl: inherit ptest-perl

 meta/classes/ptest-perl.bbclass                    | 30 ++++++++++++++++++++++
 meta/files/ptest-perl/run-ptest                    | 16 ++++++++++++
 .../recipes-devtools/perl/liberror-perl_0.17025.bb |  7 ++++-
 .../perl/libtest-needs-perl_0.002005.bb            | 29 +++++++++++++++++++++
 meta/recipes-devtools/perl/liburi-perl_1.73.bb     | 10 +++++++-
 .../perl/libxml-parser-perl_2.44.bb                | 11 +++++++-
 meta/recipes-devtools/perl/libxml-perl_0.08.bb     |  2 +-
 .../perl/libxml-simple-perl_2.24.bb                |  2 +-
 8 files changed, 102 insertions(+), 5 deletions(-)
 create mode 100644 meta/classes/ptest-perl.bbclass
 create mode 100644 meta/files/ptest-perl/run-ptest
 create mode 100644 meta/recipes-devtools/perl/libtest-needs-perl_0.002005.bb

-- 
2.14.3



^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 1/7] meta/classes: add ptest-perl.bbclass
  2018-03-04 12:41 [PATCH 0/7] Enable easier ptest of perl modules Tim Orling
@ 2018-03-04 12:41 ` Tim Orling
  2018-03-04 12:41 ` [PATCH 2/7] libtest-needs-perl: add 0.002005 Tim Orling
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 10+ messages in thread
From: Tim Orling @ 2018-03-04 12:41 UTC (permalink / raw)
  To: openembedded-core

* Enable easier testing of perl modules
  - Installs t/* to PTEST_PATH
  - Uses common run-ptest script

Signed-off-by: Tim Orling <timothy.t.orling@linux.intel.com>
---
 meta/classes/ptest-perl.bbclass | 30 ++++++++++++++++++++++++++++++
 meta/files/ptest-perl/run-ptest | 16 ++++++++++++++++
 2 files changed, 46 insertions(+)
 create mode 100644 meta/classes/ptest-perl.bbclass
 create mode 100644 meta/files/ptest-perl/run-ptest

diff --git a/meta/classes/ptest-perl.bbclass b/meta/classes/ptest-perl.bbclass
new file mode 100644
index 0000000000..a4bc40b51a
--- /dev/null
+++ b/meta/classes/ptest-perl.bbclass
@@ -0,0 +1,30 @@
+inherit ptest
+
+FILESEXTRAPATHS_prepend := "${COREBASE}/meta/files:"
+
+SRC_URI += "file://ptest-perl/run-ptest"
+
+do_install_ptest_perl() {
+	install -d ${D}${PTEST_PATH}
+	if [ ! -f ${D}${PTEST_PATH}/run-ptest ]; then
+		install -m 0755 ${WORKDIR}/ptest-perl/run-ptest ${D}${PTEST_PATH}
+	fi
+	cp -r ${B}/t ${D}${PTEST_PATH}
+	chown -R root:root ${D}${PTEST_PATH}
+}
+
+FILES_${PN}-ptest_prepend = "${PTEST_PATH}/t/* ${PTEST_PATH}/run-ptest "
+
+RDEPENDS_${PN}-ptest_prepend = "perl "
+
+addtask install_ptest_perl after do_install_ptest_base before do_package
+
+python () {
+    if not bb.data.inherits_class('native', d) and not bb.data.inherits_class('cross', d):
+        d.setVarFlag('do_install_ptest_perl', 'fakeroot', '1')
+
+    # Remove all '*ptest_perl' tasks when ptest is not enabled
+    if not(d.getVar('PTEST_ENABLED') == "1"):
+        for i in ['do_install_ptest_perl']:
+            bb.build.deltask(i, d)
+}
diff --git a/meta/files/ptest-perl/run-ptest b/meta/files/ptest-perl/run-ptest
new file mode 100644
index 0000000000..c9f9ca94d0
--- /dev/null
+++ b/meta/files/ptest-perl/run-ptest
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+for case in `find t -type f -name '*.t'`; do
+    perl $case >$case.output 2>&1
+    ret=$?
+    cat $case.output
+    if [ $ret -ne 0 ]; then
+        echo "FAIL: ${case%.t}"
+    elif grep -i 'SKIP' $case.output; then
+        echo "SKIP: ${case%.t}"
+    else
+        echo "PASS: ${case%.t}"
+    fi
+
+    rm -f $case.output
+done
-- 
2.14.3



^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 2/7] libtest-needs-perl: add 0.002005
  2018-03-04 12:41 [PATCH 0/7] Enable easier ptest of perl modules Tim Orling
  2018-03-04 12:41 ` [PATCH 1/7] meta/classes: add ptest-perl.bbclass Tim Orling
@ 2018-03-04 12:41 ` Tim Orling
  2018-03-04 17:24   ` Richard Purdie
  2018-03-04 12:41 ` [PATCH 3/7] liberror-perl: inherit ptest-perl Tim Orling
                   ` (4 subsequent siblings)
  6 siblings, 1 reply; 10+ messages in thread
From: Tim Orling @ 2018-03-04 12:41 UTC (permalink / raw)
  To: openembedded-core

Skip tests when modules not available

* Dependency for ptest of liburi-perl

Signed-off-by: Tim Orling <timothy.t.orling@linux.intel.com>
---
 .../perl/libtest-needs-perl_0.002005.bb            | 29 ++++++++++++++++++++++
 1 file changed, 29 insertions(+)
 create mode 100644 meta/recipes-devtools/perl/libtest-needs-perl_0.002005.bb

diff --git a/meta/recipes-devtools/perl/libtest-needs-perl_0.002005.bb b/meta/recipes-devtools/perl/libtest-needs-perl_0.002005.bb
new file mode 100644
index 0000000000..e5ab7a33c7
--- /dev/null
+++ b/meta/recipes-devtools/perl/libtest-needs-perl_0.002005.bb
@@ -0,0 +1,29 @@
+SUMMARY = "Skip tests when modules not available"
+DESCRIPTION = "Skip test scripts if modules are not available. \
+The requested modules will be loaded, and optionally have their versions \
+checked. If the module is missing, the test script will be skipped. Modules \
+that are found but fail to compile will exit with an error rather than skip."
+
+HOMEPAGE = "https://metacpan.org/release/Test-Needs"
+SECTION = "libs"
+LICENSE = "Artistic-1.0 | GPL-1.0+"
+
+CPAN_NAME = "Test-Needs"
+CPAN_AUTHOR = "HAARG"
+
+LIC_FILES_CHKSUM = "file://README;md5=3f3ccd21a0a48aa313db212cc3b1bc09;beginline=81;endline=82"
+
+DEPENDS += "perl"
+
+SRC_URI = "http://www.cpan.org/authors/id/H/HA/${CPAN_AUTHOR}/${CPAN_NAME}-${PV}.tar.gz"
+
+SRC_URI[md5sum] = "356634a56c99282e8059f290f5d534c8"
+SRC_URI[sha256sum] = "5a4f33983586edacdbe00a3b429a9834190140190dab28d0f873c394eb7df399"
+
+S = "${WORKDIR}/${CPAN_NAME}-${PV}"
+
+inherit cpan ptest-perl
+
+RDEPENDS_${PN}-ptest += "perl-module-test-more"
+
+BBCLASSEXTEND = "native"
-- 
2.14.3



^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 3/7] liberror-perl: inherit ptest-perl
  2018-03-04 12:41 [PATCH 0/7] Enable easier ptest of perl modules Tim Orling
  2018-03-04 12:41 ` [PATCH 1/7] meta/classes: add ptest-perl.bbclass Tim Orling
  2018-03-04 12:41 ` [PATCH 2/7] libtest-needs-perl: add 0.002005 Tim Orling
@ 2018-03-04 12:41 ` Tim Orling
  2018-03-04 12:41 ` [PATCH 4/7] liburi-perl: " Tim Orling
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 10+ messages in thread
From: Tim Orling @ 2018-03-04 12:41 UTC (permalink / raw)
  To: openembedded-core

* Enable ptest by inheriting new ptest-perl.bbclass

Signed-off-by: Tim Orling <timothy.t.orling@linux.intel.com>
---
 meta/recipes-devtools/perl/liberror-perl_0.17025.bb | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/meta/recipes-devtools/perl/liberror-perl_0.17025.bb b/meta/recipes-devtools/perl/liberror-perl_0.17025.bb
index 251b13195a..f6dc30d077 100644
--- a/meta/recipes-devtools/perl/liberror-perl_0.17025.bb
+++ b/meta/recipes-devtools/perl/liberror-perl_0.17025.bb
@@ -18,11 +18,16 @@ SRC_URI[sha256sum] = "6c9f474ad3d4fe0cabff6b6be532cb1dd348245986d4a6b600ad921d5c
 
 S = "${WORKDIR}/Error-${PV}"
 
-inherit cpan
+inherit cpan ptest-perl
 
 do_compile() {
 	export LIBC="$(find ${STAGING_DIR_TARGET}/${base_libdir}/ -name 'libc-*.so')"
 	cpan_do_compile
 }
 
+do_install_prepend() {
+	# test requires "-T" (taint) command line option
+	rm -rf ${B}/t/pod-coverage.t
+}
+
 BBCLASSEXTEND = "native"
-- 
2.14.3



^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 4/7] liburi-perl: inherit ptest-perl
  2018-03-04 12:41 [PATCH 0/7] Enable easier ptest of perl modules Tim Orling
                   ` (2 preceding siblings ...)
  2018-03-04 12:41 ` [PATCH 3/7] liberror-perl: inherit ptest-perl Tim Orling
@ 2018-03-04 12:41 ` Tim Orling
  2018-03-04 12:41 ` [PATCH 5/7] libxml-parser-perl: " Tim Orling
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 10+ messages in thread
From: Tim Orling @ 2018-03-04 12:41 UTC (permalink / raw)
  To: openembedded-core

* Enable ptest by inheriting new ptest-perl.bbclass
* Remove t/cwd.t and t/file.t which require "-T"
  (taint) command line option as they will fail.

Signed-off-by: Tim Orling <timothy.t.orling@linux.intel.com>
---
 meta/recipes-devtools/perl/liburi-perl_1.73.bb | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/meta/recipes-devtools/perl/liburi-perl_1.73.bb b/meta/recipes-devtools/perl/liburi-perl_1.73.bb
index 7cdf6dc61d..49238f3df5 100644
--- a/meta/recipes-devtools/perl/liburi-perl_1.73.bb
+++ b/meta/recipes-devtools/perl/liburi-perl_1.73.bb
@@ -20,11 +20,19 @@ S = "${WORKDIR}/URI-${PV}"
 
 EXTRA_CPANFLAGS = "EXPATLIBPATH=${STAGING_LIBDIR} EXPATINCPATH=${STAGING_INCDIR}"
 
-inherit cpan
+inherit cpan ptest-perl
 
 do_compile() {
 	export LIBC="$(find ${STAGING_DIR_TARGET}/${base_libdir}/ -name 'libc-*.so')"
 	cpan_do_compile
 }
 
+do_install_prepend() {
+	# these tests require "-T" (taint) command line option
+	rm -rf ${B}/t/cwd.t
+	rm -rf ${B}/t/file.t
+}
+
+RDEPENDS_${PN}-ptest += "libtest-needs-perl"
+
 BBCLASSEXTEND = "native"
-- 
2.14.3



^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 5/7] libxml-parser-perl: inherit ptest-perl
  2018-03-04 12:41 [PATCH 0/7] Enable easier ptest of perl modules Tim Orling
                   ` (3 preceding siblings ...)
  2018-03-04 12:41 ` [PATCH 4/7] liburi-perl: " Tim Orling
@ 2018-03-04 12:41 ` Tim Orling
  2018-03-04 12:41 ` [PATCH 6/7] libxml-perl: " Tim Orling
  2018-03-04 12:41 ` [PATCH 7/7] libxml-simple-perl: " Tim Orling
  6 siblings, 0 replies; 10+ messages in thread
From: Tim Orling @ 2018-03-04 12:41 UTC (permalink / raw)
  To: openembedded-core

* Enable ptest by inheriting new ptest-perl.bbclass

Signed-off-by: Tim Orling <timothy.t.orling@linux.intel.com>
---
 meta/recipes-devtools/perl/libxml-parser-perl_2.44.bb | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/meta/recipes-devtools/perl/libxml-parser-perl_2.44.bb b/meta/recipes-devtools/perl/libxml-parser-perl_2.44.bb
index cc3a660f7d..c5e0ae6769 100644
--- a/meta/recipes-devtools/perl/libxml-parser-perl_2.44.bb
+++ b/meta/recipes-devtools/perl/libxml-parser-perl_2.44.bb
@@ -14,7 +14,7 @@ S = "${WORKDIR}/XML-Parser-${PV}"
 
 EXTRA_CPANFLAGS = "EXPATLIBPATH=${STAGING_LIBDIR} EXPATINCPATH=${STAGING_INCDIR} CC='${CC}' LD='${CCLD}' FULL_AR='${AR}'"
 
-inherit cpan
+inherit cpan ptest-perl
 
 # fix up sub MakeMaker project as arguments don't get propagated though
 # see https://rt.cpan.org/Public/Bug/Display.html?id=28632
@@ -34,4 +34,13 @@ do_compile_class-native() {
 	cpan_do_compile
 }
 
+do_install_ptest() {
+	sed -i -e "s:/usr/local/bin/perl:/usr/bin/perl:g" ${B}/samples/xmlstats
+	sed -i -e "s:/usr/local/bin/perl:/usr/bin/perl:g" ${B}/samples/xmlfilter
+	sed -i -e "s:/usr/local/bin/perl:/usr/bin/perl:g" ${B}/samples/xmlcomments
+	sed -i -e "s:/usr/local/bin/perl:/usr/bin/perl:g" ${B}/samples/canonical
+	cp -r ${B}/samples ${D}${PTEST_PATH}
+	chown -R root:root ${D}${PTEST_PATH}/samples
+}
+
 BBCLASSEXTEND="native nativesdk"
-- 
2.14.3



^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 6/7] libxml-perl: inherit ptest-perl
  2018-03-04 12:41 [PATCH 0/7] Enable easier ptest of perl modules Tim Orling
                   ` (4 preceding siblings ...)
  2018-03-04 12:41 ` [PATCH 5/7] libxml-parser-perl: " Tim Orling
@ 2018-03-04 12:41 ` Tim Orling
  2018-03-04 12:41 ` [PATCH 7/7] libxml-simple-perl: " Tim Orling
  6 siblings, 0 replies; 10+ messages in thread
From: Tim Orling @ 2018-03-04 12:41 UTC (permalink / raw)
  To: openembedded-core

* Enable ptest by inheriting new ptest-perl.bbclass

Signed-off-by: Tim Orling <timothy.t.orling@linux.intel.com>
---
 meta/recipes-devtools/perl/libxml-perl_0.08.bb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/recipes-devtools/perl/libxml-perl_0.08.bb b/meta/recipes-devtools/perl/libxml-perl_0.08.bb
index 047842704f..0f6099868a 100644
--- a/meta/recipes-devtools/perl/libxml-perl_0.08.bb
+++ b/meta/recipes-devtools/perl/libxml-perl_0.08.bb
@@ -19,7 +19,7 @@ SRC_URI[sha256sum] = "4571059b7b5d48b7ce52b01389e95d798bf5cf2020523c153ff27b4981
 
 EXTRA_CPANFLAGS = "EXPATLIBPATH=${STAGING_LIBDIR} EXPATINCPATH=${STAGING_INCDIR}"
 
-inherit cpan
+inherit cpan ptest-perl
 
 do_compile() {
 	export LIBC="$(find ${STAGING_DIR_TARGET}/${base_libdir}/ -name 'libc-*.so')"
-- 
2.14.3



^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 7/7] libxml-simple-perl: inherit ptest-perl
  2018-03-04 12:41 [PATCH 0/7] Enable easier ptest of perl modules Tim Orling
                   ` (5 preceding siblings ...)
  2018-03-04 12:41 ` [PATCH 6/7] libxml-perl: " Tim Orling
@ 2018-03-04 12:41 ` Tim Orling
  6 siblings, 0 replies; 10+ messages in thread
From: Tim Orling @ 2018-03-04 12:41 UTC (permalink / raw)
  To: openembedded-core

* Enable ptest by inheriting new ptest-perl.bbclass

Signed-off-by: Tim Orling <timothy.t.orling@linux.intel.com>
---
 meta/recipes-devtools/perl/libxml-simple-perl_2.24.bb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/recipes-devtools/perl/libxml-simple-perl_2.24.bb b/meta/recipes-devtools/perl/libxml-simple-perl_2.24.bb
index 0cf2eebda4..f9d00d2e28 100644
--- a/meta/recipes-devtools/perl/libxml-simple-perl_2.24.bb
+++ b/meta/recipes-devtools/perl/libxml-simple-perl_2.24.bb
@@ -19,6 +19,6 @@ S = "${WORKDIR}/XML-Simple-${PV}"
 
 EXTRA_PERLFLAGS = "-I ${PERLHOSTLIB}"
 
-inherit cpan
+inherit cpan ptest-perl
 
 BBCLASSEXTEND = "native"
-- 
2.14.3



^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/7] libtest-needs-perl: add 0.002005
  2018-03-04 12:41 ` [PATCH 2/7] libtest-needs-perl: add 0.002005 Tim Orling
@ 2018-03-04 17:24   ` Richard Purdie
  2018-03-04 22:55     ` Tim Orling
  0 siblings, 1 reply; 10+ messages in thread
From: Richard Purdie @ 2018-03-04 17:24 UTC (permalink / raw)
  To: Tim Orling, openembedded-core

On Sun, 2018-03-04 at 04:41 -0800, Tim Orling wrote:
> Skip tests when modules not available
> 
> * Dependency for ptest of liburi-perl
> 
> Signed-off-by: Tim Orling <timothy.t.orling@linux.intel.com>
> ---
>  .../perl/libtest-needs-perl_0.002005.bb            | 29
> ++++++++++++++++++++++
>  1 file changed, 29 insertions(+)
>  create mode 100644 meta/recipes-devtools/perl/libtest-needs-
> perl_0.002005.bb

Can you send a patch to fix:

https://autobuilder.yocto.io/builders/nightly-oe-
selftest/builds/878/steps/Running%20oe-selftest/logs/stdio

i.e. 

oe-selftest -r distrodata.Distrodata.test_maintainers

please? (missing maintainers entry for libtest-needs-perl)

Cheers,

Richard







^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/7] libtest-needs-perl: add 0.002005
  2018-03-04 17:24   ` Richard Purdie
@ 2018-03-04 22:55     ` Tim Orling
  0 siblings, 0 replies; 10+ messages in thread
From: Tim Orling @ 2018-03-04 22:55 UTC (permalink / raw)
  To: Richard Purdie; +Cc: openembedded-core


> On Mar 4, 2018, at 9:24 AM, Richard Purdie <richard.purdie@linuxfoundation.org> wrote:
> 
> On Sun, 2018-03-04 at 04:41 -0800, Tim Orling wrote:
>> Skip tests when modules not available
>> 
>> * Dependency for ptest of liburi-perl
>> 
>> Signed-off-by: Tim Orling <timothy.t.orling@linux.intel.com>
>> ---
>>  .../perl/libtest-needs-perl_0.002005.bb            | 29
>> ++++++++++++++++++++++
>>  1 file changed, 29 insertions(+)
>>  create mode 100644 meta/recipes-devtools/perl/libtest-needs-
>> perl_0.002005.bb
> 
> Can you send a patch to fix:
> 
> https://autobuilder.yocto.io/builders/nightly-oe-
> selftest/builds/878/steps/Running%20oe-selftest/logs/stdio
> 
> i.e. 
> 
> oe-selftest -r distrodata.Distrodata.test_maintainers
> 
> please? (missing maintainers entry for libtest-needs-perl)
> 

That’s what I get for submitting at 5 am. Details. Yes, I will send a patch to self-assign libtest-needs-perl and take over maintainership of all the libfoo-perl in oe-core (if there are no objections).

> Cheers,
> 
> Richard
> 
> 
> 
> 
> 



^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2018-03-04 22:55 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-04 12:41 [PATCH 0/7] Enable easier ptest of perl modules Tim Orling
2018-03-04 12:41 ` [PATCH 1/7] meta/classes: add ptest-perl.bbclass Tim Orling
2018-03-04 12:41 ` [PATCH 2/7] libtest-needs-perl: add 0.002005 Tim Orling
2018-03-04 17:24   ` Richard Purdie
2018-03-04 22:55     ` Tim Orling
2018-03-04 12:41 ` [PATCH 3/7] liberror-perl: inherit ptest-perl Tim Orling
2018-03-04 12:41 ` [PATCH 4/7] liburi-perl: " Tim Orling
2018-03-04 12:41 ` [PATCH 5/7] libxml-parser-perl: " Tim Orling
2018-03-04 12:41 ` [PATCH 6/7] libxml-perl: " Tim Orling
2018-03-04 12:41 ` [PATCH 7/7] libxml-simple-perl: " Tim Orling

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.