Patchwork PATCH: Add capability to contrib/compare_tests to handle directories

login
register
mail settings
Submitter Quentin Neill
Date Nov. 8, 2011, 3:29 p.m.
Message ID <CAEhygDpJYJ22DdGA8QONbkrY=JhQ5b5fTPROzPDSkSWHJ=WgzQ@mail.gmail.com>
Download mbox | patch
Permalink /patch/124389/
State New
Headers show

Comments

Quentin Neill - Nov. 8, 2011, 3:29 p.m.
On Sat, Nov 5, 2011 at 4:26 PM, Mike Stump <mikestump@comcast.net> wrote:
> On Nov 4, 2011, at 8:23 PM, Quentin Neill wrote:
>> This patch concatenates the common .sum files before comparing.
>>
>> Okay to commit?
>
> Ok, thanks for the contribution.
>

FYI I see my patch was missing these two fixes:
1. fix missing sum1 and sum2 temp variables
2. handle trailing slashes in dir args

Okay to commit?  Should I commit such a patch as trivial?
Mike Stump - Nov. 8, 2011, 4:23 p.m.
On Nov 8, 2011, at 7:29 AM, Quentin Neill <quentin.neill.gnu@gmail.com> wrote:
> FYI I see my patch was missing these two fixes:

> Okay to commit?

Ok.

Patch

Index: compare_tests
===================================================================
--- compare_tests       (revision 181166)
+++ compare_tests       (working copy)
@@ -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
 [ "$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"