Skip to contentSkip to conversation

ptest additions for coreutils

RFC In review Trevor Gamblin 2 participants 3 messages Nov 1, 2019

lore
Share & tools
lore
#0 lore raw

cover ptest additions for coreutils

From: Trevor Gamblin <[email protected]>

coreutils has a large number of tests, and potential RDEPENDS to be added to support them, along with the flags RUN_EXPENSIVE_TESTS and RUN_VERY_EXPENSIVE_TESTS that will add time and coverage. The RUN_VERY_EXPENSIVE_TESTS=yes flag has been omitted from the run-ptest script to reduce run time and issues with timeouts on qemuarm64, even though this increases an already high SKIP count in the results. Similarly, adding valgrind to RDEPENDS will allow additional tests to pass, but this hasn't been included.
Of the tests marked SKIP, there are 30 tests that are currently counted as SKIP because they require sudo permissions, and another 21 that require membership in multiple groups. Additionally, there is an issue with the "make check-TESTS" call finishing clearly during the ptest.
Despite these issues, upstream input was desired before doing further development on the ptest additions.

Trevor Gamblin (1):
coreutils: add ptest

 .../coreutils/coreutils/run-ptest             | 22 +++++++++++
 meta/recipes-core/coreutils/coreutils_8.31.bb | 39 +++++++++++++++++++
 2 files changed, 61 insertions(+)
 create mode 100755 meta/recipes-core/coreutils/coreutils/run-ptest
Signature · 1 line
2.21.0
#1 lore raw

RFC 1/1 coreutils: add ptest

From: Trevor Gamblin <[email protected]>

---
 .../coreutils/coreutils/run-ptest             | 21 ++++++++++
 meta/recipes-core/coreutils/coreutils_8.31.bb | 39 +++++++++++++++++++
 2 files changed, 60 insertions(+)
 create mode 100755 meta/recipes-core/coreutils/coreutils/run-ptest
meta/recipes-core/coreutils/coreutils/run-ptest new file +21 -0
new file mode 100755
index 0000000000..07f34a8d3e
@@ -0,0 +1,21 @@
+#!/bin/bash
+
+COREUTILSLIB=/usr/lib/coreutils
+LOG="${COREUTILSLIB}/ptest/coreutils_ptest_$(date +%Y%m%d-%H%M%S).log"
+
+addgroup usergroup1
+sleep 1
+adduser --ingroup usergroup1 tester
+chmod -R 777 ../ptest
+sleep 2
+
+su tester -c "make check-TESTS top_srcdir=. srcdir=." | tee -a ${LOG}
+sleep 1
+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 +39 -0
index 57b2c1bdba..c9c9df0cfa 100644
@@ -143,3 +143,42 @@ python __anonymous() {
 }
 
 BBCLASSEXTEND = "native nativesdk"
+
+inherit ptest
+
+FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
+ 
+SRC_URI += 	"file://run-ptest"
+RDEPENDS_${PN}-ptest += "bash gdb perl gawk strace perl-module-file-stat libconvert-asn1-perl liberror-perl libmodule-build-perl libtimedate-perl liburi-perl"
+
+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 -
+	rm -rf ${D}${PTEST_PATH}/src
+	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
+
+	# 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.21.0
#2 lore raw

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

Quoted 1 line · Trevor Gamblin

From: Trevor Gamblin <[email protected]>

For the non-RFC you need a longer log including
the current test results on qemux86-64/arm64.

Quoted 14 lines
---
  .../coreutils/coreutils/run-ptest             | 21 ++++++++++
  meta/recipes-core/coreutils/coreutils_8.31.bb | 39 +++++++++++++++++++
  2 files changed, 60 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..07f34a8d3e

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

Quoted 6 lines
meta/recipes-core/coreutils/coreutils/run-ptest new file +6 -0
@@ -0,0 +1,21 @@
+#!/bin/bash
+
+COREUTILSLIB=/usr/lib/coreutils
+LOG="${COREUTILSLIB}/ptest/coreutils_ptest_$(date +%Y%m%d-%H%M%S).log"
+
+addgroup usergroup1

[add|del][group|user] programs are friendlier perl scripts [group|user][add|del] programs are native executables.

It's probably better to use the smaller executables unless you already need perl to run the tests.

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

Quoted 1 line
meta/recipes-core/coreutils/coreutils/run-ptest new file +1 -0
+sleep 1

hmmm....

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

Quoted 3 lines
meta/recipes-core/coreutils/coreutils/run-ptest new file +3 -0
+adduser --ingroup usergroup1 tester
+chmod -R 777 ../ptest
+sleep 2

ugh!

Why did you add the sleeps?

It's not much of a delay given how long the ptests take to run but it's odd to see and none of the run-ptests in oe-core or meta-oe call sleep so it would be setting a bad precedent.

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

Quoted 3 lines
meta/recipes-core/coreutils/coreutils/run-ptest new file +3 -0
+
+su tester -c "make check-TESTS top_srcdir=. srcdir=." | tee -a ${LOG}
+sleep 1

nix.

Quoted 47 lines
meta/recipes-core/coreutils/coreutils/run-ptest new file +8 -0
+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 +29 -0
index 57b2c1bdba..c9c9df0cfa 100644
@@ -143,3 +143,42 @@ python __anonymous() {
  }
 
  BBCLASSEXTEND = "native nativesdk"
+
+inherit ptest
+
+FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
+
+SRC_URI += 	"file://run-ptest"
+RDEPENDS_${PN}-ptest += "bash gdb perl gawk strace perl-module-file-stat libconvert-asn1-perl liberror-perl libmodule-build-perl libtimedate-perl liburi-perl"
 
+
+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 -
+	rm -rf ${D}${PTEST_PATH}/src
+	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

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

Quoted 10 lines
meta/recipes-core/coreutils/coreutils_8.31.bb +10 -0
+
+	# 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"

I think it's a good start for ptests in coreutils.

Signature · 2 lines
# Randy MacLeod
# Wind River Linux