<div dir="ltr">valgrind, gdb and strace are already pulled into core-image-sato-sdk-ptest (the one that runs the slow ptests on the AB), so there is no harm in adding them here as well.<br><div><br></div><div>Alex<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, 26 Feb 2020 at 19:08, Trevor Gamblin &lt;<a href="mailto:trevor.gamblin@windriver.com">trevor.gamblin@windriver.com</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">coreutils has a large number of tests, including some added by the<br>
Makefile flags RUN_EXPENSIVE_TESTS and RUN_VERY_EXPENSIVE_TESTS that<br>
significantly increase runtime (and which have been disabled). Note<br>
that the coreutils ptest directory is given blanket permissions at<br>
runtime with chmod -R 777, to ensure that the user created for the<br>
tests will be able to run the test scripts and create the necessary<br>
files in the process without being impeded by permissions issues.<br>
<br>
There is still room to improve the results of this ptest without<br>
the aforementioned additions. Of the tests marked SKIP, there are<br>
30 tests that are currently counted as SKIP because they require<br>
sudo permissions, and another 21 that require membership in<br>
multiple user groups. It is important to know that coreutils has<br>
tests for both root and non-root users. Testing showed that 42<br>
tests are skipped when running as root versus 30 when running as a<br>
non-root user, so the decision was made to run the suite as the<br>
latter. Additionally, gdb, valgrind, and strace could be included<br>
in the RDEPENDS list to increase pass rate, but their total<br>
contribution is 13 tests, so they were omitted to reduce image size.<br>
<br>
Finally, note that at least one ptest (misc/head-write-error.sh) is<br>
prone to ERROR on builds of core-image-minimal if extra space is<br>
not provided with IMAGE_ROOTFS_EXTRA_SPACE.<br>
<br>
Signed-off-by: Trevor Gamblin &lt;<a href="mailto:trevor.gamblin@windriver.com" target="_blank">trevor.gamblin@windriver.com</a>&gt;<br>
---<br>
 .../coreutils/coreutils/run-ptest             | 17 +++++++++<br>
 meta/recipes-core/coreutils/<a href="http://coreutils_8.31.bb" rel="noreferrer" target="_blank">coreutils_8.31.bb</a> | 37 +++++++++++++++++++<br>
 2 files changed, 54 insertions(+)<br>
 create mode 100755 meta/recipes-core/coreutils/coreutils/run-ptest<br>
<br>
diff --git a/meta/recipes-core/coreutils/coreutils/run-ptest b/meta/recipes-core/coreutils/coreutils/run-ptest<br>
new file mode 100755<br>
index 0000000000..6d4a7b365d<br>
--- /dev/null<br>
+++ b/meta/recipes-core/coreutils/coreutils/run-ptest<br>
@@ -0,0 +1,17 @@<br>
+#!/bin/sh<br>
+<br>
+# remove any stale lock files so that the calls to groupadd/useradd don&#39;t stop<br>
+# the ptest if re-using the same image<br>
+rm -rf /etc/passwd.lock /etc/group.lock /etc/gshadow.lock<br>
+<br>
+COREUTILSLIB=@libdir@/coreutils<br>
+LOG=&quot;${COREUTILSLIB}/ptest/coreutils_ptest_$(date +%Y%m%d-%H%M%S).log&quot;<br>
+USERNAME=&quot;tester&quot;<br>
+groupadd ugroup1<br>
+groupadd ugroup2<br>
+useradd -G ugroup1,ugroup2 $USERNAME || echo &quot;user $USERNAME already exists&quot;<br>
+<br>
+su tester -c &quot;cd ${COREUTILSLIB}/ptest &amp;&amp; make check-TESTS top_srcdir=. srcdir=.&quot; 2&gt;&amp;1 | tee -a ${LOG}<br>
+userdel $USERNAME <br>
+groupdel ugroup1<br>
+groupdel ugroup2<br>
diff --git a/meta/recipes-core/coreutils/<a href="http://coreutils_8.31.bb" rel="noreferrer" target="_blank">coreutils_8.31.bb</a> b/meta/recipes-core/coreutils/<a href="http://coreutils_8.31.bb" rel="noreferrer" target="_blank">coreutils_8.31.bb</a><br>
index 57b2c1bdba..8bec4e0f3c 100644<br>
--- a/meta/recipes-core/coreutils/<a href="http://coreutils_8.31.bb" rel="noreferrer" target="_blank">coreutils_8.31.bb</a><br>
+++ b/meta/recipes-core/coreutils/<a href="http://coreutils_8.31.bb" rel="noreferrer" target="_blank">coreutils_8.31.bb</a><br>
@@ -18,6 +18,7 @@ SRC_URI = &quot;${GNU_MIRROR}/coreutils/${BP}.tar.xz \<br>
            file://0001-uname-report-processor-and-hardware-correctly.patch \<br>
            file://disable-ls-output-quoting.patch \<br>
            file://0001-local.mk-fix-cross-compiling-problem.patch \<br>
