Signed-off-by: Francois Gouget fgouget@codeweavers.com --- winetest/build-patterns | 253 +++++++++++++++++++++------------------- 1 file changed, 135 insertions(+), 118 deletions(-)
diff --git a/winetest/build-patterns b/winetest/build-patterns index 130294ea1..a5f98f5f3 100755 --- a/winetest/build-patterns +++ b/winetest/build-patterns @@ -709,6 +709,140 @@ sub cmpstatus return ($a =~ /^[0-9]+$/ and $b =~ /^[0-9]+$/) ? $a <=> $b : $a cmp $b; }
+sub write_newmodes_line($$) +{ + my ($html, $test) = @_; + + print $html "New failure modes:"; + foreach my $status (sort cmpstatus keys %{$test->{newmodes}}) + { + my ($symbol, $class, $title, $_link, $attrs) = get_status_html($status, $test->{colors}); + print $html " <span class='pat$class'$attrs title='$title'><b><i>$symbol</i></b></span>"; + } + print $html "\n"; +} + +sub write_pattern_line($$$) +{ + my ($html, $test, $reportdir) = @_; + my $testreport = $test->{testreports}->{$reportdir}; + + print $html "<div class='pattern'>"; + + my $has_newmode; + my ($range_symbol, $range_count) = ("", 0); + my ($range_start, $range_end, $range_title); + foreach my $build (@sortedbuilds) + { + my ($symbol, $class, $title); + my ($tag, $attrs) = ("span", ""); + my $status = $testreport->{status}->{$build->{name}}; + + if (!defined $status) + { + if (!$build->{hasreport}->{$reportdir}) + { + $symbol = "_"; + $class = "W"; + $title = "WineTest was not run"; + } + elsif ($build->{hastest}->{$test->{name}}) + { + $symbol = "."; + $class = "S"; + $title = "success"; + } + else + { + $symbol = " "; + $class = "A"; + $title = "no such test in this build"; + } + } + else + { + ($symbol, $class, $title, my $link, $attrs) = get_status_html($status, $test->{colors}); + if ($link eq "t") + { + $tag = "a"; + $attrs .= sprintf " href='%s/%s/%s.html'", + $build->{name}, $reportdir, $test->{name}; + } + elsif ($link) + { + $tag = "a"; + my $dll = $test->{name}; + $dll =~ s/:.*//; + $attrs .= sprintf " href='%s/%s/%s.html#%s'", + $build->{name}, $reportdir, $link, $dll; + } + if ($test->{newmodes}->{$status}) + { + $symbol = "<b><i>$symbol</i></b>"; + $has_newmode = 1; + } + } + + if ($range_symbol eq $symbol) + { + $range_end = $build->{date}; + $range_count++; + } + else + { + # Close the previous range of patterns + if ($range_count) + { + printf $html " title='%s : %s'>%s</span>", + date_range($range_start, $range_end), + $range_title, $range_symbol x $range_count; + $range_symbol = $range_end = ""; + $range_count = 0; + } + + # Start a new pattern range + $class = " class='pat$class'" if ($class); + print $html "<$tag$class$attrs"; + if ($tag eq "a") + { + printf $html " title='%s : %s'>%s</a>", + short_date($build->{date}), $title, $symbol; + } + else + { + $range_symbol = $symbol; + $range_start = $build->{date}; + $range_title = $title; + $range_count = 1; + } + } + } + if ($range_count) + { + printf $html " title='%s : %s'>%s</span>", + date_range($range_start, $range_end), + $range_title, $range_symbol x $range_count; + } + my $label = $reportdir; + $label = "<b>$label</b>" if ($has_newmode); + print $html "</div> $label\n"; +} + +sub write_pattern($$$) +{ + my ($html, $test, $pagereports) = @_; + + compute_set_colors($test->{colors}); + write_newmodes_line($html, $test) if (%{$test->{newmodes}}); + + foreach my $reportdir (@sortedreports) + { + next if (!$pagereports->{$reportdir}); + next if (!$test->{testreports}->{$reportdir}->{failed}); + write_pattern_line($html, $test, $reportdir); + } +} + sub write_patterns_list($$$$) { my ($html, $pagereports, $mainpage, $list) = @_; @@ -734,125 +868,8 @@ sub write_patterns_list($$$$)
print $html "</div></div>\n";
- compute_set_colors($test->{colors}); - print $html "<div class='test'>\n"; - if (%{$test->{newmodes}}) - { - print $html "New failure modes:"; - foreach my $status (sort cmpstatus keys %{$test->{newmodes}}) - { - my ($symbol, $class, $title, $_link, $attrs) = get_status_html($status, $test->{colors}); - print $html " <span class='pat$class'$attrs title='$title'><b><i>$symbol</i></b></span>"; - } - print $html "\n"; - } - - foreach my $reportdir (@sortedreports) - { - next if (!$pagereports->{$reportdir}); - my $testreport = $test->{testreports}->{$reportdir}; - next if (!$testreport->{failed}); - print $html "<div class='pattern'>"; - - my $has_newmode; - my ($range_symbol, $range_count) = ("", 0); - my ($range_start, $range_end, $range_title); - foreach my $build (@sortedbuilds) - { - my ($symbol, $class, $title); - my ($tag, $attrs) = ("span", ""); - my $status = $testreport->{status}->{$build->{name}}; - - if (!defined $status) - { - if (!$build->{hasreport}->{$reportdir}) - { - $symbol = "_"; - $class = "W"; - $title = "WineTest was not run"; - } - elsif ($build->{hastest}->{$testname}) - { - $symbol = "."; - $class = "S"; - $title = "success"; - } - else - { - $symbol = " "; - $class = "A"; - $title = "no such test in this build"; - } - } - else - { - ($symbol, $class, $title, my $link, $attrs) = get_status_html($status, $test->{colors}); - if ($link eq "t") - { - $tag = "a"; - $attrs .= sprintf " href='%s/%s/%s.html'", - $build->{name}, $reportdir, $testname; - } - elsif ($link) - { - $tag = "a"; - my $dll = $testname; - $dll =~ s/:.*//; - $attrs .= sprintf " href='%s/%s/%s.html#%s'", - $build->{name}, $reportdir, $link, $dll; - } - if ($test->{newmodes}->{$status}) - { - $symbol = "<b><i>$symbol</i></b>"; - $has_newmode = 1; - } - } - - if ($range_symbol eq $symbol) - { - $range_end = $build->{date}; - $range_count++; - } - else - { - # Close the previous range of patterns - if ($range_count) - { - printf $html " title='%s : %s'>%s</span>", - date_range($range_start, $range_end), - $range_title, $range_symbol x $range_count; - $range_symbol = $range_end = ""; - $range_count = 0; - } - - # Start a new pattern range - $class = " class='pat$class'" if ($class); - print $html "<$tag$class$attrs"; - if ($tag eq "a") - { - printf $html " title='%s : %s'>%s</a>", - short_date($build->{date}), $title, $symbol; - } - else - { - $range_symbol = $symbol; - $range_start = $build->{date}; - $range_title = $title; - $range_count = 1; - } - } - } - if ($range_count) - { - printf $html " title='%s : %s'>%s</span>", - date_range($range_start, $range_end), - $range_title, $range_symbol x $range_count; - } - my $label = $reportdir; - $label = "<b>$label</b>" if ($has_newmode); - print $html "</div> $label\n"; - } + write_pattern($html, $test, $pagereports); print $html "</div></div>\n"; } }