summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoryanxk <yanxk.fnst@fujitsu.com>2023-02-09 08:54:56 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2023-02-10 09:25:08 +0000
commit9661e76aa1ea89b3dcc24a4d69fa7e6161873d7f (patch)
treeb2ea319219d9220b0657eb0232dbd4c341829fb4
parentf6c260c8e2a33e282a35afc99de4ef8cc1791b08 (diff)
downloadopenembedded-core-contrib-9661e76aa1ea89b3dcc24a4d69fa7e6161873d7f.tar.gz
cpio: Add ptest support
Add ptest function for oss 'cpio'. Tis test takes less than 1 second with kvm enabled, so it is a fast test. autotest files would contain TMPDIR, they are removed from script files atconfig and atlocal. Signed-off-by: yanxk <yanxk.fnst@fujitsu.com> Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
-rw-r--r--meta/conf/distro/include/ptest-packagelists.inc1
-rw-r--r--meta/recipes-extended/cpio/cpio-2.13/run-ptest10
-rw-r--r--meta/recipes-extended/cpio/cpio_2.13.bb22
3 files changed, 32 insertions, 1 deletions
diff --git a/meta/conf/distro/include/ptest-packagelists.inc b/meta/conf/distro/include/ptest-packagelists.inc
index 5422ecd378..0681b4b7a2 100644
--- a/meta/conf/distro/include/ptest-packagelists.inc
+++ b/meta/conf/distro/include/ptest-packagelists.inc
@@ -12,6 +12,7 @@ PTESTS_FAST = "\
bc-ptest \
bluez5-ptest \
busybox-ptest \
+ cpio-ptest \
diffstat-ptest \
diffutils-ptest \
ethtool-ptest \
diff --git a/meta/recipes-extended/cpio/cpio-2.13/run-ptest b/meta/recipes-extended/cpio/cpio-2.13/run-ptest
new file mode 100644
index 0000000000..bdac7259c1
--- /dev/null
+++ b/meta/recipes-extended/cpio/cpio-2.13/run-ptest
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+# Define cpio test work dir
+WORKDIR=/usr/lib/cpio/ptest/tests/
+
+# Run test
+cd ${WORKDIR}
+./atconfig ./atlocal ./testsuite
+
+./testsuite 2>&1 | grep -E '[0-9]{1,3}: ' | sed -e 's/^.....//' -e '/[ok]$/s/^/PASS: /;/FAILED (.*)/s/^/FAIL: /;/skipped (.*)/s/^/SKIP: /;/expected failure/ s/^/PASS: /;/UNEXPECTED PASS/s/^/FAIL: /' -e 's/ok$//g' -e 's/FAILED.*//g' -e 's/skipped.*//g' -e 's/expected failure.*//g' -e 's/UNEXPECTED PASS.*//g'
diff --git a/meta/recipes-extended/cpio/cpio_2.13.bb b/meta/recipes-extended/cpio/cpio_2.13.bb
index eb3dc138a9..7a3c8b308b 100644
--- a/meta/recipes-extended/cpio/cpio_2.13.bb
+++ b/meta/recipes-extended/cpio/cpio_2.13.bb
@@ -12,12 +12,13 @@ SRC_URI = "${GNU_MIRROR}/cpio/cpio-${PV}.tar.gz \
file://0001-obstack-Fix-a-clang-warning.patch \
file://CVE-2021-38185.patch \
file://0001-Use-__alignof__-with-clang.patch \
+ file://run-ptest \
"
SRC_URI[md5sum] = "389c5452d667c23b5eceb206f5000810"
SRC_URI[sha256sum] = "e87470d9c984317f658567c03bfefb6b0c829ff17dbf6b0de48d71a4c8f3db88"
-inherit autotools gettext texinfo
+inherit autotools gettext texinfo ptest
# Issue applies to use of cpio in SUSE/OBS, doesn't apply to us
CVE_CHECK_IGNORE += "CVE-2010-4226"
@@ -38,6 +39,25 @@ do_install () {
mv "${D}${mandir}/man8/rmt.8" "${D}${mandir}/man8/rmt-cpio.8"
}
+do_compile_ptest() {
+ oe_runmake -C ${B}/gnu/ check
+ oe_runmake -C ${B}/lib/ check
+ oe_runmake -C ${B}/rmt/ check
+ oe_runmake -C ${B}/src/ check
+ oe_runmake -C ${B}/tests/ genfile
+}
+
+do_install_ptest() {
+ install -d ${D}${PTEST_PATH}/tests/
+ sed -i "/abs_/d" ${B}/tests/atconfig
+ install --mode=755 ${B}/tests/atconfig ${D}${PTEST_PATH}/tests/
+ sed -i "s%${B}/tests:%%g" ${B}/tests/atlocal
+ sed -i "s%${B}/src:%%g" ${B}/tests/atlocal
+ install --mode=755 ${B}/tests/atlocal ${D}${PTEST_PATH}/tests/
+ install --mode=755 ${B}/tests/genfile ${D}${PTEST_PATH}/tests/
+ install --mode=755 ${S}/tests/testsuite ${D}${PTEST_PATH}/tests/
+}
+
PACKAGES =+ "${PN}-rmt"
FILES:${PN}-rmt = "${sbindir}/rmt*"