+           file://run-ptest \<br>
           &quot;<br>
<br>
 SRC_URI_append_libc-musl = &quot;file://strtod_fix_clash_with_strtold.patch&quot;<br>
@@ -143,3 +144,39 @@ python __anonymous() {<br>
 }<br>
<br>
 BBCLASSEXTEND = &quot;native nativesdk&quot;<br>
+<br>
+inherit ptest<br>
+<br>
+RDEPENDS_${PN}-ptest += &quot;bash findutils gawk liberror-perl libmodule-build-perl make perl perl-module-file-stat python3-core sed shadow&quot;<br>
+<br>
+do_install_ptest () {<br>
+    install -d ${D}${PTEST_PATH}/tests<br>
+    cp -r ${S}/tests/* ${D}${PTEST_PATH}/tests<br>
+    sed -i &#39;s/ginstall/install/g&#39;  `grep -R ginstall ${D}${PTEST_PATH}/tests | awk -F: &#39;{print $1}&#39; | uniq`<br>
+    install -d ${D}${PTEST_PATH}/build-aux<br>
+    install ${S}/build-aux/test-driver ${D}${PTEST_PATH}/build-aux/<br>
+    cp ${B}/Makefile ${D}${PTEST_PATH}/<br>
+    cp ${S}/init.cfg ${D}${PTEST_PATH}/<br>
+    cp -r ${B}/src ${D}${PTEST_PATH}/<br>
+    cp -r ${S}/src/*.c ${D}${PTEST_PATH}/src<br>
+    sed -i &#39;/^VPATH/s/= .*$/= ./g&#39; ${D}${PTEST_PATH}/Makefile<br>
+    sed -i &#39;/^PROGRAMS/s/^/#/g&#39; ${D}${PTEST_PATH}/Makefile<br>
+    sed -i &#39;/^Makefile: /s/^.*$/Makefile:/g&#39; ${D}${PTEST_PATH}/Makefile<br>
+    sed -i &#39;/^abs_srcdir/s/= .*$/= \$\{PWD\}/g&#39; ${D}${PTEST_PATH}/Makefile<br>
+    sed -i &#39;/^abs_top_builddir/s/= .*$/= \$\{PWD\}/g&#39; ${D}${PTEST_PATH}/Makefile<br>
+    sed -i &#39;/^abs_top_srcdir/s/= .*$/= \$\{PWD\}/g&#39; ${D}${PTEST_PATH}/Makefile<br>
+    sed -i &#39;/^built_programs/s/ginstall/install/g&#39; ${D}${PTEST_PATH}/Makefile<br>
+    chmod -R 777 ${D}${PTEST_PATH}<br>
+<br>
+    # Disable subcase stty-pairs.sh, it will cause test framework hang<br>
+    sed -i &#39;/<a href="http://stty-pairs.sh/d" rel="noreferrer" target="_blank">stty-pairs.sh/d</a>&#39; ${D}${PTEST_PATH}/Makefile<br>
+<br>
+    # Tweak test d_type-check to use python3 instead of python<br>
+    sed -i &quot;1s@.*@#!/usr/bin/python3@&quot; ${WORKDIR}/image/usr/lib/coreutils/ptest/tests/d_type-check<br>
+    install ${B}/src/getlimits ${D}/${bindir}<br>
+    <br>
+    # handle multilib<br>
+    sed -i s:@libdir@:${libdir}:g ${D}${PTEST_PATH}/run-ptest<br>
+}<br>
+<br>
+FILES_${PN}-ptest += &quot;${bindir}/getlimits&quot;<br>
-- <br>
2.24.1<br>
<br>
-- <br>
_______________________________________________<br>
Openembedded-core mailing list<br>
<a href="mailto:Openembedded-core@lists.openembedded.org" target="_blank">Openembedded-core@lists.openembedded.org</a><br>
<a href="http://lists.openembedded.org/mailman/listinfo/openembedded-core" rel="noreferrer" target="_blank">http://lists.openembedded.org/mailman/listinfo/openembedded-core</a><br>
</blockquote></div>