diff mbox

PATCH: Add capability to contrib/compare_tests to handle directories

Message ID CAEhygDrTfvQiHmqS=SaxEDFZ3D-r6oDrRCeszGX8pkTZ6hHRYA@mail.gmail.com
State New
Headers show

Commit Message

Quentin Neill Feb. 14, 2012, 4:39 p.m. UTC
On Sat, Feb 11, 2012 at 8:13 AM, Mike Stump <mikestump@comcast.net> wrote:
> On Nov 4, 2011, at 8:23 PM, Quentin Neill wrote:
>> My scenario about "ANY test results changed" is what I added with -strict.
>> This patch concatenates the common .sum files before comparing.
>
> So, how exactly does this work for you:
>
> +       ( for fname in `cat $lst5`; do cat $1/$fname; done ) >$sum1
> +       ( for fname in `cat $lst5`; do cat $2/$fname; done ) >$sum2
> +       echo "## ${CONFIG_SHELL-/bin/sh} $0 $strict $sum1 $sum2"
> +       ${CONFIG_SHELL-/bin/sh} $0 $strict $sum1 $sum2
>
> sum1 and sum2 appear to be variables that aren't set.

Hi Mike,

Thanks for the fix.  This seemed familiar, and upon review it looks
like I never committed this fix:
http://gcc.gnu.org/ml/gcc-patches/2011-11/msg01194.html


Do you prefer this patch with my original intent (declaring sum1/sum2
with other tmps and removing the trap on line 52):

 [ "$1" = "-?" ] && usage
@@ -60,8 +62,8 @@ if [ -d "$1" -a -d "$2" ] ; then
    echo "## Dir2=$2: `cat $lst2 | wc -l` sum files"
    echo
    # remove leading directory components to compare
-   sed -e "s|^$1/||" $lst1 | sort >$lst3
-   sed -e "s|^$2/||" $lst2 | sort >$lst4
+   sed -e "s|^$1[/]*||" $lst1 | sort >$lst3
+   sed -e "s|^$2[/]*||" $lst2 | sort >$lst4
    comm -23 $lst3 $lst4 >$lst5
    if [ -s $lst5 ] ; then
        echo "# Extra sum files in Dir1=$1"
@@ -83,14 +85,11 @@ if [ -d "$1" -a -d "$2" ] ; then
        exit $exit_status
    fi
    cmnsums=`cat $lst5 | wc -l`
-   sum1="/tmp/$tool-sum-1"
-   sum2="/tmp/$tool-sum-2"
    echo "# Comparing $cmnsums common sum files"
    ( for fname in `cat $lst5`; do cat $1/$fname; done ) >$sum1
    ( for fname in `cat $lst5`; do cat $2/$fname; done ) >$sum2
    echo "## ${CONFIG_SHELL-/bin/sh} $0 $strict $sum1 $sum2"
    ${CONFIG_SHELL-/bin/sh} $0 $strict $sum1 $sum2
-   rm -f $sum1 $sum2
    ret=$?
    if [ $ret -ne 0 ]; then
        exit_status=`expr $exit_status + 1`



Or would you prefer this minimal fix (to remove trailing directory slashes)?

@@ -60,8 +60,8 @@ if [ -d "$1" -a -d "$2" ] ; then
    echo "## Dir2=$2: `cat $lst2 | wc -l` sum files"
    echo
    # remove leading directory components to compare
-   sed -e "s|^$1/||" $lst1 | sort >$lst3
-   sed -e "s|^$2/||" $lst2 | sort >$lst4
+   sed -e "s|^$1[/]*||" $lst1 | sort >$lst3
+   sed -e "s|^$2[/]*||" $lst2 | sort >$lst4
    comm -23 $lst3 $lst4 >$lst5
    if [ -s $lst5 ] ; then
        echo "# Extra sum files in Dir1=$1"


And if so, okay to commit?

Comments

Quentin Neill Feb. 14, 2012, 4:41 p.m. UTC | #1
On Tue, Feb 14, 2012 at 10:39 AM, Quentin Neill
<quentin.neill.gnu@gmail.com> wrote:
> On Sat, Feb 11, 2012 at 8:13 AM, Mike Stump <mikestump@comcast.net> wrote:
>> On Nov 4, 2011, at 8:23 PM, Quentin Neill wrote:
>>> My scenario about "ANY test results changed" is what I added with -strict.
>>> This patch concatenates the common .sum files before comparing.
>>
>> So, how exactly does this work for you:
>>
>> +       ( for fname in `cat $lst5`; do cat $1/$fname; done ) >$sum1
>> +       ( for fname in `cat $lst5`; do cat $2/$fname; done ) >$sum2
>> +       echo "## ${CONFIG_SHELL-/bin/sh} $0 $strict $sum1 $sum2"
>> +       ${CONFIG_SHELL-/bin/sh} $0 $strict $sum1 $sum2
>>
>> sum1 and sum2 appear to be variables that aren't set.
>
> Hi Mike,
>
> Thanks for the fix.  This seemed familiar, and upon review it looks
> like I never committed this fix:
> http://gcc.gnu.org/ml/gcc-patches/2011-11/msg01194.html
>
>
> Do you prefer this patch with my original intent (declaring sum1/sum2
> with other tmps and removing the trap on line 52):

Horrible wording for the first patch description.  How about:

  "Do you prefer this patch with my original intent (declaring sum1/sum2
   with other tmps, and removing those files in the trap on line 52):"
Mike Stump Feb. 15, 2012, 3:01 a.m. UTC | #2
On Feb 14, 2012, at 8:39 AM, Quentin Neill wrote:
> Thanks for the fix.  This seemed familiar, and upon review it looks
> like I never committed this fix:
> http://gcc.gnu.org/ml/gcc-patches/2011-11/msg01194.html

Ah, ok, let's go with your version, it is much better.  Thanks.
diff mbox

Patch

--- a/contrib/compare_tests
+++ b/contrib/compare_tests
@@ -43,7 +43,9 @@  lst2=/tmp/$tool-lst2.$$
 lst3=/tmp/$tool-lst3.$$
 lst4=/tmp/$tool-lst4.$$
 lst5=/tmp/$tool-lst5.$$
-tmps="$tmp1 $tmp2 $now_s $before_s $lst1 $lst2 $lst3 $lst4 $lst5"
+sum1=/tmp/$tool-sum1.$$
+sum2=/tmp/$tool-sum2.$$
+tmps="$tmp1 $tmp2 $now_s $before_s $lst1 $lst2 $lst3 $lst4 $lst5 $sum1 $sum2"


 [ "$1" = "-strict" ] && strict=$1 && shift