Skip to contentSkip to conversation

tar: add ptest support

PATCH Superseded [email protected] 2 participants 5 messages Sep 15, 2023 – Sep 19, 2023

v3 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 tar: add ptest support

From: Qiu Tingting <[email protected]>

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
---
 .../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
meta/conf/distro/include/ptest-packagelists.inc +1 -0
index 9160103cb0..3df7c9e405 100644
@@ -109,6 +109,7 @@ PTESTS_SLOW = "\
     python3-cryptography \
     python3 \
     strace \
+    tar \
     tcl \
     util-linux \
     valgrind \
meta/recipes-core/images/core-image-ptest.bb +3 -0
index b81ab7b7c8..b6f5c2fd60 100644
@@ -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"
meta/recipes-extended/tar/tar/run-ptest new file +10 -0
new file mode 100644
index 0000000000..ad4dd334f7
@@ -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
meta/recipes-extended/tar/tar_1.35.bb +27 -0
index 4dbd418b60..b3d22c3db9 100644
@@ -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*"
Signature · 1 line
2.25.1
#1 lore raw

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

Quoted 131 lines · On Fri, 15 Sept 2023 at 04:26, [email protected] <[email protected]> wrote:

From: Qiu Tingting <[email protected]>

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
---
 .../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
meta/conf/distro/include/ptest-packagelists.inc +1 -0
index 9160103cb0..3df7c9e405 100644
@@ -109,6 +109,7 @@ PTESTS_SLOW = "\
     python3-cryptography \
     python3 \
     strace \
+    tar \
     tcl \
     util-linux \
     valgrind \
meta/recipes-core/images/core-image-ptest.bb +3 -0
index b81ab7b7c8..b6f5c2fd60 100644
@@ -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"
meta/recipes-extended/tar/tar/run-ptest new file +10 -0
new file mode 100644
index 0000000000..ad4dd334f7
@@ -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
meta/recipes-extended/tar/tar_1.35.bb +27 -1
index 4dbd418b60..b3d22c3db9 100644
@@ -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: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#2 lore raw

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

#3 lore raw
Quoted 8 lines · On Mon, 18 Sept 2023 at 10:28, [email protected] <[email protected]> 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.

Quoted 2 lines

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