From a8e35b2d15ae620a9367c9234c9b577b17f3de3d Mon Sep 17 00:00:00 2001 From: Arnaud Giersch Date: Mon, 28 Oct 2013 11:02:48 +0100 Subject: [PATCH] Add suport for sort prefix length in tesh.pl. --- buildtools/Cmake/Scripts/tesh.pl | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/buildtools/Cmake/Scripts/tesh.pl b/buildtools/Cmake/Scripts/tesh.pl index 8f0aa56fbd..164ff0cb03 100755 --- a/buildtools/Cmake/Scripts/tesh.pl +++ b/buildtools/Cmake/Scripts/tesh.pl @@ -20,6 +20,7 @@ my($time_to_wait)=0; my $path = $0; my $OS; my $enable_coverage=0; +my $sort_prefix = 19; my $tesh_file; my $tesh_name; my $error=0; @@ -305,9 +306,9 @@ sub parse_out { if ($cmd{'sort'}){ sub mysort{ - $a cmp $b + substr($a, 0, $sort_prefix) cmp substr($b, 0, $sort_prefix) } - use sort qw(defaults _quicksort); # force quicksort + use sort 'stable'; @got = sort mysort @got; #also resort the other one, as perl sort is not the same as the C one used to generate teshes if(defined($cmd{'out'})){ @@ -488,6 +489,9 @@ LINE: while (not $finished and not $error) { %cmd = (); } $cmd{'sort'} = 1; + if ($line =~ /^!\s*output sort\s+(\d+)/) { + $sort_prefix = $1; + } } elsif($line =~ /^!\s*output ignore/){ #output ignore if (defined($cmd{'cmd'})) { -- 2.20.1