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: [OE-core][PATCH v2] libarchive: add ptest support
Date: Tue, 10 Feb 2026 20:33:28 +0100 [thread overview]
Message-ID: <20260210193328.8955-1-pratik.farkase@est.tech> (raw)
In-Reply-To: <20260208184637.14046-1-pratik.farkase@est.tech>
Add ptest support to enable automated testing of libarchive
using ptest-runner.
The implementation builds and installs five test suites:
libarchive_test, bsdtar_test, bsdcpio_test, bsdcat_test, and
bsdunzip_test, along with their test data files.
Test executables for bsdtar, bsdcpio, bsdcat, and bsdunzip are
provided via symlinks to the installed binaries.
All tests on qemux86-64 pass:
libarchive_test: 689 tests
bsdtar_test: 76 tests
bsdcpio_test: 49 tests
bsdcat_test: 18 tests
bsdunzip_test: 8 tests
Signed-off-by: Pratik Farkase <pratik.farkase@est.tech>
---
Changes in v2:
- Remove conditional checks from do_install_ptest()
to avoid hiding test installation failures
- Remove existence checks from run-ptest
---
.../distro/include/ptest-packagelists.inc | 1 +
.../libarchive/libarchive/run-ptest | 11 +++++++
.../libarchive/libarchive_3.8.5.bb | 30 +++++++++++++++++--
3 files changed, 40 insertions(+), 2 deletions(-)
create mode 100755 meta/recipes-extended/libarchive/libarchive/run-ptest
diff --git a/meta/conf/distro/include/ptest-packagelists.inc b/meta/conf/distro/include/ptest-packagelists.inc
index b9616e9bf4..648b53a5f6 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 \
+ libarchive \
libcheck \
libconvert-asn1-perl \
libexif \
diff --git a/meta/recipes-extended/libarchive/libarchive/run-ptest b/meta/recipes-extended/libarchive/libarchive/run-ptest
new file mode 100755
index 0000000000..6a6eb0748b
--- /dev/null
+++ b/meta/recipes-extended/libarchive/libarchive/run-ptest
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+for t in libarchive_test bsdtar_test bsdcpio_test bsdcat_test bsdunzip_test; do
+ ./$t
+ if [ $? -eq 0 ]; then
+ echo "PASS: $t"
+ else
+ echo "FAIL: $t"
+ fi
+done
+
diff --git a/meta/recipes-extended/libarchive/libarchive_3.8.5.bb b/meta/recipes-extended/libarchive/libarchive_3.8.5.bb
index fcfaf5d231..7b10823002 100644
--- a/meta/recipes-extended/libarchive/libarchive_3.8.5.bb
+++ b/meta/recipes-extended/libarchive/libarchive_3.8.5.bb
@@ -29,12 +29,14 @@ PACKAGECONFIG[zstd] = "--with-zstd,--without-zstd,zstd,"
EXTRA_OECONF += "--enable-largefile --without-iconv"
-SRC_URI = "https://libarchive.org/downloads/libarchive-${PV}.tar.gz"
+SRC_URI = "https://libarchive.org/downloads/libarchive-${PV}.tar.gz \
+ file://run-ptest \
+ "
UPSTREAM_CHECK_URI = "https://www.libarchive.org/"
SRC_URI[sha256sum] = "8a60f3a7bfd59c54ce82ae805a93dba65defd04148c3333b7eaa2102f03b7ffd"
-inherit autotools update-alternatives pkgconfig
+inherit autotools update-alternatives pkgconfig ptest
CPPFLAGS += "-I${WORKDIR}/extra-includes"
@@ -62,3 +64,27 @@ ALTERNATIVE_LINK_NAME[cpio] = "${base_bindir}/cpio"
ALTERNATIVE_TARGET[cpio] = "${bindir}/bsdcpio"
BBCLASSEXTEND = "native nativesdk"
+
+do_compile_ptest() {
+ oe_runmake check TESTS=
+}
+
+do_install_ptest() {
+ install -d ${D}${PTEST_PATH}
+
+ for test in libarchive_test bsdtar_test bsdcpio_test bsdcat_test bsdunzip_test; do
+ ${B}/libtool --mode=install install -m 0755 ${B}/$test ${D}${PTEST_PATH}/$test
+ done
+
+ for dir in libarchive tar cpio cat unzip; do
+ install -d ${D}${PTEST_PATH}/$dir/test
+ cp -r ${S}/$dir/test/* ${D}${PTEST_PATH}/$dir/test/
+ done
+
+ ln -sf ${bindir}/bsdtar ${D}${PTEST_PATH}/bsdtar
+ ln -sf ${bindir}/bsdcpio ${D}${PTEST_PATH}/bsdcpio
+ ln -sf ${bindir}/bsdcat ${D}${PTEST_PATH}/bsdcat
+ ln -sf ${bindir}/bsdunzip ${D}${PTEST_PATH}/bsdunzip
+}
+
+RDEPENDS:${PN}-ptest += "bsdtar bsdcpio"
--
2.43.0
prev parent reply other threads:[~2026-02-10 19:33 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-08 18:46 [OE-core][PATCH v1] libarchive: add ptest support Pratik Farkase
2026-02-10 19:33 ` Pratik Farkase [this message]
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=20260210193328.8955-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