From: Pratik Farkase <pratik.farkase@est.tech>
To: openembedded-core@lists.openembedded.org
Cc: pratik.farkase@ericsson.com, Pratik Farkase <pratik.farkase@est.tech>
Subject: [PATCH] libcheck: add ptest support
Date: Fri, 14 Nov 2025 02:41:45 +0100 [thread overview]
Message-ID: <20251114014145.23826-1-pratik.farkase@est.tech> (raw)
Add package test (ptest) support to libcheck recipe to enable
running the test suite on target devices.
The implementation installs:
- Test binaries (check_check, check_check_export)
- Test helper binaries and scripts
- Shell script tests that validate various output formats
- Test configuration files
All 9 upstream tests pass successfully:
START: ptest-runner
BEGIN: /usr/lib/libcheck/ptest
PASS: check_check_export
PASS: check_check
PASS: test_output.sh
PASS: test_check_nofork.sh
PASS: test_check_nofork_teardown.sh
PASS: test_xml_output.sh
PASS: test_log_output.sh
PASS: test_set_max_msg_size.sh
PASS: test_tap_output.sh
END: /usr/lib/libcheck/ptest
STOP: ptest-runner
Note: The test_vars SRCDIR path is set to /usr/src/debug/libcheck/0.15.2/tests
to match the debug source paths embedded in compiled binaries.
Signed-off-by: Pratik Farkase <pratik.farkase@est.tech>
---
.../distro/include/ptest-packagelists.inc | 1 +
.../libcheck/libcheck/run-ptest | 36 ++++++++++++++++++
.../libcheck/libcheck_0.15.2.bb | 37 ++++++++++++++++++-
3 files changed, 73 insertions(+), 1 deletion(-)
create mode 100644 meta/recipes-support/libcheck/libcheck/run-ptest
diff --git a/meta/conf/distro/include/ptest-packagelists.inc b/meta/conf/distro/include/ptest-packagelists.inc
index 06d113e264..3cd5f244be 100644
--- a/meta/conf/distro/include/ptest-packagelists.inc
+++ b/meta/conf/distro/include/ptest-packagelists.inc
@@ -28,6 +28,7 @@ PTESTS_FAST = "\
icu \
json-c \
json-glib \
+ libcheck \
libconvert-asn1-perl \
libexif \
libgpg-error\
diff --git a/meta/recipes-support/libcheck/libcheck/run-ptest b/meta/recipes-support/libcheck/libcheck/run-ptest
new file mode 100644
index 0000000000..fe252bc33d
--- /dev/null
+++ b/meta/recipes-support/libcheck/libcheck/run-ptest
@@ -0,0 +1,36 @@
+#!/bin/sh
+
+# run-ptest script for libcheck
+# Runs the libcheck test suite and outputs results in ptest format
+
+cd tests || exit 1
+
+for test in check_check_export check_check; do
+ if [ -x ./$test ]; then
+ ./$test > /dev/null 2>&1
+ if [ $? -eq 0 ]; then
+ echo "PASS: $test"
+ else
+ echo "FAIL: $test"
+ fi
+ else
+ echo "SKIP: $test"
+ fi
+done
+
+for test in test_output.sh test_check_nofork.sh test_check_nofork_teardown.sh \
+ test_xml_output.sh test_log_output.sh test_set_max_msg_size.sh \
+ test_tap_output.sh; do
+ if [ -x ./$test ]; then
+ ./$test > /dev/null 2>&1
+ if [ $? -eq 0 ]; then
+ echo "PASS: $test"
+ else
+ echo "FAIL: $test"
+ fi
+ else
+ echo "SKIP: $test"
+ fi
+done
+
+exit 0
diff --git a/meta/recipes-support/libcheck/libcheck_0.15.2.bb b/meta/recipes-support/libcheck/libcheck_0.15.2.bb
index adf95f5040..52df7c22bb 100644
--- a/meta/recipes-support/libcheck/libcheck_0.15.2.bb
+++ b/meta/recipes-support/libcheck/libcheck_0.15.2.bb
@@ -14,6 +14,7 @@ SRC_URI = "${GITHUB_BASE_URI}/download/${PV}/check-${PV}.tar.gz \
file://automake-output.patch \
file://subunit.patch \
file://0001-Fix-texinfo-errors-and-warnings.patch \
+ file://run-ptest \
"
SRC_URI[sha256sum] = "a8de4e0bacfb4d76dd1c618ded263523b53b85d92a146d8835eb1a52932fa20a"
@@ -21,17 +22,51 @@ GITHUB_BASE_URI = "https://github.com/libcheck/check/releases/"
S = "${UNPACKDIR}/check-${PV}"
-inherit cmake pkgconfig texinfo github-releases
+inherit cmake pkgconfig texinfo github-releases ptest
RREPLACES:${PN} = "check (<= 0.9.5)"
EXTRA_OECMAKE:append:class-target = " -DAWK_PATH=${bindir}/awk"
EXTRA_OECMAKE = "-DENABLE_SUBUNIT_EXT=OFF"
+do_install_ptest() {
+ install -d ${D}${PTEST_PATH}/tests
+
+ install -m 0755 ${B}/tests/check_check ${D}${PTEST_PATH}/tests/
+ install -m 0755 ${B}/tests/check_check_export ${D}${PTEST_PATH}/tests/
+
+ for binary in ${B}/tests/*; do
+ if [ -f "$binary" ] && [ -x "$binary" ]; then
+ case "$binary" in
+ *.sh) ;;
+ *) install -m 0755 "$binary" ${D}${PTEST_PATH}/tests/ || true ;;
+ esac
+ fi
+ done
+
+ for script in test_output.sh test_check_nofork.sh test_check_nofork_teardown.sh \
+ test_xml_output.sh test_log_output.sh test_set_max_msg_size.sh \
+ test_tap_output.sh; do
+ install -m 0755 ${S}/tests/$script ${D}${PTEST_PATH}/tests/
+ done
+
+ install -m 0755 ${S}/tests/test_output_strings ${D}${PTEST_PATH}/tests/
+
+ if [ -f ${B}/tests/test_vars ]; then
+ install -m 0644 ${B}/tests/test_vars ${D}${PTEST_PATH}/tests/
+ sed -i \
+ -e 's|if \[ x"[^"]*" != x"\." \];|if \[ x"/usr/src/debug/libcheck/0.15.2/tests" != x"." \];|g' \
+ -e 's|SRCDIR="[^"]*"|SRCDIR="/usr/src/debug/libcheck/0.15.2/tests/"|g' \
+ ${D}${PTEST_PATH}/tests/test_vars
+ fi
+}
+
do_install:append:class-native() {
create_cmdline_shebang_wrapper ${D}${bindir}/checkmk
}
+RDEPENDS:${PN}-ptest += "bash libcheck"
+
BBCLASSEXTEND = "native nativesdk"
PACKAGES =+ "checkmk"
--
2.43.0
next reply other threads:[~2025-11-14 1:42 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-14 1:41 Pratik Farkase [this message]
2025-11-18 12:10 ` [OE-core] [PATCH] libcheck: add ptest support Ross Burton
2025-11-18 13:45 ` Pratik Farkase
2025-11-21 13:24 ` [OE-core][PATCH v2] " Pratik Farkase
2026-01-07 9:15 ` Pratik Farkase
2026-01-07 15:39 ` Mathieu Dubois-Briand
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=20251114014145.23826-1-pratik.farkase@est.tech \
--to=pratik.farkase@est.tech \
--cc=openembedded-core@lists.openembedded.org \
--cc=pratik.farkase@ericsson.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox