diff mbox series

[meta-oe,V1] tar: add ptest

Message ID 1667351911-9129-1-git-send-email-yanxk.fnst@fujitsu.com
State New
Headers show
Series [meta-oe,V1] tar: add ptest | expand

Commit Message

yanxk.fnst@fujitsu.com Nov. 2, 2022, 1:18 a.m. UTC
From: Yan <yanxk.fnst@fujitsu.com>

enable ptest for oss "tar".

Signed-off-by: Yanxinkuan <yanxk.fnst@fujitsu.com>
---
 .../distro/include/ptest-packagelists.inc     |  1 +
 meta/recipes-extended/tar/files/run-ptest     | 10 +++++++
 meta/recipes-extended/tar/tar_1.34.bb         | 27 +++++++++++++++++--
 3 files changed, 36 insertions(+), 2 deletions(-)
 create mode 100644 meta/recipes-extended/tar/files/run-ptest

Comments

Alexander Kanavin Feb. 3, 2023, 11:10 a.m. UTC | #1
On Fri, 3 Feb 2023 at 04:08, Yan Xin Kuan <yanxk.fnst@fujitsu.com> wrote:
> @@ -100,6 +100,7 @@ PTESTS_SLOW = "\
>      python3-cryptography-ptest \
>      python3-ptest \
>      strace-ptest \
> +    tar-ptest \
>      tcl-ptest \
>      util-linux-ptest \
>      valgrind-ptest \

PTESTS_SLOW is for tests longer than 30 seconds. How long does the tar
test take in your local testing? Is kvm in use?

Alex
yanxk.fnst@fujitsu.com Feb. 6, 2023, 2:57 a.m. UTC | #2
Hi,
We place it in slow list for tar test takes at least 5 minutes.
KVM is enabled, our PC uses Core i5 4th.
Best,
Yan

-----邮件原件-----
发件人: Alexander Kanavin <alex.kanavin@gmail.com> 
发送时间: 2023年2月3日 19:11
收件人: Yan, Xinkuan/晏 新宽 <yanxk.fnst@fujitsu.com>
抄送: openembedded-core@lists.openembedded.org; FNST fnstml-fujitsuten <fnstml-fujitsuten@fujitsu.com>
主题: Re: [OE-core] [meta-oe][PATCH V1] tar: add ptest

On Fri, 3 Feb 2023 at 04:08, Yan Xin Kuan <yanxk.fnst@fujitsu.com> wrote:
> @@ -100,6 +100,7 @@ PTESTS_SLOW = "\
>      python3-cryptography-ptest \
>      python3-ptest \
>      strace-ptest \
> +    tar-ptest \
>      tcl-ptest \
>      util-linux-ptest \
>      valgrind-ptest \

PTESTS_SLOW is for tests longer than 30 seconds. How long does the tar test take in your local testing? Is kvm in use?

Alex
diff mbox series

Patch

diff --git a/meta/conf/distro/include/ptest-packagelists.inc b/meta/conf/distro/include/ptest-packagelists.inc
index 72162f10ee..d3e18ea4a4 100644
--- a/meta/conf/distro/include/ptest-packagelists.inc
+++ b/meta/conf/distro/include/ptest-packagelists.inc
@@ -100,6 +100,7 @@  PTESTS_SLOW = "\
     python3-cryptography-ptest \
     python3-ptest \
     strace-ptest \
+    tar-ptest \
     tcl-ptest \
     util-linux-ptest \
     valgrind-ptest \
diff --git a/meta/recipes-extended/tar/files/run-ptest b/meta/recipes-extended/tar/files/run-ptest
new file mode 100644
index 0000000000..9ca27153d9
--- /dev/null
+++ b/meta/recipes-extended/tar/files/run-ptest
@@ -0,0 +1,10 @@ 
+#!/bin/sh
+
+# Define tar test work dir
+WORKDIR=/usr/lib/tar/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/tar/tar_1.34.bb b/meta/recipes-extended/tar/tar_1.34.bb
index 7307cd57a2..7a178c345f 100644
--- a/meta/recipes-extended/tar/tar_1.34.bb
+++ b/meta/recipes-extended/tar/tar_1.34.bb
@@ -6,11 +6,12 @@  SECTION = "base"
 LICENSE = "GPL-3.0-only"
 LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504"
 
-SRC_URI = "${GNU_MIRROR}/tar/tar-${PV}.tar.bz2"
+SRC_URI = "${GNU_MIRROR}/tar/tar-${PV}.tar.bz2 \
+           file://run-ptest"
 
 SRC_URI[sha256sum] = "b44cc67f8a1f6b0250b7c860e952b37e8ed932a90bd9b1862a511079255646ff"
 
-inherit autotools gettext texinfo
+inherit autotools gettext texinfo ptest
 
 PACKAGECONFIG ??= ""
 PACKAGECONFIG:append:class-target = " ${@bb.utils.filter('DISTRO_FEATURES', 'acl', d)}"
@@ -42,6 +43,28 @@  do_install:append:class-target() {
     fi
 }
 
+# Tar testsuite would generate some small tests that are
+# bash scripts, so set ptest dependency to bash
+RDEPENDS:${PN}-ptest += "bash"
+
+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 checkseekhole ckmtime
+}
+
+do_install_ptest() {
+    install -d ${D}${PTEST_PATH}/tests/
+    install --mode=755 ${B}/tests/atconfig ${D}${PTEST_PATH}/tests/
+    install --mode=755 ${B}/tests/atlocal ${D}${PTEST_PATH}/tests/
+    install --mode=755 ${B}/tests/genfile ${D}${PTEST_PATH}/tests/
+    install --mode=755 ${B}/tests/checkseekhole ${D}${PTEST_PATH}/tests/
+    install --mode=755 ${B}/tests/ckmtime ${D}${PTEST_PATH}/tests/
+    install --mode=755 ${S}/tests/testsuite ${D}${PTEST_PATH}/tests/
+}
+
 PACKAGES =+ "${PN}-rmt"
 
 FILES:${PN}-rmt = "${sbindir}/rmt*"