From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 55692 invoked by alias); 9 Mar 2015 17:50:34 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 55510 invoked by uid 89); 9 Mar 2015 17:50:32 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Mon, 09 Mar 2015 17:50:30 +0000 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t29HoTSO024006 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Mon, 9 Mar 2015 13:50:29 -0400 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t29HoRZK017199; Mon, 9 Mar 2015 13:50:28 -0400 Message-ID: <54FDDD63.8040209@redhat.com> Date: Mon, 09 Mar 2015 17:50:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0 MIME-Version: 1.0 To: Sergio Durigan Junior CC: GDB Patches Subject: Merge 'Make dg-extract-results.sh explicitly treat .{sum,log}, files as text' change (Re: [PATCH] Merge dg-extract-results.{sh,py} from GCC upstream) References: <1418686405-29922-1-git-send-email-sergiodj@redhat.com> <54DD0C8F.6050303@redhat.com> <87zj8idg6r.fsf@redhat.com> In-Reply-To: <87zj8idg6r.fsf@redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-SW-Source: 2015-03/txt/msg00226.txt.bz2 On 02/12/2015 08:32 PM, Sergio Durigan Junior wrote: > On Thursday, February 12 2015, Pedro Alves wrote: >> > I think we should remove dg-extract-results.py, and re-sync >> > dg-extract-results.sh from the gcc repo to pick up your fix for >> > the grep/binary issue that went in meanwhile. >> > > I'm in favor. But just to be safe (sorry for repeating): we need to > pick up my fix from GCC. Otherwise the BuildBot wil be badly affected. Done that now. (The gcc/gdb files are in sync with this.) --- >From ef878e5310ed154450b84cdedd4dd248c7697a2c Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Mon, 9 Mar 2015 17:47:17 +0000 Subject: [PATCH 1/2] 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 Merge dg-extract-results.sh from GCC upstream (r218843). 2014-12-17 Sergio Durigan Junior * dg-extract-results.sh: Use --text with grep to avoid issues with binary files. Fall back to cat -v, if that doesn't work. --- gdb/testsuite/ChangeLog | 8 ++++++++ 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 + + Merge dg-extract-results.sh from GCC upstream (r218843). + + 2014-12-17 Sergio Durigan Junior + * 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 * 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 -- 1.9.3