Skip to contentSkip to conversation

Adding coreutils ptest to oe-core

PATCH Superseded Trevor Gamblin 4 participants 6 messages Nov 21, 2019 – Nov 23, 2019

v1 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

cover Adding coreutils ptest to oe-core

From: Trevor Gamblin <[email protected]>

Add ptests for coreutils, but omit the most expensive tests.

core-image-minimal:

MACHINE    | PASS | FAIL | SKIP | TOTAL |
qemux86-64 |  481 |    2 |  132 |   615 |
qemuarm64  |  481 |    2 |  132 |   615 |

core-image-sato:

MACHINE    | PASS | FAIL | SKIP | TOTAL |
qemux86-64 |  483 |    1 |  131 |   615 |
qemuarm64  |  483 |    1 |  131 |   615 |

Trevor Gamblin (1):
coreutils: add ptest

 .../coreutils/coreutils/run-ptest             | 17 +++++++++
 meta/recipes-core/coreutils/coreutils_8.31.bb | 38 +++++++++++++++++++
 2 files changed, 55 insertions(+)
 create mode 100755 meta/recipes-core/coreutils/coreutils/run-ptest
Signature · 1 line
2.23.0
#1 lore raw

PATCH 1/1 coreutils: add ptest

From: Trevor Gamblin <[email protected]>

coreutils has a large number of tests, (and potential RDEPENDS to support them), including tests added with the flags RUN_EXPENSIVE_TESTS and RUN_VERY_EXPENSIVE_TESTS that add significant run time for their coverage. The RUN_VERY_EXPENSIVE_TESTS option has been omitted from the run-ptest script to reduce some of this run time, even though this increases the SKIP count in the results. Also, the ptest directory for coreutils is given blanket permissions at runtime with chmod -R 777 to ensure that the user created for the tests will be able to run the test scripts and create the necessary files in the process.

There is still room to improve the results of this ptest without the aforementioned additions. Of the tests marked SKIP, there are 30 tests that are currently counted as SKIP because they require root permissions, and another 21 that require membership in multiple user groups. It is important to know that coreutils has tests for both root and non-root users. Testing showed that 42 tests are skipped when running as root versus 30 when running as a non-root user, so the decision was made to run the suite as the latter.

Finally, note that the ptest suite for coreutils has a short runtime on x86-64/kvm of approximately 4.5 minutes, in contrast to the arm64 runtime of ~70 minutes.

---
 .../coreutils/coreutils/run-ptest             | 17 +++++++++
 meta/recipes-core/coreutils/coreutils_8.31.bb | 38 +++++++++++++++++++
 2 files changed, 55 insertions(+)
 create mode 100755 meta/recipes-core/coreutils/coreutils/run-ptest
meta/recipes-core/coreutils/coreutils/run-ptest new file +17 -0
new file mode 100755
index 0000000000..683fedee7a
@@ -0,0 +1,17 @@
+#!/bin/bash
+
+COREUTILSLIB=/usr/lib/coreutils
+LOG="${COREUTILSLIB}/ptest/coreutils_ptest_$(date +%Y%m%d-%H%M%S).log"
+
+addgroup usergroup1
+adduser --ingroup usergroup1 tester
+
+su tester -c "make check-TESTS RUN_EXPENSIVE_TESTS=yes top_srcdir=. srcdir=." | tee -a ${LOG}
+deluser tester 
+delgroup usergroup1
+
+passed=`grep PASS ${LOG}|wc -l`
+failed=`grep FAIL ${LOG}|wc -l`
+skipped=`grep -E SKIP ${LOG}|wc -l`
+all=$((passed + failed + skipped))
+
meta/recipes-core/coreutils/coreutils_8.31.bb +38 -0
index 57b2c1bdba..5ce2730048 100644
@@ -143,3 +143,41 @@ python __anonymous() {
 }
 
 BBCLASSEXTEND = "native nativesdk"
+
+inherit ptest
+
+FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
+ 
+SRC_URI += 	"file://run-ptest"
+RDEPENDS_${PN}-ptest += "bash findutils gawk gdb glibc libconvert-asn1-perl liberror-perl libmodule-build-perl libtimedate-perl liburi-perl make perl perl-module-file-stat python strace"
+
+do_install_ptest () {
+	install -d ${D}${PTEST_PATH}/tests
+	cp -r ${S}/tests/* ${D}${PTEST_PATH}/tests
+	sed -i 's/ginstall/install/g'  `grep -R ginstall ${D}${PTEST_PATH}/tests | awk -F: '{print $1}' | uniq`
+	install -d ${D}${PTEST_PATH}/build-aux
+	install ${S}/build-aux/test-driver ${D}${PTEST_PATH}/build-aux/
+	cp ${B}/Makefile ${D}${PTEST_PATH}/
+	cp ${S}/init.cfg ${D}${PTEST_PATH}/
+	cp -r ${B}/src ${D}${PTEST_PATH}/
+	cp -r ${S}/src/*.c ${D}${PTEST_PATH}/src
+	cd ${D}${PTEST_PATH}
+	tar -czvf ${D}${PTEST_PATH}/src.tar.gz ./src
+	cd -
+	sed -i '/^VPATH/s/= .*$/= ./g' ${D}${PTEST_PATH}/Makefile
+	sed -i '/^PROGRAMS/s/^/#/g' ${D}${PTEST_PATH}/Makefile
+	sed -i '/^Makefile: /s/^.*$/Makefile:/g' ${D}${PTEST_PATH}/Makefile
+	sed -i '/^abs_srcdir/s/= .*$/= \$\{PWD\}/g' ${D}${PTEST_PATH}/Makefile
+	sed -i '/^abs_top_builddir/s/= .*$/= \$\{PWD\}/g' ${D}${PTEST_PATH}/Makefile
+	sed -i '/^abs_top_srcdir/s/= .*$/= \$\{PWD\}/g' ${D}${PTEST_PATH}/Makefile
+	sed -i '/^built_programs/s/ginstall/install/g' ${D}${PTEST_PATH}/Makefile
+   chmod -R 777 ${D}${PTEST_PATH}
+	# Disable subcase stty-pairs.sh, it will cause test framework hang
+	sed -i '/stty-pairs.sh/d' ${D}${PTEST_PATH}/Makefile
+	install ${B}/src/getlimits ${D}/${bindir}
+}
+
+FILES_${PN}-ptest += "${bindir}/getlimits"
+
+INSANE_SKIP_${PN}-ptest += "ldflags"
+INSANE_SKIP_${PN}-ptest += "rpaths"
Signature · 1 line
2.23.0
#2 lore raw

Re: [PATCH 1/1] coreutils: add ptest

Quoted 41 lines · Trevor Gamblin

From: Trevor Gamblin <[email protected]>

coreutils has a large number of tests, (and potential RDEPENDS to support them), including tests added with the flags RUN_EXPENSIVE_TESTS and RUN_VERY_EXPENSIVE_TESTS that add significant run time for their coverage. The RUN_VERY_EXPENSIVE_TESTS option has been omitted from the run-ptest script to reduce some of this run time, even though this increases the SKIP count in the results. Also, the ptest directory for coreutils is given blanket permissions at runtime with chmod -R 777 to ensure that the user created for the tests will be able to run the test scripts and create the necessary files in the process.

There is still room to improve the results of this ptest without the aforementioned additions. Of the tests marked SKIP, there are 30 tests that are currently counted as SKIP because they require root permissions, and another 21 that require membership in multiple user groups. It is important to know that coreutils has tests for both root and non-root users. Testing showed that 42 tests are skipped when running as root versus 30 when running as a non-root user, so the decision was made to run the suite as the latter.

Finally, note that the ptest suite for coreutils has a short runtime on x86-64/kvm of approximately 4.5 minutes, in contrast to the arm64 runtime of ~70 minutes.

---
 .../coreutils/coreutils/run-ptest             | 17 +++++++++
 meta/recipes-core/coreutils/coreutils_8.31.bb | 38 +++++++++++++++++++
 2 files changed, 55 insertions(+)
 create mode 100755 meta/recipes-core/coreutils/coreutils/run-ptest
meta/recipes-core/coreutils/coreutils/run-ptest new file +0 -0
new file mode 100755
index 0000000000..683fedee7a

meta/recipes-core/coreutils/coreutils/run-ptest line 3

Quoted 3 lines
meta/recipes-core/coreutils/coreutils/run-ptest new file +3 -0
@@ -0,0 +1,17 @@
+#!/bin/bash
+
+COREUTILSLIB=/usr/lib/coreutils

does this need to consider lib|lib64 care for libdir ?

Quoted 68 lines
meta/recipes-core/coreutils/coreutils/run-ptest new file +14 -0
+LOG="${COREUTILSLIB}/ptest/coreutils_ptest_$(date +%Y%m%d-%H%M%S).log"
+
+addgroup usergroup1
+adduser --ingroup usergroup1 tester
+
+su tester -c "make check-TESTS RUN_EXPENSIVE_TESTS=yes top_srcdir=. srcdir=." | tee -a ${LOG}
+deluser tester
+delgroup usergroup1
+
+passed=`grep PASS ${LOG}|wc -l`
+failed=`grep FAIL ${LOG}|wc -l`
+skipped=`grep -E SKIP ${LOG}|wc -l`
+all=$((passed + failed + skipped))
+
meta/recipes-core/coreutils/coreutils_8.31.bb +38 -1
index 57b2c1bdba..5ce2730048 100644
@@ -143,3 +143,41 @@ python __anonymous() {
 }
 
 BBCLASSEXTEND = "native nativesdk"
+
+inherit ptest
+
+FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
+
+SRC_URI +=     "file://run-ptest"
+RDEPENDS_${PN}-ptest += "bash findutils gawk gdb glibc libconvert-asn1-perl liberror-perl libmodule-build-perl libtimedate-perl liburi-perl make perl perl-module-file-stat python strace"
+
+do_install_ptest () {
+       install -d ${D}${PTEST_PATH}/tests
+       cp -r ${S}/tests/* ${D}${PTEST_PATH}/tests
+       sed -i 's/ginstall/install/g'  `grep -R ginstall ${D}${PTEST_PATH}/tests | awk -F: '{print $1}' | uniq`
+       install -d ${D}${PTEST_PATH}/build-aux
+       install ${S}/build-aux/test-driver ${D}${PTEST_PATH}/build-aux/
+       cp ${B}/Makefile ${D}${PTEST_PATH}/
+       cp ${S}/init.cfg ${D}${PTEST_PATH}/
+       cp -r ${B}/src ${D}${PTEST_PATH}/
+       cp -r ${S}/src/*.c ${D}${PTEST_PATH}/src
+       cd ${D}${PTEST_PATH}
+       tar -czvf ${D}${PTEST_PATH}/src.tar.gz ./src
+       cd -
+       sed -i '/^VPATH/s/= .*$/= ./g' ${D}${PTEST_PATH}/Makefile
+       sed -i '/^PROGRAMS/s/^/#/g' ${D}${PTEST_PATH}/Makefile
+       sed -i '/^Makefile: /s/^.*$/Makefile:/g' ${D}${PTEST_PATH}/Makefile
+       sed -i '/^abs_srcdir/s/= .*$/= \$\{PWD\}/g' ${D}${PTEST_PATH}/Makefile
+       sed -i '/^abs_top_builddir/s/= .*$/= \$\{PWD\}/g' ${D}${PTEST_PATH}/Makefile
+       sed -i '/^abs_top_srcdir/s/= .*$/= \$\{PWD\}/g' ${D}${PTEST_PATH}/Makefile
+       sed -i '/^built_programs/s/ginstall/install/g' ${D}${PTEST_PATH}/Makefile
+   chmod -R 777 ${D}${PTEST_PATH}
+       # Disable subcase stty-pairs.sh, it will cause test framework hang
+       sed -i '/stty-pairs.sh/d' ${D}${PTEST_PATH}/Makefile
+       install ${B}/src/getlimits ${D}/${bindir}
+}
+
+FILES_${PN}-ptest += "${bindir}/getlimits"
+
+INSANE_SKIP_${PN}-ptest += "ldflags"
+INSANE_SKIP_${PN}-ptest += "rpaths"
--

2.23.0

--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core

#3 lore raw

Re: [PATCH 1/1] coreutils: add ptest

In reply to Trevor Gamblin
Quoted 23 lines · Trevor Gamblin

From: Trevor Gamblin <[email protected]>

coreutils has a large number of tests, (and potential RDEPENDS to support them), including tests added with the flags RUN_EXPENSIVE_TESTS and RUN_VERY_EXPENSIVE_TESTS that add significant run time for their coverage. The RUN_VERY_EXPENSIVE_TESTS option has been omitted from the run-ptest script to reduce some of this run time, even though this increases the SKIP count in the results. Also, the ptest directory for coreutils is given blanket permissions at runtime with chmod -R 777 to ensure that the user created for the tests will be able to run the test scripts and create the necessary files in the process.

There is still room to improve the results of this ptest without the aforementioned additions. Of the tests marked SKIP, there are 30 tests that are currently counted as SKIP because they require root permissions, and another 21 that require membership in multiple user groups. It is important to know that coreutils has tests for both root and non-root users. Testing showed that 42 tests are skipped when running as root versus 30 when running as a non-root user, so the decision was made to run the suite as the latter.

Quoted 3 lines

Finally, note that the ptest suite for coreutils has a short runtime on x86-64/kvm of approximately 4.5 minutes, in contrast to the arm64 runtime of ~70 minutes.

Its good to see this coming together thanks. Unfortunately it failed in testing.

Quoted 35 lines
---
 .../coreutils/coreutils/run-ptest             | 17 +++++++++
 meta/recipes-core/coreutils/coreutils_8.31.bb | 38 +++++++++++++++++++
 2 files changed, 55 insertions(+)
 create mode 100755 meta/recipes-core/coreutils/coreutils/run-ptest
meta/recipes-core/coreutils/coreutils/run-ptest new file +17 -0
new file mode 100755
index 0000000000..683fedee7a
@@ -0,0 +1,17 @@
+#!/bin/bash
+
+COREUTILSLIB=/usr/lib/coreutils
+LOG="${COREUTILSLIB}/ptest/coreutils_ptest_$(date +%Y%m%d-%H%M%S).log"
+
+addgroup usergroup1
+adduser --ingroup usergroup1 tester
+
+su tester -c "make check-TESTS RUN_EXPENSIVE_TESTS=yes top_srcdir=. srcdir=." | tee -a ${LOG}
+deluser tester 
+delgroup usergroup1
+
+passed=`grep PASS ${LOG}|wc -l`
+failed=`grep FAIL ${LOG}|wc -l`
+skipped=`grep -E SKIP ${LOG}|wc -l`
+all=$((passed + failed + skipped))
+
meta/recipes-core/coreutils/coreutils_8.31.bb +0 -0
index 57b2c1bdba..5ce2730048 100644

meta/recipes-core/coreutils/coreutils_8.31.bb python __anonymous() { · line 151

Quoted 9 lines
meta/recipes-core/coreutils/coreutils_8.31.bb +6 -0
@@ -143,3 +143,41 @@ python __anonymous() {
 }
 
 BBCLASSEXTEND = "native nativesdk"
+
+inherit ptest
+
+FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
+ 
+SRC_URI += 	"file://run-ptest"

Parsing recipes...WARNING: /home/pokybuild/yocto-worker/musl-qemux86/build/meta/recipes-core/coreutils/coreutils_8.31.bb: Unable to get checksum for coreutils SRC_URI entry run-ptestfile: file could not be found

I think this is a whitespace problem in SRC_URI where file from another url is being added to the string above.

meta/recipes-core/coreutils/coreutils_8.31.bb python __anonymous() { · line 152

Quoted 1 line
meta/recipes-core/coreutils/coreutils_8.31.bb +1 -0
+RDEPENDS_${PN}-ptest += "bash findutils gawk gdb glibc libconvert-asn1-perl liberror-perl libmodule-build-perl libtimedate-perl liburi-perl make perl perl-module-file-stat python strace"

Using glibc here breaks musl builds.

In the next version could you please also update:

meta/conf/distro/include/ptest-packagelists.inc

(this would be a slow ptest)

Cheers,

Richard

#4 lore raw

Re: [PATCH 1/1] coreutils: add ptest

Quoted 81 lines · Richard Purdie
Quoted 23 lines · Trevor Gamblin

From: Trevor Gamblin <[email protected]>

coreutils has a large number of tests, (and potential RDEPENDS to support them), including tests added with the flags RUN_EXPENSIVE_TESTS and RUN_VERY_EXPENSIVE_TESTS that add significant run time for their coverage. The RUN_VERY_EXPENSIVE_TESTS option has been omitted from the run-ptest script to reduce some of this run time, even though this increases the SKIP count in the results. Also, the ptest directory for coreutils is given blanket permissions at runtime with chmod -R 777 to ensure that the user created for the tests will be able to run the test scripts and create the necessary files in the process.

There is still room to improve the results of this ptest without the aforementioned additions. Of the tests marked SKIP, there are 30 tests that are currently counted as SKIP because they require root permissions, and another 21 that require membership in multiple user groups. It is important to know that coreutils has tests for both root and non-root users. Testing showed that 42 tests are skipped when running as root versus 30 when running as a non-root user, so the decision was made to run the suite as the latter.

Quoted 3 lines

Finally, note that the ptest suite for coreutils has a short runtime on x86-64/kvm of approximately 4.5 minutes, in contrast to the arm64 runtime of ~70 minutes.

Its good to see this coming together thanks. Unfortunately it failed in testing.

Quoted 35 lines
---
  .../coreutils/coreutils/run-ptest             | 17 +++++++++
  meta/recipes-core/coreutils/coreutils_8.31.bb | 38 +++++++++++++++++++
  2 files changed, 55 insertions(+)

create mode 100755 meta/recipes-core/coreutils/coreutils/run-ptest

meta/recipes-core/coreutils/coreutils/run-ptest new file +17 -0
new file mode 100755
index 0000000000..683fedee7a
@@ -0,0 +1,17 @@
+#!/bin/bash
+
+COREUTILSLIB=/usr/lib/coreutils
+LOG="${COREUTILSLIB}/ptest/coreutils_ptest_$(date +%Y%m%d-%H%M%S).log"
+
+addgroup usergroup1
+adduser --ingroup usergroup1 tester
+
+su tester -c "make check-TESTS RUN_EXPENSIVE_TESTS=yes top_srcdir=. srcdir=." | tee -a ${LOG}
+deluser tester
+delgroup usergroup1
+
+passed=`grep PASS ${LOG}|wc -l`
+failed=`grep FAIL ${LOG}|wc -l`
+skipped=`grep -E SKIP ${LOG}|wc -l`
+all=$((passed + failed + skipped))
+
meta/recipes-core/coreutils/coreutils_8.31.bb +0 -0
index 57b2c1bdba..5ce2730048 100644

meta/recipes-core/coreutils/coreutils_8.31.bb python __anonymous() { · line 151

Quoted 9 lines
meta/recipes-core/coreutils/coreutils_8.31.bb +6 -0
@@ -143,3 +143,41 @@ python __anonymous() {
  }
 
  BBCLASSEXTEND = "native nativesdk"
+
+inherit ptest
+
+FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
+
+SRC_URI += 	"file://run-ptest"

Parsing recipes...WARNING: /home/pokybuild/yocto-worker/musl-qemux86/build/meta/recipes-core/coreutils/coreutils_8.31.bb: Unable to get checksum for coreutils SRC_URI entry run-ptestfile: file could not be found

I think this is a whitespace problem in SRC_URI where file from another url is being added to the string above.

meta/recipes-core/coreutils/coreutils_8.31.bb python __anonymous() { · line 152

Quoted 1 line
meta/recipes-core/coreutils/coreutils_8.31.bb +1 -0
+RDEPENDS_${PN}-ptest += "bash findutils gawk gdb glibc libconvert-asn1-perl liberror-perl libmodule-build-perl libtimedate-perl liburi-perl make perl perl-module-file-stat python strace"
Quoted 8 lines

Using glibc here breaks musl builds.

In the next version could you please also update:

meta/conf/distro/include/ptest-packagelists.inc

(this would be a slow ptest)

Will do - v2 incoming. Thanks for the catch.

Quoted 4 lines

Cheers,

Richard

#5 lore raw
In reply to Trevor Gamblin
Quoted 7 lines · Trevor Gamblin
MACHINE    | PASS | FAIL | SKIP | TOTAL |
qemux86-64 |  481 |    2 |  132 |   615 |
qemuarm64  |  481 |    2 |  132 |   615 |
MACHINE    | PASS | FAIL | SKIP | TOTAL |
qemux86-64 |  483 |    1 |  131 |   615 |
qemuarm64  |  483 |    1 |  131 |   615 |

One (and two) is very close to zero. Can you reach that?

Alex