diff mbox series

[V3] tar: add ptest support

Message ID 1694744803-2934-1-git-send-email-qiutt@fujitsu.com
State New
Headers show
Series [V3] tar: add ptest support | expand

Commit Message

qiutt@fujitsu.com Sept. 15, 2023, 2:26 a.m. UTC
From: Qiu Tingting <qiutt@fujitsu.com>

Add a ptest for tar.
- It is taking around 3m to execute with kvm, so added it to PTEST_SLOW.
- It contains 244 cases.
- It needs more fs space for test than normal.
- Below is parts of the run log:
    START: ptest-runner
    2023-09-14T08:02
    BEGIN: /usr/lib/tar/ptest
    ## ------------------------ ##
    ## GNU tar 1.35 test suite. ##
    ## ------------------------ ##
      1: tar version                                     ok
      2: decompressing from stdin                        ok
    ...
    ## ------------- ##
    ## Test results. ##
    ## ------------- ##

    200 tests were successful.
    44 tests were skipped.
    DURATION: 188
    END: /usr/lib/tar/ptest
    2023-09-14T08:05
    STOP: ptest-runner
    TOTAL: 1 FAIL: 0

Signed-off-by: Yan Xinkuan <yanxk.fnst@fujitsu.com>
Signed-off-by: Qiu Tingting <qiutt@fujitsu.com>
---
 .../distro/include/ptest-packagelists.inc     |  1 +
 meta/recipes-core/images/core-image-ptest.bb  |  3 +++
 meta/recipes-extended/tar/tar/run-ptest       | 10 +++++++
 meta/recipes-extended/tar/tar_1.35.bb         | 27 +++++++++++++++++++
 4 files changed, 41 insertions(+)
 create mode 100644 meta/recipes-extended/tar/tar/run-ptest

Comments

Alexander Kanavin Sept. 15, 2023, 6:12 a.m. UTC | #1
I think there's expectation that the test prints at least one PASS:
marker, otherwise 'bitbake -c testimage core-image-ptest-tar' is going
to fail, even if running ptest-runner on the command line does not.
Can you please check how this command behaves?

If it does fail, you can modify run-ptest to print FAIL: tar if
something failed and PASS: tar if nothing did. './testsuite && echo
"PASS: tar" || echo "FAIL" tar" is the simplest.

Alex

