Unverified Commit b0bfc9fb authored by boklm's avatar boklm
Browse files

xpcshell: allow viewing logs for each failed testcase

parent 21f0b1f2
......@@ -82,8 +82,8 @@ sub tests_by_name {
sub xpcshell_subtests_diff {
my ($t1, $t2) = @_;
my (@fail, @fixed);
my %f1 = map { $_ => 1 } @{$t1->{results}{failed}};
my %f2 = map { $_ => 1 } @{$t2->{results}{failed}};
my %f1 = %{$t1->{results}{failed}};
my %f2 = %{$t2->{results}{failed}};
my %f = ( %f1, %f2);
foreach my $t (keys %f) {
if ($f2{$t} && !$f1{$t}) {
......@@ -178,7 +178,7 @@ sub xpcshell_test {
capture_exec('xvfb-run', '--server-args=-screen 0 1024x768x24',
'./mach', 'xpcshell-test', $test->{dir});
$test->{results}{out} = $out;
$test->{results}{failed} = [];
$test->{results}{failed} = {};
my $root = eval {
-f $xunit_file
&& XML::LibXML->load_xml(location => $xunit_file)
......@@ -191,7 +191,9 @@ sub xpcshell_test {
$test->{results}{success} = ($root->getAttribute('failures') // 0)== 0;
foreach my $testcase (@{$root->getChildrenByLocalName('testcase')}) {
if ($testcase->getChildrenByLocalName('failure')) {
push @{$test->{results}{failed}}, $testcase->getAttribute('name');
$test->{results}{failed}{$testcase->getAttribute('name')} =
($testcase->getChildrenByLocalName('failure'))[0]
->textContent;
}
}
}
......
[% IF ! from_index %]
[% IF test.results.failed.size %]
[% IF test.results.failed.keys.size %]
Failed tests:
<ul>
[% FOREACH f IN test.results.failed %]
<li>[% f %]</li>
[% FOREACH f IN test.results.failed.keys %]
<li><a href="javascript:togglecontent('logs_[% test.name %]_[% f %]');">[% f %]</a>
<pre id="logs_[% test.name %]_[% f %]" style="display:none">[% test.results.failed.$f %]</pre>
</li>
[% END %]
</ul>
[% END %]
......
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