3 use lib '../../perl/blib/lib';
10 open my $fh, "<", $name or return undef;
12 return undef if not defined $line;
13 close $fh or die "cannot close $name: $!";
14 $line =~ /^(?:(\d+):)?(\d+):(\d+(?:\.\d+)?) (\d+(?:\.\d+)?) (\d+(?:\.\d+)?)$/
15 or die "bad input line: $line";
16 my $rt = ((defined $1 ? $1 : 0.0)*60+$2)*60+$3;
21 my ($r, $u, $s, $firstr) = @_;
25 my $out = sprintf "%.2f(%.2f+%.2f)", $r, $u, $s;
26 if (defined $firstr) {
28 $out .= sprintf " %+.1f%%", 100.0*($r-$firstr)/$firstr;
38 my (@dirs, %dirnames, %dirabbrevs, %prefixes, @tests);
39 while (scalar @ARGV) {
42 last if -f $arg or $arg eq "--";
44 my $rev = Git::command_oneline(qw(rev-parse --verify), $arg);
49 $dirabbrevs{$dir} = $dir;
52 $dirnames{$dir} = $arg;
54 $prefix =~ tr/^a-zA-Z0-9/_/c;
55 $prefixes{$dir} = $prefix . '.';
62 $dirnames{'.'} = $dirabbrevs{'.'} = "this tree";
65 shift @ARGV if scalar @ARGV and $ARGV[0] eq "--";
69 @tests = glob "p????-*.sh";
75 $t =~ s{(?:.*/)?(p(\d+)-[^/]+)\.sh$}{$1} or die "bad test name: $t";
77 my $fname = "test-results/$t.subtests";
78 open my $fp, "<", $fname or die "cannot open $fname: $!";
81 /^(\d+)$/ or die "malformed subtest line: $_";
82 push @subtests, "$t.$1";
83 $shorttests{"$t.$1"} = "$n.$1";
85 close $fp or die "cannot close $fname: $!";
90 open my $fh, "<", $name or return "<error reading description>";
91 binmode $fh, ":utf8" or die "PANIC on binmode: $!";
93 close $fh or die "cannot close $name";
99 my $descrlen = 4; # "Test"
100 for my $t (@subtests) {
101 $descrs{$t} = $shorttests{$t}.": ".read_descr("test-results/$t.descr");
102 $descrlen = length $descrs{$t} if length $descrs{$t}>$descrlen;
108 return 1 if exists $seen{$_};
120 my %newdirabbrevs = %dirabbrevs;
121 while (!have_duplicate(values %newdirabbrevs)) {
122 %dirabbrevs = %newdirabbrevs;
123 last if !have_slash(values %dirabbrevs);
124 %newdirabbrevs = %dirabbrevs;
125 for (values %newdirabbrevs) {
131 my @colwidth = ((0)x@dirs);
132 for my $i (0..$#dirs) {
134 my $w = length (exists $dirabbrevs{$d} ? $dirabbrevs{$d} : $dirnames{$d});
135 $colwidth[$i] = $w if $w > $colwidth[$i];
137 for my $t (@subtests) {
139 for my $i (0..$#dirs) {
141 $times{$prefixes{$d}.$t} = [get_times("test-results/$prefixes{$d}$t.times")];
142 my ($r,$u,$s) = @{$times{$prefixes{$d}.$t}};
143 my $w = length format_times($r,$u,$s,$firstr);
144 $colwidth[$i] = $w if $w > $colwidth[$i];
145 $firstr = $r unless defined $firstr;
148 my $totalwidth = 3*@dirs+$descrlen;
149 $totalwidth += $_ for (@colwidth);
151 binmode STDOUT, ":utf8" or die "PANIC on binmode: $!";
153 printf "%-${descrlen}s", "Test";
154 for my $i (0..$#dirs) {
156 printf " %-$colwidth[$i]s", (exists $dirabbrevs{$d} ? $dirabbrevs{$d} : $dirnames{$d});
159 print "-"x$totalwidth, "\n";
160 for my $t (@subtests) {
161 printf "%-${descrlen}s", $descrs{$t};
163 for my $i (0..$#dirs) {
165 my ($r,$u,$s) = @{$times{$prefixes{$d}.$t}};
166 printf " %-$colwidth[$i]s", format_times($r,$u,$s,$firstr);
167 $firstr = $r unless defined $firstr;