libarchive: add ptest support
PATCH 1/1 libarchive: add ptest support
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
--- .../distro/include/ptest-packagelists.inc | 1 + .../libarchive/libarchive/run-ptest | 12 +++++++ .../libarchive/libarchive_3.8.5.bb | 34 +++++++++++++++++-- 3 files changed, 45 insertions(+), 2 deletions(-) create mode 100755 meta/recipes-extended/libarchive/libarchive/run-ptest
meta/conf/distro/include/ptest-packagelists.inc +1 -0
@@ -28,6 +28,7 @@ PTESTS_FAST = "\ icu \ json-c \ json-glib \ + libarchive \ libcheck \ libconvert-asn1-perl \ libexif \
meta/recipes-extended/libarchive/libarchive/run-ptest new file +12 -0
@@ -0,0 +1,12 @@ +#!/bin/sh + +for t in libarchive_test bsdtar_test bsdcpio_test bsdcat_test bsdunzip_test; do + if [ -x ./$t ]; then + ./$t + if [ $? -eq 0 ]; then + echo "PASS: $t" + else + echo "FAIL: $t" + fi + fi +done
meta/recipes-extended/libarchive/libarchive_3.8.5.bb +32 -2
@@ -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,31 @@ 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 + if [ -f ${B}/$test ]; then + ${B}/libtool --mode=install install -m 0755 ${B}/$test ${D}${PTEST_PATH}/$test + fi + done + + for dir in libarchive tar cpio cat unzip; do + if [ -d ${S}/$dir/test ]; then + install -d ${D}${PTEST_PATH}/$dir/test + cp -r ${S}/$dir/test/* ${D}${PTEST_PATH}/$dir/test/ + fi + 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"
Signature · 1 line
2.43.0
PATCH v2 1/1 libarchive: add ptest support
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
---
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
meta/conf/distro/include/ptest-packagelists.inc +1 -0
@@ -28,6 +28,7 @@ PTESTS_FAST = "\ icu \ json-c \ json-glib \ + libarchive \ libcheck \ libconvert-asn1-perl \ libexif \
meta/recipes-extended/libarchive/libarchive/run-ptest new file +11 -0
@@ -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 +
meta/recipes-extended/libarchive/libarchive_3.8.5.bb +28 -2
@@ -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"
Signature · 1 line
2.43.0