Support a new "-r" (reverse) argument.

This commit is contained in:
Jan Kratochvil 2007-01-09 11:34:40 +00:00
parent b76482a34c
commit 8ad010c73b
1 changed files with 3 additions and 2 deletions

View File

@ -1,11 +1,12 @@
#! /usr/bin/perl
# $Id: gdbcompare,v 1.1 2006/12/12 22:56:16 jkratoch Exp $
# $Id: gdbcompare,v 1.2 2007/01/07 22:47:44 jkratoch Exp $
use strict;
use warnings;
use Data::Dumper;
my $reverse=shift @ARGV if ($ARGV[0]||"") eq "-r";
my $suffix=shift @ARGV if ($ARGV[0]||"")=~/^(?:sum|log)$/;
$suffix||="sum";
@ -26,7 +27,7 @@ system("rm -f tests/gdbcompare-*.diff") and die;
for my $arch (sort keys(%arch)) {
sub trans { return {"."=>0,"-"=>1}->{($_[0]=~/([-.])[^-.]+[.]\w+$/)[0]}.$_[0]; };
my @sorted=sort { my $a1=trans $a; my $b1=trans $b; $b1 cmp $a1; } @{$arch{$arch}};
my @sorted=sort { my $a1=trans $a; my $b1=trans $b; ($b1 cmp $a1) * ($reverse ? -1 : 1); } @{$arch{$arch}};
do { system $_ and die $_; } for "diff -u tests/'".$sorted[1]."' tests/'".$sorted[0]."' >tests/gdbcompare-'$arch'.diff;true";
}