On Fri, 15 Sept 2023 at 04:26, qiutt@fujitsu.com <qiutt@fujitsu.com> wrote:
>
> From: Qiu Tingting <qiutt@fujitsu.com>
>
> Add a ptest for tar.
> - It is taking around 3m to execute with kvm, so added it to PTEST_SLOW.
> - It contains 244 cases.
> - It needs more fs space for test than normal.
> - Below is parts of the run log:
>     START: ptest-runner
>     2023-09-14T08:02
>     BEGIN: /usr/lib/tar/ptest
>     ## ------------------------ ##
>     ## GNU tar 1.35 test suite. ##
>     ## ------------------------ ##
>       1: tar version                                     ok
>       2: decompressing from stdin                        ok
>     ...
>     ## ------------- ##
>     ## Test results. ##
>     ## ------------- ##
>
>     200 tests were successful.
>     44 tests were skipped.
>     DURATION: 188
>     END: /usr/lib/tar/ptest
>     2023-09-14T08:05
>     STOP: ptest-runner
>     TOTAL: 1 FAIL: 0
>
> Signed-off-by: Yan Xinkuan <yanxk.fnst@fujitsu.com>
> Signed-off-by: Qiu Tingting <qiutt@fujitsu.com>
> ---
>  .../distro/include/ptest-packagelists.inc     |  1 +
>  meta/recipes-core/images/core-image-ptest.bb  |  3 +++
>  meta/recipes-extended/tar/tar/run-ptest       | 10 +++++++
>  meta/recipes-extended/tar/tar_1.35.bb         | 27 +++++++++++++++++++
>  4 files changed, 41 insertions(+)
>  create mode 100644 meta/recipes-extended/tar/tar/run-ptest
>
> diff --git a/meta/conf/distro/include/ptest-packagelists.inc b/meta/conf/distro/include/ptest-packagelists.inc
> index 9160103cb0..3df7c9e405 100644
> --- a/meta/conf/distro/include/ptest-packagelists.inc
> +++ b/meta/conf/distro/include/ptest-packagelists.inc
> @@ -109,6 +109,7 @@ PTESTS_SLOW = "\
>      python3-cryptography \
>      python3 \
>      strace \
> +    tar \
>      tcl \
>      util-linux \
>      valgrind \
> diff --git a/meta/recipes-core/images/core-image-ptest.bb b/meta/recipes-core/images/core-image-ptest.bb
> index b81ab7b7c8..b6f5c2fd60 100644
> --- a/meta/recipes-core/images/core-image-ptest.bb
> +++ b/meta/recipes-core/images/core-image-ptest.bb
> @@ -24,6 +24,9 @@ IMAGE_ROOTFS_EXTRA_SPACE:virtclass-mcextend-mdadm = "1524288"
>  IMAGE_ROOTFS_EXTRA_SPACE:virtclass-mcextend-strace = "1024288"
>  IMAGE_ROOTFS_EXTRA_SPACE:virtclass-mcextend-lttng-tools = "1524288"
>
> +# tar-ptest in particular needs more space
> +IMAGE_ROOTFS_EXTRA_SPACE:virtclass-mcextend-tar = "1524288"
> +
>  # ptests need more memory than standard to avoid the OOM killer
>  QB_MEM = "-m 1024"
>  QB_MEM:virtclass-mcextend-lttng-tools = "-m 4096"
> diff --git a/meta/recipes-extended/tar/tar/run-ptest b/meta/recipes-extended/tar/tar/run-ptest
> new file mode 100644
> index 0000000000..ad4dd334f7
> --- /dev/null
> +++ b/meta/recipes-extended/tar/tar/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
> diff --git a/meta/recipes-extended/tar/tar_1.35.bb b/meta/recipes-extended/tar/tar_1.35.bb
> index 4dbd418b60..b3d22c3db9 100644
> --- a/meta/recipes-extended/tar/tar_1.35.bb
> +++ b/meta/recipes-extended/tar/tar_1.35.bb
> @@ -42,6 +42,33 @@ do_install:append:class-target() {
>      fi
>  }
>
> +# add for ptest support
> +SRC_URI += " \
> +    file://run-ptest \
> +"
> +
> +inherit ptest
> +
> +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/
> +    sed -i "/abs_/d" ${B}/tests/atconfig
> +    install --mode=755 ${B}/tests/atconfig ${D}${PTEST_PATH}/tests/
> +    sed -i "s%${B}/../tar-1.34.build-aux:%%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 ${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*"
> --
> 2.25.1
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#187651): https://lists.openembedded.org/g/openembedded-core/message/187651
> Mute This Topic: https://lists.openembedded.org/mt/101372466/1686489
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [alex.kanavin@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
qiutt@fujitsu.com Sept. 18, 2023, 8:28 a.m. UTC | #2
Hi, Alex

Thanks for your reply.
There are two ways to add markers. Which one is better?
1. add one marker for the hole test of tar (as your suggestion)
2. add markers(PASS, FAIL, SKIP) for every case
sample:
PASS: 1: tar version
FAIL: 5: TAR_OPTIONS with string arguments
SKIP: 11: --pax-option compatibility

When try to run 'bitbake -c testimage core-image-ptest-tar' command , my compiling env can not find the testimage task. ( ERROR: Task do_testimage does not exist for target core-image-ptest-tar)
Maybe my compiling env has problems, so c ould you show me the correct steps for running the command ?

my steps :
1. download bitbake and install
cd ${WORK_DIR}
git clone https://git.openembedded.org/bitbake bitbake export BITBAKEDIR=${WORK_DIR}/bitbake/
2. download openembedded-core and apply this patch
git clone https://git.openembedded.org/openembedded-core oe-core
cd oe-core
patch -p1 < ${THIS_PATCH}
3. compile image
source ./oe-init-build-env
echo 'DISTRO_FEATURES:append = " ptest"' >>  conf/local.conf
bitbake core-image-ptest-tar
4. run command
bitbake -c testimage core-image-ptest-tar
Alexander Kanavin Sept. 18, 2023, 9:32 a.m. UTC | #3
On Mon, 18 Sept 2023 at 10:28, qiutt@fujitsu.com <qiutt@fujitsu.com> wrote:
> Thanks for your reply.
> There are two ways to add markers. Which one is better?
> 1. add one marker for the hole test of tar (as your suggestion)
> 2. add markers(PASS, FAIL, SKIP) for every case
> sample:
> PASS: 1: tar version
> FAIL: 5: TAR_OPTIONS with string arguments
>       SKIP: 11: --pax-option compatibility

I looked into why the test suite doesn't print those markers to begin
with (GNU items usually do when they use libcheck). It seems that
tests/testsuite is pre-generated with a different thing called
'autotest' that doesn't print them. You need to regenerate the file
with autotest from from the native sysroot (provided by yocto), which
is patched to print the markers:

https://git.yoctoproject.org/poky/tree/meta/recipes-devtools/autoconf/autoconf/autotest-automake-result-format.patch

and then use --am-fmt option with testsuite so they get printed.

> When try to run 'bitbake -c testimage core-image-ptest-tar' command , my compiling env can not find the testimage task. (ERROR: Task do_testimage does not exist for target core-image-ptest-tar)
> Maybe my compiling env has problems, so could you show me the correct steps for running the command?

local.conf should contain

IMAGE_CLASSES += "testimage"

You might already have it there, just commented out.

Alex
qiutt@fujitsu.com Sept. 19, 2023, 12:31 a.m. UTC | #4
Hi,Alex

Thank you very much!
I will try it.

Best Regards.
Qiu Tingting
diff mbox series

Patch

diff --git a/meta/conf/distro/include/ptest-packagelists.inc b/meta/conf/distro/include/ptest-packagelists.inc
index 9160103cb0..3df7c9e405 100644
--- a/meta/conf/distro/include/ptest-packagelists.inc
+++ b/meta/conf/distro/include/ptest-packagelists.inc
@@ -109,6 +109,7 @@  PTESTS_SLOW = "\
     python3-cryptography \
     python3 \
     strace \
+    tar \
     tcl \
     util-linux \
     valgrind \
diff --git a/meta/recipes-core/images/core-image-ptest.bb b/meta/recipes-core/images/core-image-ptest.bb
index b81ab7b7c8..b6f5c2fd60 100644
--- a/meta/recipes-core/images/core-image-ptest.bb
+++ b/meta/recipes-core/images/core-image-ptest.bb
@@ -24,6 +24,9 @@  IMAGE_ROOTFS_EXTRA_SPACE:virtclass-mcextend-mdadm = "1524288"
 IMAGE_ROOTFS_EXTRA_SPACE:virtclass-mcextend-strace = "1024288"
 IMAGE_ROOTFS_EXTRA_SPACE:virtclass-mcextend-lttng-tools = "1524288"
 
+# tar-ptest in particular needs more space
+IMAGE_ROOTFS_EXTRA_SPACE:virtclass-mcextend-tar = "1524288"
+
 # ptests need more memory than standard to avoid the OOM killer
 QB_MEM = "-m 1024"
 QB_MEM:virtclass-mcextend-lttng-tools = "-m 4096"
diff --git a/meta/recipes-extended/tar/tar/run-ptest b/meta/recipes-extended/tar/tar/run-ptest
new file mode 100644
index 0000000000..ad4dd334f7
--- /dev/null
+++ b/meta/recipes-extended/tar/tar/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
diff --git a/meta/recipes-extended/tar/tar_1.35.bb b/meta/recipes-extended/tar/tar_1.35.bb
index 4dbd418b60..b3d22c3db9 100644
--- a/meta/recipes-extended/tar/tar_1.35.bb
+++ b/meta/recipes-extended/tar/tar_1.35.bb
@@ -42,6 +42,33 @@  do_install:append:class-target() {
     fi
 }
 
+# add for ptest support
+SRC_URI += " \
+    file://run-ptest \
+"
+
+inherit ptest
+
+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/
+    sed -i "/abs_/d" ${B}/tests/atconfig
+    install --mode=755 ${B}/tests/atconfig ${D}${PTEST_PATH}/tests/
+    sed -i "s%${B}/../tar-1.34.build-aux:%%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 ${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*"