summaryrefslogtreecommitdiffstats
path: root/meta/recipes-extended/bash
diff options
context:
space:
mode:
authorRandy MacLeod <Randy.MacLeod@windriver.com>2019-06-16 11:48:17 -0400
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-06-18 11:23:48 +0100
commitb56fb24f03fc0d90725179a401d94ea0c02eecea (patch)
treecabf1c4e904e7dbbb62c05537e1a11c087c87be7 /meta/recipes-extended/bash
parent8478801d4933f8e07fba39f9e1494710aa785679 (diff)
downloadpoky-b56fb24f03fc0d90725179a401d94ea0c02eecea.tar.gz
bash: use setpriv, sed.sed to run ptests
The execscript test in bash fails when run with ptest-runner calling 'su', with the error: bash: cannot set terminal process group (16036): Inappropriate ioctl for device Even with ptest-runner fixed to make a child process use the right process group, 'su' still results in the warning above. Use 'setpriv' instead. 'runuser' was considered and works but depends on pam so it's ruled out. Now that all bash tests are run as a user, the patch: fix-run-coproc-run-heredoc-run-execscript-run-test-f.patch can be removed. Also to create the account 'bashtest' in the 'run-ptest' script the bash-ptest must depend on 'shadow'. Also, in 'run-ptest', ensure that the bash ptests are owned by the 'bashtest' user. Add 'sed' as a dependency for ptests since tests/exp8.sub runs: var=$'x\001y\177z' declare -p var | sed -n l and that results in: sed.busybox: "" sed.sed: declare -- var="x\001y\177z"$ This appears to be a feature that busybox sed has not implemented. With this series of changes, bash-ptest for qemux86-64 passes 79 of 81 tests. The remaining failures are: 1. run-read: # cat tests/read6.sub # test read with a timeout of 0 -- input polling # sleep with fractional seconds argument is not universal echo abcde | { sleep 0.25 2>/dev/null ; read -t 0; } echo $? read -t 0 < $0 echo $? read -t 0 echo $? <-- returns 1, when 0 is expected. I can reproduce this on my workstation but only when using ptest-runner and initially logging into the console as root. That's a little odd and seems like I need to continue to improve ptest-runner. 2. run-trap: # cat tests/trap3.sub PS4='+[$LINENO] ' trap 'echo trap: $LINENO' ERR set -x echo 1 echo 2 echo 3 | cat | false <--- error echo 4 This is a scheduler behaviour difference between the common case on a workstation and the common case in qemu. The test case does warn about the completion order not being deterministic so I plan to ignore it. >From tests/run-trap: UNIX versions number signals and schedule processes differently. If output differing only in line numbers is produced, please do not consider this a test failure. Still, it's notable and slightly odd that the common case output is different. (From OE-Core rev: 81e3f01867cf114b728ab5a417c29426c9bf8122) Signed-off-by: Sakib Sajal <sakib.sajal@windriver.com> Signed-off-by: Randy MacLeod <Randy.MacLeod@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-extended/bash')
-rw-r--r--meta/recipes-extended/bash/bash.inc5
-rw-r--r--meta/recipes-extended/bash/bash/fix-run-coproc-run-heredoc-run-execscript-run-test-f.patch45
-rw-r--r--meta/recipes-extended/bash/bash/run-bash-ptests4
-rw-r--r--meta/recipes-extended/bash/bash/run-ptest10
-rw-r--r--meta/recipes-extended/bash/bash_5.0.bb2
5 files changed, 12 insertions, 54 deletions
diff --git a/meta/recipes-extended/bash/bash.inc b/meta/recipes-extended/bash/bash.inc
index 4cf1054967..c91cc8ada8 100644
--- a/meta/recipes-extended/bash/bash.inc
+++ b/meta/recipes-extended/bash/bash.inc
@@ -23,7 +23,7 @@ ALTERNATIVE_PRIORITY = "100"
23 23
24RDEPENDS_${PN} += "base-files" 24RDEPENDS_${PN} += "base-files"
25RDEPENDS_${PN}_class-nativesdk = "" 25RDEPENDS_${PN}_class-nativesdk = ""
26RDEPENDS_${PN}-ptest += "make coreutils perl" 26RDEPENDS_${PN}-ptest += "make coreutils perl sed shadow util-linux-setpriv"
27 27
28DEPENDS_append_libc-glibc = " virtual/libc-locale" 28DEPENDS_append_libc-glibc = " virtual/libc-locale"
29RDEPENDS_${PN}-ptest_append_libc-glibc = " \ 29RDEPENDS_${PN}-ptest_append_libc-glibc = " \
@@ -36,8 +36,6 @@ RDEPENDS_${PN}-ptest_append_libc-glibc = " \
36 locale-base-fr-fr.iso-8859-1 \ 36 locale-base-fr-fr.iso-8859-1 \
37 locale-base-zh-hk.big5-hkscs \ 37 locale-base-zh-hk.big5-hkscs \
38 " 38 "
39USERADD_PACKAGES = "${PN}-ptest"
40USERADD_PARAM_${PN}-ptest = "--create-home --user-group test"
41 39
42CACHED_CONFIGUREVARS += "headersdir=${includedir}/${PN}" 40CACHED_CONFIGUREVARS += "headersdir=${includedir}/${PN}"
43 41
@@ -74,6 +72,7 @@ do_install_append_class-target () {
74do_install_ptest () { 72do_install_ptest () {
75 make INSTALL_TEST_DIR=${D}${PTEST_PATH}/tests install-test 73 make INSTALL_TEST_DIR=${D}${PTEST_PATH}/tests install-test
76 cp ${B}/Makefile ${D}${PTEST_PATH} 74 cp ${B}/Makefile ${D}${PTEST_PATH}
75 install -D ${WORKDIR}/run-bash-ptests ${D}${PTEST_PATH}/run-bash-ptests
77 sed -i -e 's/^Makefile/_Makefile/' -e "s,--sysroot=${STAGING_DIR_TARGET},,g" \ 76 sed -i -e 's/^Makefile/_Makefile/' -e "s,--sysroot=${STAGING_DIR_TARGET},,g" \
78 -e 's|${DEBUG_PREFIX_MAP}||g' \ 77 -e 's|${DEBUG_PREFIX_MAP}||g' \
79 -e "s,${S},,g" -e "s,${B},,g" -e "s,${STAGING_DIR_NATIVE},,g" \ 78 -e "s,${S},,g" -e "s,${B},,g" -e "s,${STAGING_DIR_NATIVE},,g" \
diff --git a/meta/recipes-extended/bash/bash/fix-run-coproc-run-heredoc-run-execscript-run-test-f.patch b/meta/recipes-extended/bash/bash/fix-run-coproc-run-heredoc-run-execscript-run-test-f.patch
deleted file mode 100644
index 9ac2461ab6..0000000000
--- a/meta/recipes-extended/bash/bash/fix-run-coproc-run-heredoc-run-execscript-run-test-f.patch
+++ /dev/null
@@ -1,45 +0,0 @@
1From d1cd4c31ea0ed7406a3ad4bdaa211f581063f655 Mon Sep 17 00:00:00 2001
2From: Hongxu Jia <hongxu.jia@windriver.com>
3Date: Tue, 15 Aug 2017 10:21:21 +0800
4Subject: [PATCH 2/2] fix run-execscript/run-test/ failed
5
6FAIL: run-execscript:
7the test suite should not be run as root
8
9FAIL: run-test
10the test suite should not be run as root
11
12Upstream-Status: Pending
13
14Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
15---
16 tests/run-execscript | 3 ++-
17 tests/run-test | 3 ++-
18 2 files changed, 4 insertions(+), 2 deletions(-)
19
20diff --git a/tests/run-execscript b/tests/run-execscript
21index de78644..38397c1 100644
22--- a/tests/run-execscript
23+++ b/tests/run-execscript
24@@ -5,5 +5,6 @@ echo "warning: \`/tmp/bash-notthere' not being found or \`/' being a directory"
25 echo "warning: produce diff output, please do not consider this a test failure" >&2
26 echo "warning: if diff output differing only in the location of the bash" >&2
27 echo "warning: binary appears, please do not consider this a test failure" >&2
28-${THIS_SH} ./execscript > ${BASH_TSTOUT} 2>&1
29+rm -f ${BASH_TSTOUT}
30+su -c "${THIS_SH} ./execscript > ${BASH_TSTOUT} 2>&1" test
31 diff ${BASH_TSTOUT} exec.right && rm -f ${BASH_TSTOUT}
32diff --git a/tests/run-test b/tests/run-test
33index d68791c..d6317d2 100644
34--- a/tests/run-test
35+++ b/tests/run-test
36@@ -1,4 +1,5 @@
37 unset GROUPS UID 2>/dev/null
38
39-${THIS_SH} ./test.tests >${BASH_TSTOUT} 2>&1
40+rm -f ${BASH_TSTOUT}
41+su -c "${THIS_SH} ./test.tests > ${BASH_TSTOUT} 2>&1" test
42 diff ${BASH_TSTOUT} test.right && rm -f ${BASH_TSTOUT}
43--
441.8.3.1
45
diff --git a/meta/recipes-extended/bash/bash/run-bash-ptests b/meta/recipes-extended/bash/bash/run-bash-ptests
new file mode 100644
index 0000000000..d73a27224d
--- /dev/null
+++ b/meta/recipes-extended/bash/bash/run-bash-ptests
@@ -0,0 +1,4 @@
1#!/bin/sh
2cd "$(dirname "$0")"
3make -k THIS_SH=/bin/bash BUILD_DIR=`pwd` srcdir=`pwd` runtest
4
diff --git a/meta/recipes-extended/bash/bash/run-ptest b/meta/recipes-extended/bash/bash/run-ptest
index c0cf27b6c2..738ad3c42c 100644
--- a/meta/recipes-extended/bash/bash/run-ptest
+++ b/meta/recipes-extended/bash/bash/run-ptest
@@ -19,8 +19,8 @@ then
19 echo "Warning: The de_DE* locales is needed to run the intl.tests, please add it." 19 echo "Warning: The de_DE* locales is needed to run the intl.tests, please add it."
20fi 20fi
21 21
22useradd bash_user 22useradd bashtest
23chown -R bash_user:bash_user ./tests 23chown -R bashtest:bashtest tests
24su bash_user -c "make -k THIS_SH=/bin/bash BUILD_DIR=`pwd` srcdir=`pwd` runtest" 24setpriv --reuid bashtest --rgid bashtest --clear-groups --reset-env $(dirname "$0")/run-bash-ptests
25chown -R root:root ./tests 25chown -R root:root tests
26userdel bash_user 26userdel -r bashtest
diff --git a/meta/recipes-extended/bash/bash_5.0.bb b/meta/recipes-extended/bash/bash_5.0.bb
index e60e5304a5..eadc82279d 100644
--- a/meta/recipes-extended/bash/bash_5.0.bb
+++ b/meta/recipes-extended/bash/bash_5.0.bb
@@ -16,8 +16,8 @@ SRC_URI = "${GNU_MIRROR}/bash/${BP}.tar.gz;name=tarball \
16 file://mkbuiltins_have_stringize.patch \ 16 file://mkbuiltins_have_stringize.patch \
17 file://build-tests.patch \ 17 file://build-tests.patch \
18 file://test-output.patch \ 18 file://test-output.patch \
19 file://fix-run-coproc-run-heredoc-run-execscript-run-test-f.patch \
20 file://run-ptest \ 19 file://run-ptest \
20 file://run-bash-ptests \
21 file://fix-run-builtins.patch \ 21 file://fix-run-builtins.patch \
22 " 22 "
23 23