On Mon, Feb 18, 2019 at 2:53 AM Rainer Orth <r...@cebitec.uni-bielefeld.de> 
wrote:
>
> > On Feb 18 2019, Rainer Orth <r...@cebitec.uni-bielefeld.de> wrote:
> >
> >> diff --git a/libgo/testsuite/gotest b/libgo/testsuite/gotest
> >> --- a/libgo/testsuite/gotest
> >> +++ b/libgo/testsuite/gotest
> >> @@ -627,13 +627,13 @@ symtogo() {
> >>                                   -e 's/[    ]*$/\\n/g' |
> >>                               tr -d '\n')"
> >>                  # Remove leading and trailing \n.
> >> -                output="$(echo "$output" | sed -e 's/^\(\\n\)*//' -e 
> >> 's/\(\\n\)*$//')"
> >> +                output="$(printf %s "$output" | sed -e 's/^\(\\n\)*//' -e 
> >> 's/\(\\n\)*$//')"
> >
> > printf %s does not print a trailing newline, and some implementations of
> > sed cannot cope with incomplete lines.
>
> configure uses
>
> as_echo='printf %s\n'
> as_echo_n='printf %s'
>
> here.  To avoid duplicating all that logic to determine a suitable echo,
> it would be good to be able to reuse it.
>
> My patch is clearly just a hack to get rid of those failures.

I think we can just skip echo and printf entirely.  Can you see if
this patch fixes the problems?  Thanks.

Ian
diff --git a/libgo/testsuite/gotest b/libgo/testsuite/gotest
index 06000eae..017e5a34 100755
--- a/libgo/testsuite/gotest
+++ b/libgo/testsuite/gotest
@@ -619,21 +619,23 @@ 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', "'"$(cat example2.txt)"'", 
'$unordered'},'
+                   rm -f example2.txt
                fi
        done
        echo '}'

Reply via email to