summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHongxu Jia <hongxu.jia@windriver.com>2015-11-28 14:53:40 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-12-12 23:42:53 +0000
commita74258671f63f0d61e494ee7aa42b8756967a60a (patch)
treece2623c70400e481563cb6168c93e06b727054f7
parenta6bb872fd3a14d2dab5058a6533a44c6ea7c7de4 (diff)
downloadpoky-a74258671f63f0d61e494ee7aa42b8756967a60a.tar.gz
bash: fix testcase run-coproc/run-execscript/run-test/run-heredoc failed
Add user 'test' to fix the failure of 'the test suite should not be run as root'(run-execscript and run-test) Backport test case from git://git.sv.gnu.org/bash.git to fix run-execscript and run-heredoc Still failed cases: FAIL: run-intl FAIL: run-lastpipe FAIL: run-trap YOCTO: 5698 (From OE-Core rev: 1096140cb1d2532ecb38ac5fbbbe13d40fdaf6af) Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-extended/bash/bash.inc3
-rw-r--r--meta/recipes-extended/bash/bash/fix-run-coproc-run-heredoc-run-execscript-run-test-f.patch169
-rw-r--r--meta/recipes-extended/bash/bash/run-ptest2
-rw-r--r--meta/recipes-extended/bash/bash_4.3.30.bb1
4 files changed, 174 insertions, 1 deletions
diff --git a/meta/recipes-extended/bash/bash.inc b/meta/recipes-extended/bash/bash.inc
index 020409fb6d..85639d3bb9 100644
--- a/meta/recipes-extended/bash/bash.inc
+++ b/meta/recipes-extended/bash/bash.inc
@@ -23,6 +23,9 @@ RDEPENDS_${PN} += "base-files"
23RDEPENDS_${PN}_class-nativesdk = "" 23RDEPENDS_${PN}_class-nativesdk = ""
24RDEPENDS_${PN}-ptest += "make" 24RDEPENDS_${PN}-ptest += "make"
25 25
26USERADD_PACKAGES = "${PN}-ptest"
27USERADD_PARAM_${PN}-ptest = "--create-home --user-group test"
28
26do_configure_prepend () { 29do_configure_prepend () {
27 if [ ! -e ${S}/acinclude.m4 ]; then 30 if [ ! -e ${S}/acinclude.m4 ]; then
28 cat ${S}/aclocal.m4 > ${S}/acinclude.m4 31 cat ${S}/aclocal.m4 > ${S}/acinclude.m4
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
new file mode 100644
index 0000000000..7f099ae0c6
--- /dev/null
+++ b/meta/recipes-extended/bash/bash/fix-run-coproc-run-heredoc-run-execscript-run-test-f.patch
@@ -0,0 +1,169 @@
1From 2c30dff8ea8b17ad5ba9881e35ad1eba9c515f13 Mon Sep 17 00:00:00 2001
2From: Hongxu Jia <hongxu.jia@windriver.com>
3Date: Thu, 26 Nov 2015 22:09:07 -0500
4Subject: [PATCH] fix run-coproc/run-heredoc/run-execscript/run-test/ failed
5
6FAIL: run-coproc
7update test case:tests/coproc.right, tests/coproc.tests
8git://git.sv.gnu.org/bash.git bash-4.4-testing
9
10FAIL: run-heredoc
11update test case: tests/heredoc.right tests/heredoc3.sub
12git://git.sv.gnu.org/bash.git bash-4.4-testing
13
14FAIL: run-execscript:
15the test suite should not be run as root
16
17FAIL: run-test
18the test suite should not be run as root
19
20Upstream-Status: Pending
21
22Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
23---
24 tests/coproc.right | 5 +----
25 tests/coproc.tests | 30 +++++++++++++++++++++++++-----
26 tests/heredoc.right | 5 ++---
27 tests/heredoc3.sub | 3 ++-
28 tests/run-execscript | 3 ++-
29 tests/run-test | 3 ++-
30 6 files changed, 34 insertions(+), 15 deletions(-)
31
32diff --git a/tests/coproc.right b/tests/coproc.right
33index 6d9deaa..94b001c 100644
34--- a/tests/coproc.right
35+++ b/tests/coproc.right
36@@ -1,11 +1,8 @@
37-84575
38 63 60
39 a b c
40-84577
41 63 60
42 flop
43-./coproc.tests: line 22: 84577 Terminated coproc REFLECT { cat -; }
44-84579
45+coproc.tests: REFLECT: status 143
46 63 60
47 FOO
48 63 60
49diff --git a/tests/coproc.tests b/tests/coproc.tests
50index 8be3563..d347eb7 100644
51--- a/tests/coproc.tests
52+++ b/tests/coproc.tests
53@@ -1,6 +1,13 @@
54+: ${TMPDIR:=/tmp}
55+TMPOUT=${TMPDIR}/coproc-wait-$BASHPID
56+
57 coproc { echo a b c; sleep 2; }
58
59-echo $COPROC_PID
60+case $COPROC_PID in
61+[0-9]*) ;;
62+*) echo COPROC_PID not integer ;;
63+esac
64+
65 echo ${COPROC[@]}
66
67 read LINE <&${COPROC[0]}
68@@ -10,7 +17,11 @@ wait $COPROC_PID
69
70 coproc REFLECT { cat - ; }
71
72-echo $REFLECT_PID
73+case $REFLECT_PID in
74+[0-9]*) ;;
75+*) echo REFLECT_PID not integer ;;
76+esac
77+
78 echo ${REFLECT[@]}
79
80 echo flop >&${REFLECT[1]}
81@@ -18,12 +29,21 @@ read LINE <&${REFLECT[0]}
82
83 echo $LINE
84
85-kill $REFLECT_PID
86-wait $REFLECT_PID
87+{ sleep 1; kill $REFLECT_PID; } &
88+wait $REFLECT_PID >$TMPOUT 2>&1 || echo "coproc.tests: REFLECT: status $?"
89+grep 'Terminated.*coproc.*REFLECT' < $TMPOUT >/dev/null 2>&1 || {
90+ echo "coproc.tests: wait for REFLECT failed" >&2
91+}
92+rm -f $TMPOUT
93+exec 2>&1
94
95 coproc xcase -n -u
96
97-echo $COPROC_PID
98+case $COPROC_PID in
99+[0-9]*) ;;
100+*) echo COPROC_PID not integer ;;
101+esac
102+
103 echo ${COPROC[@]}
104
105 echo foo >&${COPROC[1]}
106diff --git a/tests/heredoc.right b/tests/heredoc.right
107index 6abaa1f..8df91c5 100644
108--- a/tests/heredoc.right
109+++ b/tests/heredoc.right
110@@ -76,15 +76,14 @@ ENDEND
111 end ENDEND
112 hello
113 end hello
114-x star x
115 end x*x
116 helloEND
117 end helloEND
118 hello
119 \END
120 end hello<NL>\END
121-./heredoc3.sub: line 74: warning: here-document at line 72 delimited by end-of-file (wanted `EOF')
122-./heredoc3.sub: line 75: syntax error: unexpected end of file
123+./heredoc3.sub: line 75: warning: here-document at line 73 delimited by end-of-file (wanted `EOF')
124+./heredoc3.sub: line 76: syntax error: unexpected end of file
125 comsub here-string
126 ./heredoc.tests: line 105: warning: here-document at line 103 delimited by end-of-file (wanted `EOF')
127 hi
128diff --git a/tests/heredoc3.sub b/tests/heredoc3.sub
129index 73a111e..9d3d846 100644
130--- a/tests/heredoc3.sub
131+++ b/tests/heredoc3.sub
132@@ -49,9 +49,10 @@ hello
133 END
134 echo end hello
135
136-cat <<x*x & touch 'x*x'
137+cat <<x*x >/dev/null & touch 'x*x'
138 x star x
139 x*x
140+wait $!
141 echo end 'x*x'
142 rm 'x*x'
143
144diff --git a/tests/run-execscript b/tests/run-execscript
145index f97ab21..0d00a1b 100644
146--- a/tests/run-execscript
147+++ b/tests/run-execscript
148@@ -5,5 +5,6 @@ echo "warning: \`/tmp/bash-notthere' not being found or \`/' being a directory"
149 echo "warning: produce diff output, please do not consider this a test failure" >&2
150 echo "warning: if diff output differing only in the location of the bash" >&2
151 echo "warning: binary appears, please do not consider this a test failure" >&2
152-${THIS_SH} ./execscript > /tmp/xx 2>&1
153+rm -f /tmp/xx
154+su -c "${THIS_SH} ./execscript > /tmp/xx 2>&1" test
155 diff /tmp/xx exec.right && rm -f /tmp/xx
156diff --git a/tests/run-test b/tests/run-test
157index b2482c3..2e8f049 100644
158--- a/tests/run-test
159+++ b/tests/run-test
160@@ -1,4 +1,5 @@
161 unset GROUPS UID 2>/dev/null
162
163-${THIS_SH} ./test.tests >/tmp/xx 2>&1
164+rm -f /tmp/xx
165+su -c "${THIS_SH} ./test.tests >/tmp/xx 2>&1" test
166 diff /tmp/xx test.right && rm -f /tmp/xx
167--
1681.9.1
169
diff --git a/meta/recipes-extended/bash/bash/run-ptest b/meta/recipes-extended/bash/bash/run-ptest
index e3f813381b..2098fa46ba 100644
--- a/meta/recipes-extended/bash/bash/run-ptest
+++ b/meta/recipes-extended/bash/bash/run-ptest
@@ -1,2 +1,2 @@
1#!/bin/sh 1#!/bin/sh
2make -k THIS_SH=/bin/bash BUILD_DIR=. srcdir=. runtest 2make -k THIS_SH=/bin/bash BUILD_DIR=`pwd` srcdir=`pwd` runtest
diff --git a/meta/recipes-extended/bash/bash_4.3.30.bb b/meta/recipes-extended/bash/bash_4.3.30.bb
index 811e61c798..4426cf00a0 100644
--- a/meta/recipes-extended/bash/bash_4.3.30.bb
+++ b/meta/recipes-extended/bash/bash_4.3.30.bb
@@ -18,6 +18,7 @@ SRC_URI = "${GNU_MIRROR}/bash/${BP}.tar.gz;name=tarball \
18 file://mkbuiltins_have_stringize.patch \ 18 file://mkbuiltins_have_stringize.patch \
19 file://build-tests.patch \ 19 file://build-tests.patch \
20 file://test-output.patch \ 20 file://test-output.patch \
21 file://fix-run-coproc-run-heredoc-run-execscript-run-test-f.patch \
21 file://run-ptest \ 22 file://run-ptest \
22 " 23 "
23 24