diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2019-03-01 01:03:54 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2019-03-01 01:03:54 +0000 |
commit | 5b2eaa1170aa135450a1180a525bf1ed7c34eb3a (patch) | |
tree | f9b81d5baa2a1ecaf6abd0ff30d2456986df5f40 /libgo/testsuite | |
parent | 1e157582240340948b3f67fd6ea9fab892283f61 (diff) | |
download | gcc-5b2eaa1170aa135450a1180a525bf1ed7c34eb3a.zip gcc-5b2eaa1170aa135450a1180a525bf1ed7c34eb3a.tar.gz gcc-5b2eaa1170aa135450a1180a525bf1ed7c34eb3a.tar.bz2 |
commit 66ac9466852d11e968f8fd2ad6ffc7386cee49e1
gotest: avoid using echo inside $()
The handling of newlines is not portable between bash and ksh.
Reviewed-on: https://go-review.googlesource.com/c/164597
From-SVN: r269298
Diffstat (limited to 'libgo/testsuite')
-rwxr-xr-x | libgo/testsuite/gotest | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/libgo/testsuite/gotest b/libgo/testsuite/gotest index 06000ea..c9c1465 100755 --- a/libgo/testsuite/gotest +++ b/libgo/testsuite/gotest @@ -619,21 +619,25 @@ symtogo() { # Turn pairs of spaces into " \x20", because $() will # drop duplicate spaces. # Drop trailing spaces, and turn newlines into \n. - output="$(sed '1 s/\([Uu]nordered \)\?[Oo]utput:[ ]*//' < example.txt | + # Remove leading and trailing \n. + sed '1 s/\([Uu]nordered \)\?[Oo]utput:[ ]*//' < example.txt | sed -e 's/\\/\\\\/g' \ -e 's/"/\\"/g' \ -e 's/ /\\t/g' \ -e 's/ / \\x20/g' \ -e 's/[ ]*$/\\n/g' | - tr -d '\n')" - # Remove leading and trailing \n. - output="$(echo "$output" | sed -e 's/^\(\\n\)*//' -e 's/\(\\n\)*$//')" + tr -d '\n' | + sed -e 's/^\(\\n\)*//' \ + -e 's/\(\\n\)*$//' > example2.txt hasoutput=true rm -f example.txt break done if test x$hasoutput = xtrue; then - echo ' {"'$n'", '$j', "'"$output"'", '$unordered'},' + echo ' {"'$n'", '$j',' + sed -e 's/^/ "/' -e 's/$/", /' < example2.txt + echo $unordered'},' + rm -f example2.txt fi done echo '}' |