All of lore.kernel.org
 help / color / mirror / Atom feed
From: "André Draszik" <git@andred.net>
To: openembedded-devel@lists.openembedded.org
Subject: [meta-oe][PATCH 2/2] onigurama: enable ptest
Date: Tue,  7 Jan 2020 15:46:59 +0000	[thread overview]
Message-ID: <20200107154659.34711-2-git@andred.net> (raw)
In-Reply-To: <20200107154659.34711-1-git@andred.net>

Signed-off-by: André Draszik <git@andred.net>
---
 ...rial-tests-automake-option-for-ptest.patch | 36 ++++++++++++++
 meta-oe/recipes-support/onig/onig/run-ptest   | 48 +++++++++++++++++++
 meta-oe/recipes-support/onig/onig_6.9.4.bb    | 12 ++++-
 3 files changed, 95 insertions(+), 1 deletion(-)
 create mode 100644 meta-oe/recipes-support/onig/onig/0001-build-enable-serial-tests-automake-option-for-ptest.patch
 create mode 100755 meta-oe/recipes-support/onig/onig/run-ptest

diff --git a/meta-oe/recipes-support/onig/onig/0001-build-enable-serial-tests-automake-option-for-ptest.patch b/meta-oe/recipes-support/onig/onig/0001-build-enable-serial-tests-automake-option-for-ptest.patch
new file mode 100644
index 000000000..587e5ac1b
--- /dev/null
+++ b/meta-oe/recipes-support/onig/onig/0001-build-enable-serial-tests-automake-option-for-ptest.patch
@@ -0,0 +1,36 @@
+From 8bf8189ec4a0d7ee569f66feb0e590e9602c31b6 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Andr=C3=A9=20Draszik?= <git@andred.net>
+Date: Mon, 6 Jan 2020 15:10:30 +0000
+Subject: [PATCH] build: enable serial-tests automake option (for ptest)
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+For ptest, we need to be able to compile the tests without
+running them.
+
+Enabling the serial-tests automake option will add
+buildtest-TESTS and runtest-TESTS makefile targets, the
+former being what we want.
+
+Signed-off-by: André Draszik <git@andred.net>
+---
+ configure.ac | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/configure.ac b/configure.ac
+index ac51e85..48e63ce 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -3,7 +3,7 @@ AC_INIT(onig, 6.9.4)
+ 
+ AC_CONFIG_MACRO_DIR([m4])
+ 
+-AM_INIT_AUTOMAKE([-Wno-portability])
++AM_INIT_AUTOMAKE([-Wno-portability serial-tests])
+ AC_CONFIG_HEADERS([src/config.h])
+ 
+ 
+-- 
+2.23.0.rc1
+
diff --git a/meta-oe/recipes-support/onig/onig/run-ptest b/meta-oe/recipes-support/onig/onig/run-ptest
new file mode 100755
index 000000000..ffc855d61
--- /dev/null
+++ b/meta-oe/recipes-support/onig/onig/run-ptest
@@ -0,0 +1,48 @@
+#!/bin/sh -eu
+
+my_cleanup() {
+    [ -n "${workdir:-}" ] && rm -rf "${workdir}"
+}
+
+trap "my_cleanup" EXIT
+for sig in INT TERM ; do
+    # We want sig to expand right here and now, as it's
+    # a loop variable, not when signalled. For $$ it
+    # doesn't matter.
+    # shellcheck disable=SC2064
+    trap "my_cleanup ; trap - EXIT ; trap - ${sig} ; kill -s ${sig} $$" ${sig}
+done
+
+workdir=$(mktemp -d -t onig.ptest.XXXXXX)
+status="${workdir}/failed"
+touch "${status}"
+
+#find test/.libs -perm -111 -type f -exec sh -c '
+find tests/ -perm -111 -type f -exec sh -c '
+    workdir="${1}"
+    status="${2}"
+    t="${3}"
+    t_log="${workdir}/$(basename ${t}).log"
+
+    res=0
+    ./${t} > "${t_log}" 2>&1 \
+        || res=$?
+    if [ $res -eq 0 ] ; then
+        echo "PASS: ${t}"
+    else
+        echo "FAIL: ${t}"
+        echo "$(basename ${t}): ${t_log}" >> "${status}"
+    fi
+    ' _ "${workdir}" "${status}" {} \;
+
+if [ $(stat -c '%s' "${status}") -ne 0 ] ; then
+    exec >&2
+    while IFS=': ' read -r t t_log ; do
+        printf "\n=========================\n"
+        printf "ERROR: %s:\n" "${t}"
+        printf --  "-------------------------\n"
+        cat "${t_log}"
+    done < "${status}"
+fi
+
+[ $(stat -c '%s' "${status}") -eq 0 ]
diff --git a/meta-oe/recipes-support/onig/onig_6.9.4.bb b/meta-oe/recipes-support/onig/onig_6.9.4.bb
index ce9eab9e8..16a8be5a2 100644
--- a/meta-oe/recipes-support/onig/onig_6.9.4.bb
+++ b/meta-oe/recipes-support/onig/onig_6.9.4.bb
@@ -10,6 +10,8 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=1ee043784bdce7503e619b2d1a85798b"
 SRC_URI = "\
     https://github.com/kkos/oniguruma/releases/download/v${PV}/${BP}.tar.gz \
     file://0001-build-don-t-link-against-host-system-libraries.patch \
+    file://0001-build-enable-serial-tests-automake-option-for-ptest.patch \
+    file://run-ptest \
 "
 
 SRC_URI[md5sum] = "a12d2fe997b789bd87cf63799c091879"
@@ -17,6 +19,14 @@ SRC_URI[sha256sum] = "4669d22ff7e0992a7e93e116161cac9c0949cd8960d1c562982026726f
 
 BINCONFIG = "${bindir}/onig-config"
 
-inherit autotools binconfig-disabled
+inherit autotools binconfig-disabled ptest
 
 BBCLASSEXTEND = "native"
+
+do_compile_ptest() {
+    oe_runmake -C test buildtest-TESTS
+}
+
+do_install_ptest() {
+    install -Dm0755 -t ${D}${PTEST_PATH}/tests/ ${B}/test/.libs/*
+}
-- 
2.23.0.rc1



  reply	other threads:[~2020-01-07 15:47 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-07 15:46 [meta-oe][PATCH 1/2] onigurama: update to v6.9.4 André Draszik
2020-01-07 15:46 ` André Draszik [this message]
2020-01-07 16:04   ` [meta-oe][PATCH 2/2 v2] onigurama: enable ptest André Draszik
2020-01-08  8:56     ` [meta-oe][PATCH 2/2 v3] oniguruma: " André Draszik
2020-01-08  9:00       ` André Draszik
2020-01-08  8:55 ` [meta-oe][PATCH 1/2 v2] oniguruma: update to v6.9.4 André Draszik
2020-01-08  9:00   ` André Draszik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200107154659.34711-2-git@andred.net \
    --to=git@andred.net \
    --cc=openembedded-devel@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.