Skip to content

Commit

Permalink
mochitests: only include errors in the logs
Browse files Browse the repository at this point in the history
  • Loading branch information
boklm committed Sep 8, 2014
1 parent 9470c16 commit 84b1efd
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
17 changes: 17 additions & 0 deletions TBBTestSuite/BrowserUnitTests.pm
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,9 @@ sub diff_results {
sub pre_makereport {
my ($report, $tbbfile, $r) = @_;
my $tbbinfos = $report->{tbbfiles}{$tbbfile};
foreach my $test (@{$tbbinfos->{tests}}) {
mochitest_error_logs($test);
}
return unless $tbbinfos->{parent_results};
$r //= TBBTestSuite::Reports::load_report($tbbinfos->{parent_results}[0]);
return unless $r;
Expand All @@ -159,6 +162,9 @@ sub pre_reports_index {
pre_makereport($report, $tbbfile,
$reports->{$tbbinfos->{parent_results}[0]})
if $tbbinfos->{parent_results};
foreach my $test (@{$report->{tbbfiles}{$tbbfile}{tests}}) {
mochitest_error_logs($test);
}
}
}

Expand Down Expand Up @@ -254,6 +260,17 @@ sub mochitest_test {
$test->{results}{success} = $failed && ! @{$test->{results}{failed}};
}

sub mochitest_error_logs {
my ($test) = @_;
return unless $test->{type} =~ m/^mochitest_/;
return unless exists $test->{results};
return unless $test->{results}{out};
return if exists $test->{results}{error_logs};
my @logs = split /^/, $test->{results}{out};
@logs = grep { m/^\s*[^\s]+\s[^\s]+\sERROR/ } @logs;
$test->{results}{error_logs} = join '', @logs;
}

sub build_firefox {
my ($tbbinfos, $test) = @_;
my $nbcpu = get_nbcpu;
Expand Down
4 changes: 2 additions & 2 deletions tmpl/details_mochitest.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
[% END %]
</ul>
[% END %]
<a href="javascript:togglecontent('logs_[% test.name %]');">mochitest logs</a>
[% IF test.results.error_logs %]<a href="javascript:togglecontent('logs_[% test.name %]');">mochitest error logs</a>[% END %]
[% END %]
<pre [% IF ! from_index %]id="logs_[% report_name %][% test.name %]" style="display:none"[% END %]>[% FILTER html_entity %][% test.results.out %][% END %]</pre>
<pre [% IF ! from_index %]id="logs_[% report_name %][% test.name %]" style="display:none"[% END %]>[% FILTER html_entity %][% test.results.error_logs %][% END %]</pre>

0 comments on commit 84b1efd

Please sign in to comment.