Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 1 | From 2c30dff8ea8b17ad5ba9881e35ad1eba9c515f13 Mon Sep 17 00:00:00 2001 |
| 2 | From: Hongxu Jia <hongxu.jia@windriver.com> |
| 3 | Date: Thu, 26 Nov 2015 22:09:07 -0500 |
| 4 | Subject: [PATCH] fix run-coproc/run-heredoc/run-execscript/run-test/ failed |
| 5 | |
| 6 | FAIL: run-coproc |
| 7 | update test case:tests/coproc.right, tests/coproc.tests |
| 8 | git://git.sv.gnu.org/bash.git bash-4.4-testing |
| 9 | |
| 10 | FAIL: run-heredoc |
| 11 | update test case: tests/heredoc.right tests/heredoc3.sub |
| 12 | git://git.sv.gnu.org/bash.git bash-4.4-testing |
| 13 | |
| 14 | FAIL: run-execscript: |
| 15 | the test suite should not be run as root |
| 16 | |
| 17 | FAIL: run-test |
| 18 | the test suite should not be run as root |
| 19 | |
| 20 | Upstream-Status: Pending |
| 21 | |
| 22 | Signed-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 | |
| 32 | diff --git a/tests/coproc.right b/tests/coproc.right |
| 33 | index 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 |
| 49 | diff --git a/tests/coproc.tests b/tests/coproc.tests |
| 50 | index 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]} |
| 106 | diff --git a/tests/heredoc.right b/tests/heredoc.right |
| 107 | index 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 |
| 128 | diff --git a/tests/heredoc3.sub b/tests/heredoc3.sub |
| 129 | index 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 | |
| 144 | diff --git a/tests/run-execscript b/tests/run-execscript |
| 145 | index 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 |
| 156 | diff --git a/tests/run-test b/tests/run-test |
| 157 | index 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 | -- |
| 168 | 1.9.1 |
| 169 | |