# run with /usr/bin/perl
# Input: html
# Output: input but with rows containing no failures omitted
#
$istest = 0;
$nerrors = 0;
while () {
# jam in our little summary at end
if (/<\/table>/ && keys(%tally) > 1) {
print "\n";
foreach (sort {$b <=> $a} (keys(%tally))) {
print "$_ " . $tally{$_} . "
\n" if $_;
}
undef %tally;
}
# kludge: fix up references to summary.css and summary.js on the server, if run locally
s/="[^"]*\/summary/="http:\/\/test.winehq.org\/summary/;
#print "inrow $inrow, istest $istest, nerrors $nerrors, got $_";
if ($inrow) {
if (/<\/tr>/) {
$row .= $_;
if (!$istest || $nerrors != 0) {
print $row;
$tally{$nerrors} .= " $testname";
}
$row = "";
$inrow = 0;
$nerrors = 0;
$istest = 0;
$testname = "";
} else {
$row .= $_;
if (!$istest && /class=.result/) {
$istest = 1;
# pages saved with mozilla have absolute URLs that this script keys off...
if (/test.winehq/) {
if (/onmouseover="refresh\('([^']*)'/) {
$testname = $1;
}
}
}
if (/result fail/) {
$nerrors++;
}
}
} else {
if (//) {
$row = $_;
$inrow++;
} else {
print;
}
}
}