Query Wine's bugzilla to identify the bugs related to a given test unit, show basic information about them and link to them.
Signed-off-by: Francois Gouget fgouget@codeweavers.com --- winetest/build-patterns | 86 ++++++++++++++++++++++++++++++++++++++++- winetest/report.css | 10 +++++ winetest/winetest.conf | 2 + 3 files changed, 97 insertions(+), 1 deletion(-)
diff --git a/winetest/build-patterns b/winetest/build-patterns index 9f68c51cd..6076d18ab 100755 --- a/winetest/build-patterns +++ b/winetest/build-patterns @@ -21,6 +21,9 @@ use warnings; use open ':utf8'; use CGI qw(:standard);
+use Text::CSV::Encoded; +use Time::Piece; + sub BEGIN { if ($0 !~ m=^/=) @@ -31,7 +34,7 @@ sub BEGIN } unshift @INC, $1 if ($0 =~ m=^(/.*)/[^/]+$=); } -use vars qw/$workdir $gitdir $gitweb @groups $patternbuilds $fixed_threshold/; +use vars qw/$workdir $bugweb $gitdir $gitweb @groups $patternbuilds $fixed_threshold/; require "winetest.conf";
my $name0=$0; @@ -745,6 +748,85 @@ if (open(my $fh, "-|", $cmd)) }
+# +# Collect the related bugs +# + +# A hashtable of bugs indexed by their id. +# Each object has the following fields: +# +# - id +# The bug unique identifier. +# +# - mtime +# The bug's last modification timestamp. +# +# - class +# The CSS class used for presenting the bug. +# +# - desc +# The bug's one-line description. +my %bugs; + +my $old_build_date = $sortedbuilds[0]->{date}; +my $mid_build_date = $sortedbuilds[int(@sortedbuilds/2)]->{date}; + +sub create_bug($$$) +{ + my ($bugid, $mtime, $desc) = @_; + + my $t = Time::Piece->strptime($mtime, "%Y-%m-%d %H:%M:%S"); + return { + id => $bugid, + mtime => $t->epoch, + class => $t < $old_build_date ? "bugold" : + $t < $mid_build_date ? "buginactive" : "bugactive", + desc => $desc, + }; +} + +$cmd = "wget -qO- '$bugweb/buglist.cgi?product=Wine&product=Wine-Testbot&bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&bug_status=NEEDINFO&keywords=source%2Ctestcase&keywords_type=allwords&rep_platform=x86&rep_platform=x86-64&columnlist=changeddate%2Cshort_desc&query_format=advanced&ctype=csv'"; +if (open(my $fh, "-|", $cmd)) +{ + <$fh>; # skip the header line + + my $csv = Text::CSV::Encoded->new({ binary => 1 }); + while (my $line = <$fh>) + { + if (!$csv->parse($line)) + { + error("could not parse line: ", $csv->error_input, "\n"); + next; + } + + my ($bugid, $mtime, $desc) = $csv->fields(); + my $teststr = $desc; + while ($teststr =~ s~\b([_.a-z0-9-]+)(?:/tests/|/|:)([_a-z0-9]+)\b~ ~) + { + my ($module, $unit) = ($1, $2); + my $test = $tests{"$module:$unit"}; + next if (!$test); + $bugs{$bugid} ||= create_bug($bugid, $mtime, $desc); + push @{$test->{bugs}}, $bugs{$bugid}; + } + } + close($fh); + + # Put the list of related bugs in the test's desc field + foreach my $test (values %tests) + { + next if (!$test->{bugs}); + $test->{desc} = "<p>Related bugs:<br>"; + foreach my $bug (sort { $a->{mtime} <=> $b->{mtime} } @{$test->{bugs}}) + { + $test->{desc} .= "<a href='$bugweb/show_bug.cgi?id=$bug->{id}'>$bug->{id}</a> <span class='$bug->{class}'>$bug->{desc}</span>"; + $test->{desc} .= "<br>"; + } + $test->{desc} .= "</p>"; + } +} + + # # Compute color gradients # @@ -1258,6 +1340,8 @@ EOF <li>Each result is also color coded to make the patterns pop out. There is one color per type of result (crash , timeout, etc.), and one per number of failures (to help detect changes).</li> <li>Failure modes that have not been seen before (test that newly crashes, new failure count, etc.) are highlighted, as well as the configuration names in which they appear.</li> <li>Below the patterns is a line showing which builds have potentially related commits if any. + <li>Bugs related to a test are shown above the pattern. <span class='bugactive'>New (and recently modified) bugs</span> are highlighted. <span class='buginactive'>Slightly older bugs</span> are also highlighted as a reminder to investigate them while the pattern may still contain traces of their inception.</li> + <li>Related bugs should have the <i>source</i> and <i>testcase</i> keywords, and their description should contain <i>module</i>:<i>unit</i>, <i>module</i>/<i>unit</i> or <i>module</i>/tests/<i>unit</i>. </ul>
<p>The patterns are grouped according to the likelyhood that they contain new failures:</p> diff --git a/winetest/report.css b/winetest/report.css index f78980830..05ee035a4 100644 --- a/winetest/report.css +++ b/winetest/report.css @@ -126,3 +126,13 @@ div.pattern :hover { color: black; text-decoration: underline; } .commitm { font-style: italic; } + +/* .bugold */ +.buginactive { + color: #cc0000; + font-weight: bold; +} +.bugactive { + color: #000066; + font-weight: bold; +} diff --git a/winetest/winetest.conf b/winetest/winetest.conf index 3041cf7df..5ac2261a1 100644 --- a/winetest/winetest.conf +++ b/winetest/winetest.conf @@ -2,6 +2,8 @@
$workdir = "/home/winehq/opt/winetest";
+$bugweb = "https://bugs.winehq.org/"; + $gitdir = "/home/winehq/opt/source/git/wine.git"; $gitweb = "//source.winehq.org/git/wine.git";