Commit 64e6d5c4 by Sergio Durigan Junior Committed by Mike Stump

dg-extract-results.sh: Use --text with grep to avoid issues with binary files.

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.

From-SVN: r218843
parent 113050e7
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.
2014-12-12 Chung-Ju Wu <jasonwucj@gmail.com> 2014-12-12 Chung-Ju Wu <jasonwucj@gmail.com>
* download_prerequisites: Modify the comment for GRAPHITE_LOOP_OPT. * download_prerequisites: Modify the comment for GRAPHITE_LOOP_OPT.
......
...@@ -127,13 +127,28 @@ do ...@@ -127,13 +127,28 @@ do
done done
test $ERROR -eq 0 || exit 1 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 [ -z "$TOOL" ]; then
# If no tool was specified, all specified summary files must be for # If no tool was specified, all specified summary files must be for
# the same tool. # 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 if [ $CNT -eq 1 ]; then
TOOL=`grep '=== .* tests ===' $FIRST_SUM | $AWK '{ print $2 }'` TOOL=`$GREP '=== .* tests ===' $FIRST_SUM | $AWK '{ print $2 }'`
else else
msg "${PROGNAME}: sum files are for multiple tools, specify a tool" msg "${PROGNAME}: sum files are for multiple tools, specify a tool"
msg "" msg ""
...@@ -144,7 +159,7 @@ else ...@@ -144,7 +159,7 @@ else
# Ignore the specified summary files that are not for this tool. This # Ignore the specified summary files that are not for this tool. This
# should keep the relevant files in the same order. # 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 if test -z "$SUM_FILES" ; then
msg "${PROGNAME}: none of the specified files are results for $TOOL" msg "${PROGNAME}: none of the specified files are results for $TOOL"
exit 1 exit 1
...@@ -233,7 +248,7 @@ else ...@@ -233,7 +248,7 @@ else
VARIANTS="" VARIANTS=""
for VAR in $VARS for VAR in $VARS
do do
grep "Running target $VAR" $SUM_FILES > /dev/null && VARIANTS="$VARIANTS $VAR" $GREP "Running target $VAR" $SUM_FILES > /dev/null && VARIANTS="$VARIANTS $VAR"
done done
fi fi
...@@ -435,6 +450,6 @@ cat ${TMP}/var-* | $AWK -f $TOTAL_AWK ...@@ -435,6 +450,6 @@ cat ${TMP}/var-* | $AWK -f $TOTAL_AWK
# This is ugly, but if there's version output from the compiler under test # 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 # at the end of the file, we want it. The other thing that might be there
# is the final summary counts. # 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 exit 0
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment