Unverified Commit 21f0b1f2 authored by boklm's avatar boklm
Browse files

Get xpcshell test results by reading xunit xml file

Rather than parsing logs.
parent dc9bd24a
......@@ -7,6 +7,7 @@ use File::Spec;
use File::Find;
use File::Copy;
use File::Slurp;
use XML::LibXML '1.70';
use TBBTestSuite::Common qw(exit_error get_nbcpu run_to_file);
use TBBTestSuite::Reports qw(load_report);
use TBBTestSuite::Options qw($options);
......@@ -64,6 +65,9 @@ sub pre_tests {
'--format=%an', $tbbinfos->{commit});
exit_error "Error getting commit author" unless $success;
$tbbinfos->{commit_author} = $out;
my ($config_guess) = capture_exec('./build/autoconf/config.guess');
chomp $config_guess;
$tbbinfos->{topobjdir} = "obj-$config_guess";
}
sub post_tests {
......@@ -168,16 +172,26 @@ sub find_xpcshell_tests {
sub xpcshell_test {
my ($tbbinfos, $test) = @_;
my $xunit_file = "$tbbinfos->{topobjdir}/.mozbuild/xpchsell.xunit.xml";
unlink $xunit_file if -f $xunit_file;
my ($out, $err, $success) =
capture_exec('xvfb-run', '--server-args=-screen 0 1024x768x24',
'./mach', 'xpcshell-test', $test->{dir});
$test->{results}{success} = $success;
$test->{results}{out} = $out;
$test->{results}{failed} = [];
foreach my $line (split "\n", $out) {
if ($line =~ m{TEST-UNEXPECTED-FAIL \| /([^\|]+) \|}) {
my (undef, undef, $file) = File::Spec->splitpath($1);
push @{$test->{results}{failed}}, $file;
my $root = eval {
-f $xunit_file
&& XML::LibXML->load_xml(location => $xunit_file)
->documentElement();
};
if (!$root) {
$test->{results}{success} = 0;
return;
}
$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');
}
}
}
......
......@@ -18,7 +18,7 @@ perlmodules='
Cwd Data::Dump Digest::SHA File::Path File::Slurp File::Spec File::Temp
FindBin Getopt::Long IO::CaptureOutput IO::Socket::INET Image::Magick
JSON LWP::UserAgent LWP::Protocol::https Template YAML DateTime
Email::Simple Email::Sender File::Type IPC::Run
Email::Simple Email::Sender File::Type IPC::Run XML::LibXML
'
if [ -f /etc/debian_version ]
......@@ -28,7 +28,7 @@ then
libfile-spec-perl libio-captureoutput-perl perlmagick libjson-perl \
libwww-perl libtemplate-perl libyaml-perl libdatetime-perl \
libemail-sender-perl libemail-simple-perl libfile-type-perl \
libipc-run-perl
libipc-run-perl libxml-libxml-perl
apt-get install -y libgtk2.0-0
apt-get install -y nmap
if lsb_release -i | grep -q Debian
......
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