]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core.git/commitdiff
libpcre2: Enabling Ptest support
authorShaik Moin <careers.myinfo@gmail.com>
Tue, 20 Jan 2026 07:39:23 +0000 (13:09 +0530)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 22 Jan 2026 14:21:52 +0000 (14:21 +0000)
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.

Signed-off-by: Shaik Moin <moins@kpit.com>
Signed-off-by: Antonin Godard <antonin.godard@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/conf/distro/include/ptest-packagelists.inc
meta/recipes-support/libpcre/libpcre2/run-ptest [new file with mode: 0644]
meta/recipes-support/libpcre/libpcre2_10.47.bb

index 739995bcfe9d692a92c57cdd400922e324132215..57e5e6e0f8a5de2f4b3459b13cb582864e05b61f 100644 (file)
@@ -34,6 +34,7 @@ PTESTS_FAST = "\
     libgpg-error\
     libnl \
     libpcre \
+    libpcre2 \
     librsvg \
     libssh2 \
     libtest-fatal-perl \
diff --git a/meta/recipes-support/libpcre/libpcre2/run-ptest b/meta/recipes-support/libpcre/libpcre2/run-ptest
new file mode 100644 (file)
index 0000000..d7c7982
--- /dev/null
@@ -0,0 +1,44 @@
+#!/bin/sh
+
+echo "START: ptest-runner"
+date +"%Y-%m-%dT%H:%M"
+echo "BEGIN: $(pwd)"
+
+# Space-separated list of test binaries
+TESTS="pcre2posix_test RunGrepTest RunTest"
+
+total=0
+pass=0
+fail=0
+results=""
+
+for T in $TESTS; do
+    echo "Running $T"
+    total=$((total + 1))
+    if ./"$T"; then
+        echo "PASS: $T"
+        pass=$((pass + 1))
+        results="${results}\nPASS:  ${T}"
+    else
+        echo "FAIL: $T"
+        fail=$((fail + 1))
+        results="${results}\nFAIL:  ${T}"
+    fi
+done
+echo "============================================================================"
+echo "Testsuite summary for PCRE"
+echo "============================================================================"
+
+if [ -n "$results" ]; then
+    printf "%b\n" "$results"
+fi
+
+# Summary with per-test details
+echo "============================================================================"
+echo "# TOTAL: $total"
+echo "# PASS:  $pass"
+echo "# FAIL:  $fail"
+echo "============================================================================"
+
+# Exit code based on failures
+[ "$fail" -eq 0 ] && exit 0 || exit 1
index 217a60aae9550a7738af3258358ef59d3573fee4..aa8c9e5f4d6c6a93d8c70c1a023c801f5984e6e6 100644 (file)
@@ -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 \
@@ -57,3 +59,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
+}