Unverified Commit 3960c6cb authored by boklm's avatar boklm
Browse files

Add separate index pages for each report types

parent 5771aca4
......@@ -20,6 +20,7 @@ our %testsuite = (
pre_tests => \&pre_tests,
post_tests => \&post_tests,
pre_makereport => \&pre_makereport,
pre_reports_index => \&pre_reports_index,
);
sub get_tbbinfos {
......@@ -121,16 +122,26 @@ sub diff_results {
}
sub pre_makereport {
my ($report, $tbbfile) = @_;
my ($report, $tbbfile, $r) = @_;
my $tbbinfos = $report->{tbbfiles}{$tbbfile};
return unless $tbbinfos->{parent_results};
my $r = TBBTestSuite::Reports::load_report($tbbinfos->{parent_results}[0]);
$r //= TBBTestSuite::Reports::load_report($tbbinfos->{parent_results}[0]);
return unless $r;
my $parent = $r->{tbbfiles}{$tbbinfos->{parent_results}[1]};
return unless $parent;
$tbbinfos->{parent_diff} = diff_results($parent, $tbbinfos);
}
sub pre_reports_index {
my ($reports, $report) = @_;
foreach my $tbbfile (keys %{$report->{tbbfiles}}) {
my $tbbinfos = $report->{tbbfiles}{$tbbfile};
pre_makereport($report, $tbbfile,
$reports->{$tbbinfos->{parent_results}[0]})
if $tbbinfos->{parent_results};
}
}
sub find_xpcshell_tests {
my ($tbbinfos) = @_;
my @res;
......
......@@ -80,6 +80,14 @@ sub make_report {
}
}
sub report_type {
my ($report) = @_;
foreach my $tbbfile (values %{$report->{tbbfiles}}) {
return $tbbfile->{type} // 'browserbundle';
}
return 'browserbundle';
}
sub make_reports_index {
copy_static;
my $template = Template->new(
......@@ -98,14 +106,21 @@ sub make_reports_index {
my @reports_by_time =
sort { $reports{$b}->{time} <=> $reports{$a}->{time} } keys %reports;
my %reports_by_tbbversion;
my %reports_by_type;
foreach my $report (keys %reports) {
my $tbbver = $reports{$report}->{options}{tbbversion};
push @{$reports_by_tbbversion{$tbbver}}, $report if $tbbver;
my $type = report_type($reports{$report});
push @{$reports_by_type{$type}}, $report;
my $testsuite = $TBBTestSuite::Tests::testsuite_types{$type};
$testsuite->{pre_reports_index}(\%reports, $reports{$report})
if $testsuite->{pre_reports_index};
}
my $vars = {
%template_functions,
reports => \%reports,
reports_list => \@reports_by_time,
reports_by_type => \%reports_by_type,
};
$template->process('reports_index.html', $vars, 'index.html');
$template->process('tests_index.html', { %$vars, tests =>
......@@ -113,9 +128,15 @@ sub make_reports_index {
foreach my $tbbver (keys %reports_by_tbbversion) {
my @s = sort { $reports{$b}->{time} <=> $reports{$a}->{time} }
@{$reports_by_tbbversion{$tbbver}};
$template->process('reports_index.html',
$template->process('reports_index_browserbundle.html',
{ %$vars, reports_list => \@s }, "tbbversion_$tbbver.html");
}
foreach my $type (keys %reports_by_type) {
my @s = sort { $reports{$b}->{time} <=> $reports{$a}->{time} }
@{$reports_by_type{$type}};
$template->process("reports_index_$type.html",
{ %$vars, reports_list => \@s }, "index-$type.html");
}
}
sub text_report {
......
......@@ -25,41 +25,10 @@
</head>
<body>
<h1>Tests Reports</h1>
<table>
<tr>
<th>Name</th>
<th>Date</th>
<th>Version</th>
<th>OS</th>
<th>Arch</th>
<th>Result</th>
</tr>
[% FOREACH report IN reports_list %]
<tr>
<td valign="top"><a href="r/[% report %]/index.html">[% report %]</a></td>
<td valign="top">[% date.format(reports.$report.time, '%Y-%m-%d %H:%M') %]</td>
<td valign="top">[% IF reports.$report.options.tbbversion %]
<a href="tbbversion_[% reports.$report.options.tbbversion %].html">[% reports.$report.options.tbbversion %]</a>
[% END %]
</td>
<td valign="top">[% reports.$report.system_infos.osname %]</td>
<td valign="top">[% reports.$report.system_infos.arch %]</td>
<td valign="top">
[% failed = 0 %]
[% FOREACH tbbfile IN reports.$report.tbbfiles.keys %]
[% IF ! reports.$report.tbbfiles.$tbbfile.success %]
<span class="test_notok">Failed: <a href="r/[% report %]/[% tbbfile %].html">[% tbbfile %]</a></span><br />
[% failed = 1 %]
[% END %]
[% END %]
[% IF failed == 0 %]
<span class="test_ok"><a href="r/[% report %]/index.html">OK</a></span>
[% END %]
</td>
</tr>
<ul>
[% FOREACH type IN reports_by_type.keys.sort %]
<li><a href="index-[% type %].html">[% type %] reports</a></li>
[% END %]
</table>
<hr />
<a href="tests.html">Available tests</a>
</ul>
</body>
</html>
[% USE date -%]
<html>
<head>
<title>Tests reports</title>
<style type="text/css">
.test_ok {
color: #006600;
font-weight: bold;
}
.test_ok A {
color: #006600;
font-weight: bold;
}
.test_notok {
color: #FF0000;
font-weight: bold;
}
.test_notok A {
color: #FF0000;
}
.reportdate {
font-size: small;
}
</style>
</head>
<body>
<h1>Tests Reports</h1>
<table>
<tr>
<th>Name</th>
<th>Date</th>
<th>Version</th>
<th>OS</th>
<th>Arch</th>
<th>Result</th>
</tr>
[% FOREACH report IN reports_list %]
<tr>
<td valign="top"><a href="r/[% report %]/index.html">[% report %]</a></td>
<td valign="top">[% date.format(reports.$report.time, '%Y-%m-%d %H:%M') %]</td>
<td valign="top">[% IF reports.$report.options.tbbversion %]
<a href="tbbversion_[% reports.$report.options.tbbversion %].html">[% reports.$report.options.tbbversion %]</a>
[% END %]
</td>
<td valign="top">[% reports.$report.system_infos.osname %]</td>
<td valign="top">[% reports.$report.system_infos.arch %]</td>
<td valign="top">
[% failed = 0 %]
[% FOREACH tbbfile IN reports.$report.tbbfiles.keys %]
[% IF ! reports.$report.tbbfiles.$tbbfile.success %]
<span class="test_notok">Failed: <a href="r/[% report %]/[% tbbfile %].html">[% tbbfile %]</a></span><br />
[% failed = 1 %]
[% END %]
[% END %]
[% IF failed == 0 %]
<span class="test_ok"><a href="r/[% report %]/index.html">OK</a></span>
[% END %]
</td>
</tr>
[% END %]
</table>
<hr />
<a href="tests.html">Available tests</a>
</body>
</html>
[% USE date -%]
<html>
<head>
<title>Tests reports</title>
<style type="text/css">
.test_ok {
color: #006600;
font-weight: bold;
}
.test_ok A {
color: #006600;
font-weight: bold;
}
.test_notok {
color: #FF0000;
font-weight: bold;
}
.test_notok A {
color: #FF0000;
}
.reportdate {
font-size: small;
}
</style>
</head>
<body>
<h1>Tor Browser Unit Test Reports</h1>
[% FOREACH report IN reports_list %]
[%
SET tbbfiles = reports.$report.tbbfiles;
SET tbbfile = reports.$report.tbbfiles.keys.0;
SET diff = tbbfiles.$tbbfile.parent_diff;
%]
<ul>
<li><b>Commit:</b> <a href="https://gitweb.torproject.org/tor-browser.git/commit/[% tbbfiles.$tbbfile.commit %]">[% tbbfiles.$tbbfile.commit %]</a></li>
<li><b>Subject:</b> [% tbbfiles.$tbbfile.commit_subject %]</li>
<li><b>Run time:</b> [% tbbfiles.$tbbfile.run_time %] seconds (diff: [% diff.run_time %])</li>
[%
SET nb_js_fail = 0;
SET nb_js_fixed = 0;
FOREACH t IN diff.subtests.keys;
SET nb_js_fail = nb_js_fail + diff.subtests.$t.fail.size;
SET nb_js_fixed = nb_js_fixed + diff.subtests.$t.fixed.size;
END
%]
[% IF diff.fail_tests.size %]
<li><b>[% diff.fail_tests.size %] new failing tests</b>
<ul>
[% FOREACH t IN diff.fail_tests.sort %]
<li>[% t %]</li>
[% END %]
</ul>
</li>
[% END %]
[% IF nb_js_fail %]
<li><b>[% nb_js_fail %] new js files failing</b>
<ul>
[% FOREACH t IN diff.subtests.keys %]
[% IF ! diff.subtests.$t.fail.size; NEXT; END %]
<li>[% t %]:
<ul>
[% FOREACH js IN diff.subtests.$t.fail %]
<li>[% js %]</li>
[% END %]
</ul>
</li>
[% END %]
</ul>
</li>
[% END %]
[% IF diff.fixed_tests.size %]
<li><b>[% diff.fixed_tests.size %] fixed tests</b>
<ul>
[% FOREACH t IN diff.fixed_tests.sort %]
<li>[% t %]</li>
[% END %]
</ul>
</li>
[% END %]
[% IF nb_js_fixed %]
<li><b>[% nb_js_fixed %] new js files fixed</b>
<ul>
[% FOREACH t IN diff.subtests.keys %]
[% IF ! diff.subtests.$t.fixed.size; NEXT; END %]
<li>[% t %]:
<ul>
[% FOREACH js IN diff.subtests.$t.fixed %]
<li>[% js %]</li>
[% END %]
</ul>
</li>
[% END %]
</ul>
</li>
[% END %]
<li><a href="r/[% report %]/[% tbbfile %].html">Details</a></li>
</ul>
<hr />
[% END %]
</body>
</html>
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment