Backport ptest implementation from master branch to enable comprehensive
testing of libarchive functionality in the scarthgap release.

Changes include:
- Inherit ptest class and add ptest support infrastructure
- Add run-ptest script to execute all 5 test suites:
  * libarchive_test (698 tests)
  * bsdtar_test (74 tests)
  * bsdcpio_test (49 tests)
  * bsdcat_test (18 tests)
  * bsdunzip_test (24 tests)
- Install test binaries, test data files, and reference files
- Add bash and locale-base-en-us to RDEPENDS for ptest execution
- Enable nettle in PACKAGECONFIG for ZIP encryption/decryption support

The nettle addition is critical for test compatibility - without it,
the test_P_encryption test fails with "Decryption is unsupported due
to lack of crypto library". With nettle enabled, all 840+ tests pass
successfully.

Testing on qemux86-64:
- All test suites: PASS

This backport ensures the scarthgap branch has the same comprehensive
test coverage as master, improving quality assurance and catching
regressions early.

Signed-off-by: Pratik Farkase <[email protected]>
---
 .../distro/include/ptest-packagelists.inc     |  1 +
 .../libarchive/libarchive/run-ptest           | 10 +++++++
 .../libarchive/libarchive_3.7.9.bb            | 29 +++++++++++++++++--
 3 files changed, 38 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 9950e46776..a5af7dc079 100644
--- a/meta/conf/distro/include/ptest-packagelists.inc
+++ b/meta/conf/distro/include/ptest-packagelists.inc
@@ -27,6 +27,7 @@ PTESTS_FAST = "\
     gzip \
     json-c \
     json-glib \
+    libarchive \
     libconvert-asn1-perl \
     libgpg-error\
     libnl \
diff --git a/meta/recipes-extended/libarchive/libarchive/run-ptest 
b/meta/recipes-extended/libarchive/libarchive/run-ptest
new file mode 100755
index 0000000000..36d982917c
--- /dev/null
+++ b/meta/recipes-extended/libarchive/libarchive/run-ptest
@@ -0,0 +1,10 @@
+#!/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.7.9.bb 
b/meta/recipes-extended/libarchive/libarchive_3.7.9.bb
index b62c3d69b9..6710a0a875 100644
--- a/meta/recipes-extended/libarchive/libarchive_3.7.9.bb
+++ b/meta/recipes-extended/libarchive/libarchive_3.7.9.bb
@@ -7,7 +7,7 @@ LIC_FILES_CHKSUM = 
"file://COPYING;md5=d499814247adaee08d88080841cb5665"
 
 DEPENDS = "e2fsprogs-native"
 
-PACKAGECONFIG ?= "zlib bz2 xz zstd ${@bb.utils.filter('DISTRO_FEATURES', 'acl 
xattr', d)}"
+PACKAGECONFIG ?= "zlib bz2 xz nettle zstd 
${@bb.utils.filter('DISTRO_FEATURES', 'acl xattr', d)}"
 
 DEPENDS_BZIP2 = "bzip2-replacement-native"
 DEPENDS_BZIP2:class-target = "bzip2"
@@ -44,12 +44,13 @@ SRC_URI = 
"http://libarchive.org/downloads/libarchive-${PV}.tar.gz \
            file://0001-Merge-pull-request-2768-from-Commandoss-master.patch \
            file://CVE-2025-60753-01.patch \
            file://CVE-2025-60753-02.patch \
+           file://run-ptest \
            "
 UPSTREAM_CHECK_URI = "http://libarchive.org/";
 
 SRC_URI[sha256sum] = 
"aa90732c5a6bdda52fda2ad468ac98d75be981c15dde263d7b5cf6af66fd009f"
 
-inherit autotools update-alternatives pkgconfig
+inherit autotools update-alternatives pkgconfig ptest
 
 CPPFLAGS += "-I${WORKDIR}/extra-includes"
 
@@ -77,3 +78,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 locale-base-en-us"
-- 
2.43.0

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#231494): 
https://lists.openembedded.org/g/openembedded-core/message/231494
Mute This Topic: https://lists.openembedded.org/mt/117907094/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to