9 open my $fh, "<", $name or return undef;
11 return undef if not defined $line;
12 close $fh or die "cannot close $name: $!";
13 $line =~ /^(?:(\d+):)?(\d+):(\d+(?:\.\d+)?) (\d+(?:\.\d+)?) (\d+(?:\.\d+)?)$/
14 or die "bad input line: $line";
15 my $rt = ((defined $1 ? $1 : 0.0)*60+$2)*60+$3;
20 my ($r, $u, $s, $firstr) = @_;
24 my $out = sprintf "%.2f(%.2f+%.2f)", $r, $u, $s;
25 if (defined $firstr) {
27 $out .= sprintf " %+.1f%%", 100.0*($r-$firstr)/$firstr;
37 my (@dirs, %dirnames, %dirabbrevs, %prefixes, @tests);
38 while (scalar @ARGV) {
41 last if -f $arg or $arg eq "--";
43 my $rev = Git::command_oneline(qw(rev-parse --verify), $arg);
48 $dirabbrevs{$dir} = $dir;
51 $dirnames{$dir} = $arg;
53 $prefix =~ tr/^a-zA-Z0-9/_/c;
54 $prefixes{$dir} = $prefix . '.';
61 $dirnames{'.'} = $dirabbrevs{'.'} = "this tree";
64 shift @ARGV if scalar @ARGV and $ARGV[0] eq "--";
68 @tests = glob "p????-*.sh";
74 $t =~ s{(?:.*/)?(p(\d+)-[^/]+)\.sh$}{$1} or die "bad test name: $t";
76 my $fname = "test-results/$t.subtests";
77 open my $fp, "<", $fname or die "cannot open $fname: $!";
80 /^(\d+)$/ or die "malformed subtest line: $_";
81 push @subtests, "$t.$1";
82 $shorttests{"$t.$1"} = "$n.$1";
84 close $fp or die "cannot close $fname: $!";
89 open my $fh, "<", $name or return "<error reading description>";
91 close $fh or die "cannot close $name";
97 my $descrlen = 4; # "Test"
98 for my $t (@subtests) {
99 $descrs{$t} = $shorttests{$t}.": ".read_descr("test-results/$t.descr");
100 $descrlen = length $descrs{$t} if length $descrs{$t}>$descrlen;
106 return 1 if exists $seen{$_};
118 my %newdirabbrevs = %dirabbrevs;
119 while (!have_duplicate(values %newdirabbrevs)) {
120 %dirabbrevs = %newdirabbrevs;
121 last if !have_slash(values %dirabbrevs);
122 %newdirabbrevs = %dirabbrevs;
123 for (values %newdirabbrevs) {
129 my @colwidth = ((0)x@dirs);
130 for my $i (0..$#dirs) {
132 my $w = length (exists $dirabbrevs{$d} ? $dirabbrevs{$d} : $dirnames{$d});
133 $colwidth[$i] = $w if $w > $colwidth[$i];
135 for my $t (@subtests) {
137 for my $i (0..$#dirs) {
139 $times{$prefixes{$d}.$t} = [get_times("test-results/$prefixes{$d}$t.times")];
140 my ($r,$u,$s) = @{$times{$prefixes{$d}.$t}};
141 my $w = length format_times($r,$u,$s,$firstr);
142 $colwidth[$i] = $w if $w > $colwidth[$i];
143 $firstr = $r unless defined $firstr;
146 my $totalwidth = 3*@dirs+$descrlen;
147 $totalwidth += $_ for (@colwidth);
149 printf "%-${descrlen}s", "Test";
150 for my $i (0..$#dirs) {
152 printf " %-$colwidth[$i]s", (exists $dirabbrevs{$d} ? $dirabbrevs{$d} : $dirnames{$d});
155 print "-"x$totalwidth, "\n";
156 for my $t (@subtests) {
157 printf "%-${descrlen}s", $descrs{$t};
159 for my $i (0..$#dirs) {
161 my ($r,$u,$s) = @{$times{$prefixes{$d}.$t}};
162 printf " %-$colwidth[$i]s", format_times($r,$u,$s,$firstr);
163 $firstr = $r unless defined $firstr;