Skip to contentSkip to conversation

libpcre2: Enabling Ptest support

PATCH In review Shaik Moin 2 participants 2 messages Jan 20 – Jan 26

lore
Share & tools
lore

Shaik Moin

author
#0 lore raw

PATCH 1/1 libpcre2: Enabling Ptest support

Add tests for POSIX wrapper (pcre2posix_test), core PCRE2 engine (RunTest), and grep utility (RunGrepTest).

pcre2posix_test: Verifies the POSIX wrapper API
RunTest: Executes the core PCRE2 test suite through pcre2test
RunGrepTest: Checks pcre2grep to ensure its grep‑style matching works as expected with various patterns and input files.

---
 .../distro/include/ptest-packagelists.inc     |  1 +
 .../libpcre/libpcre2/run-ptest                | 44 +++++++++++++++++++
 .../recipes-support/libpcre/libpcre2_10.47.bb | 21 ++++++++-
 3 files changed, 64 insertions(+), 2 deletions(-)
 create mode 100644 meta/recipes-support/libpcre/libpcre2/run-ptest
meta/conf/distro/include/ptest-packagelists.inc +1 -0
index fff2947177..66fc15daf7 100644
@@ -34,6 +34,7 @@ PTESTS_FAST = "\
     libgpg-error\
     libnl \
     libpcre \
+    libpcre2 \
     librsvg \
     libssh2 \
     libtest-fatal-perl \
meta/recipes-support/libpcre/libpcre2/run-ptest new file +44 -0

44 lines not on this page · raw message

meta/recipes-support/libpcre/libpcre2_10.47.bb +19 -2
index 2ac249f05b..e2aa998aab 100644
@@ -12,7 +12,9 @@ LIC_FILES_CHKSUM = "file://LICENCE.md;md5=6720bf3bcff57543b915c2b22e526df0 \
                     file://deps/sljit/LICENSE;md5=97268427d235c41c0be238ce8e5fda17 \
                     "
 
-SRC_URI = "${GITHUB_BASE_URI}/download/pcre2-${PV}/pcre2-${PV}.tar.bz2"
+SRC_URI = "${GITHUB_BASE_URI}/download/pcre2-${PV}/pcre2-${PV}.tar.bz2 \
+           file://run-ptest \
+"
 
 GITHUB_BASE_URI = "https://github.com/PCRE2Project/pcre2/releases"
 UPSTREAM_CHECK_REGEX = "releases/tag/pcre2-(?P<pver>\d+(\.\d+)+)$"
@@ -28,7 +30,7 @@ DEPENDS += "bzip2 zlib"
 
 BINCONFIG = "${bindir}/pcre2-config"
 
-inherit autotools binconfig-disabled github-releases
+inherit autotools binconfig-disabled github-releases ptest
 
 EXTRA_OECONF = "\
     --enable-newline-is-lf \
@@ -56,3 +58,18 @@ FILES:pcre2test = "${bindir}/pcre2test"
 FILES:pcre2test-doc = "${mandir}/man1/pcre2test.1"
 
 BBCLASSEXTEND = "native nativesdk"
+
+do_install_ptest() {
+        t=${D}${PTEST_PATH}
+        cp -r ${S}/testdata $t
+        for i in pcre2posix_test pcre2grep pcre2test; \
+          do cp ${B}/.libs/$i $t; \
+        done
+        for i in RunTest RunGrepTest test-driver; \
+          do cp ${S}/$i $t; \
+        done
+        # Skip the fr_FR locale test. If the locale fr_FR is found, it is tested.
+        # If not found, the test is skipped. The test program assumes fr_FR is non-UTF-8
+        # locale so the test fails if fr_FR is UTF-8 locale.
+        sed -i -e 's:do3=yes:do3=no:g' ${D}${PTEST_PATH}/RunTest
+}
Signature · 1 line
2.34.1
#1 lore raw

meta/recipes-support/libpcre/libpcre2/run-ptest line 5

Quoted 3 lines · Shaik Moin via lists.openembedded.org
meta/recipes-support/libpcre/libpcre2/run-ptest new file +3 -0
+echo "START: ptest-runner"
+date +"%Y-%m-%dT%H:%M"
+echo "BEGIN: $(pwd)"

This isn’t ptest-runner, this is libpcre. You can drop these lines.

meta/recipes-support/libpcre/libpcre2/run-ptest line 34

Quoted 3 lines
meta/recipes-support/libpcre/libpcre2/run-ptest new file +3 -0
+if [ -n "$results" ]; then
+    printf "%b\n" "$results"
+fi

This has already been printed, not sure I see the value of printing it again.

meta/recipes-support/libpcre/libpcre2_10.47.bb FILES:pcre2test = "${bindir}/pcre2test" · line 66

Quoted 5 lines
meta/recipes-support/libpcre/libpcre2_10.47.bb +5 -0
+do_install_ptest() {
+        t=${D}${PTEST_PATH}
+        cp -r ${S}/testdata $t
+        for i in pcre2posix_test pcre2grep pcre2test; \
+          do cp ${B}/.libs/$i $t; \

This assumes that libtool is putting temporary files in specific location. Instead, use libtool to install libtool-built binaries:

${B}/libtool —mode=install install ${B}/$i $t

meta/recipes-support/libpcre/libpcre2_10.47.bb FILES:pcre2test = "${bindir}/pcre2test" · line 74

Quoted 4 lines
meta/recipes-support/libpcre/libpcre2_10.47.bb +4 -0
+        # Skip the fr_FR locale test. If the locale fr_FR is found, it is tested.
+        # If not found, the test is skipped. The test program assumes fr_FR is non-UTF-8
+        # locale so the test fails if fr_FR is UTF-8 locale.
+        sed -i -e 's:do3=yes:do3=no:g' ${D}${PTEST_PATH}/RunTest

Probably worth filing an upstream bug about that assumption.

Ross