Skip to content

Commit

Permalink
Add logs of failing tests in the index
Browse files Browse the repository at this point in the history
  • Loading branch information
boklm committed Aug 11, 2014
1 parent 3def2b4 commit e86db63
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 11 deletions.
1 change: 1 addition & 0 deletions TBBTestSuite/Reports.pm
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ BEGIN {
my %template_functions = (
is_test_error => \&TBBTestSuite::Tests::is_test_error,
is_test_warning => \&TBBTestSuite::Tests::is_test_warning,
test_by_name => \&TBBTestSuite::Tests::test_by_name,
);

sub set_report_dir {
Expand Down
8 changes: 8 additions & 0 deletions TBBTestSuite/Tests.pm
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,14 @@ sub is_success {
return 1;
}

sub test_by_name {
my ($tests, $name) = @_;
foreach my $test (@$tests) {
return $test if $test->{name} eq $name;
}
return undef;
}

sub matching_tbbfile {
my $o = tbb_filename_infos($_[0]);
return $o->{type} eq 'browserbundle' && $o->{os} eq $options->{os}
Expand Down
4 changes: 3 additions & 1 deletion tmpl/details_xpcshell.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[% IF ! from_index %]
[% IF test.results.failed.size %]
Failed tests:
<ul>
Expand All @@ -7,4 +8,5 @@
</ul>
[% END %]
<a href="javascript:togglecontent('logs_[% test.name %]');">xpcshell logs</a>
<pre id="logs_[% test.name %]" style="display:none">[% test.results.out %]</pre>
[% END %]
<pre [% IF ! from_index %]id="logs_[% report_name %][% test.name %]" style="display:none"[% END %]>[% test.results.out %]</pre>
10 changes: 1 addition & 9 deletions tmpl/report.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,7 @@
color: #FF0000;
}
</style>
<script language="JavaScript" type="text/javascript">
function togglecontent(id) {
if (document.getElementById(id).style.display == "none") {
document.getElementById(id).style.display = '';
} else {
document.getElementById(id).style.display = "none";
}
}
</script>
[% INCLUDE togglecontent.js %]
</head>
<body>
[% IF tbbfiles.$tbbfile.type == 'browserunit' %]
Expand Down
13 changes: 12 additions & 1 deletion tmpl/reports_index_browserunit.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
font-size: small;
}
</style>
[% INCLUDE togglecontent.js %]
</head>
<body>
<h1>Tor Browser Unit Test Reports</h1>
Expand Down Expand Up @@ -49,7 +50,12 @@ <h1>Tor Browser Unit Test Reports</h1>
<li><b>[% diff.fail_tests.size %] new failing tests</b>
<ul>
[% FOREACH t IN diff.fail_tests.sort %]
<li>[% t %]</li>
<li><a href="javascript:togglecontent('fail_test_[% report %]_[% t %]');">[% t %]</a>
<div id="fail_test_[% report %]_[% t %]" style="display:none">
[% SET test = test_by_name(tbbfiles.$tbbfile.tests, t); %]
[% SET type = test.type; INCLUDE "details_${type}.html" from_index=1 %]
</div>
</li>
[% END %]
</ul>
</li>
Expand All @@ -66,6 +72,11 @@ <h1>Tor Browser Unit Test Reports</h1>
<li>[% js %]</li>
[% END %]
</ul>
<a href="javascript:togglecontent('js_fail_test_[% report %]_[% t %]');">logs</a>
<div id="js_fail_test_[% report %]_[% t %]" style="display:none">
[% SET test = test_by_name(tbbfiles.$tbbfile.tests, t); %]
[% SET type = test.type; INCLUDE "details_${type}.html" from_index=1 %]
</div>
</li>
[% END %]
</ul>
Expand Down
9 changes: 9 additions & 0 deletions tmpl/togglecontent.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<script language="JavaScript" type="text/javascript">
function togglecontent(id) {
if (document.getElementById(id).style.display == "none") {
document.getElementById(id).style.display = '';
} else {
document.getElementById(id).style.display = "none";
}
}
</script>

0 comments on commit e86db63

Please sign in to comment.