diff options
author | Pedro Alves <palves@redhat.com> | 2015-03-09 17:47:17 +0000 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2015-03-09 17:47:17 +0000 |
commit | ef878e5310ed154450b84cdedd4dd248c7697a2c (patch) | |
tree | bcbf5ac6ba931a634504bf20c5aef0b609fc83ee /gdb/testsuite | |
parent | 411b642274178fe112712b11db805e6ac9e05d71 (diff) | |
download | gdb-ef878e5310ed154450b84cdedd4dd248c7697a2c.zip gdb-ef878e5310ed154450b84cdedd4dd248c7697a2c.tar.gz gdb-ef878e5310ed154450b84cdedd4dd248c7697a2c.tar.bz2 |
Make dg-extract-results.sh explicitly treat .{sum,log} files as text
This merges Sergio's fix from GCC:
https://gcc.gnu.org/ml/gcc-patches/2014-12/msg01293.html
gdb/testsuite/ChangeLog:
2015-03-09 Pedro Alves <palves@redhat.com>
Merge dg-extract-results.sh from GCC upstream (r218843).
2014-12-17 Sergio Durigan Junior <sergiodj@redhat.com>
* dg-extract-results.sh: Use --text with grep to avoid issues with
binary files. Fall back to cat -v, if that doesn't work.
Diffstat (limited to 'gdb/testsuite')
-rw-r--r-- | gdb/testsuite/ChangeLog | 8 | ||||
-rwxr-xr-x | gdb/testsuite/dg-extract-results.sh | 25 |
2 files changed, 28 insertions, 5 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index dd98483..7c39f76 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2015-03-09 Pedro Alves <palves@redhat.com> + + Merge dg-extract-results.sh from GCC upstream (r218843). + + 2014-12-17 Sergio Durigan Junior <sergiodj@redhat.com> + * dg-extract-results.sh: Use --text with grep to avoid issues with + binary files. Fall back to cat -v, if that doesn't work. + 2015-03-05 Pedro Alves <palves@redhat.com> * gdb.base/bp-permanent.exp: Tighten "next over setup" regex. diff --git a/gdb/testsuite/dg-extract-results.sh b/gdb/testsuite/dg-extract-results.sh index b083908..90c764c 100755 --- a/gdb/testsuite/dg-extract-results.sh +++ b/gdb/testsuite/dg-extract-results.sh @@ -125,13 +125,28 @@ do done test $ERROR -eq 0 || exit 1 +# Test if grep supports the '--text' option + +GREP=grep + +if echo -e '\x00foo\x00' | $GREP --text foo > /dev/null 2>&1 ; then + GREP="grep --text" +else + # Our grep does not recognize the '--text' option. We have to + # treat our files in order to remove any non-printable character. + for file in $SUM_FILES ; do + mv $file ${file}.orig + cat -v ${file}.orig > $file + done +fi + if [ -z "$TOOL" ]; then # If no tool was specified, all specified summary files must be for # the same tool. - CNT=`grep '=== .* tests ===' $SUM_FILES | $AWK '{ print $3 }' | sort -u | wc -l` + CNT=`$GREP '=== .* tests ===' $SUM_FILES | $AWK '{ print $3 }' | sort -u | wc -l` if [ $CNT -eq 1 ]; then - TOOL=`grep '=== .* tests ===' $FIRST_SUM | $AWK '{ print $2 }'` + TOOL=`$GREP '=== .* tests ===' $FIRST_SUM | $AWK '{ print $2 }'` else msg "${PROGNAME}: sum files are for multiple tools, specify a tool" msg "" @@ -142,7 +157,7 @@ else # Ignore the specified summary files that are not for this tool. This # should keep the relevant files in the same order. - SUM_FILES=`grep -l "=== $TOOL" $SUM_FILES` + SUM_FILES=`$GREP -l "=== $TOOL" $SUM_FILES` if test -z "$SUM_FILES" ; then msg "${PROGNAME}: none of the specified files are results for $TOOL" exit 1 @@ -231,7 +246,7 @@ else VARIANTS="" for VAR in $VARS do - grep "Running target $VAR" $SUM_FILES > /dev/null && VARIANTS="$VARIANTS $VAR" + $GREP "Running target $VAR" $SUM_FILES > /dev/null && VARIANTS="$VARIANTS $VAR" done fi @@ -433,6 +448,6 @@ cat ${TMP}/var-* | $AWK -f $TOTAL_AWK # This is ugly, but if there's version output from the compiler under test # at the end of the file, we want it. The other thing that might be there # is the final summary counts. -tail -2 $FIRST_SUM | grep '^#' > /dev/null || tail -2 $FIRST_SUM +tail -2 $FIRST_SUM | $GREP '^#' > /dev/null || tail -2 $FIRST_SUM exit 0 |