[libvirt] [PATCH] libvirt-tck: add junit output

Daniel P. Berrange berrange at redhat.com
Tue Oct 11 13:57:20 UTC 2011


On Tue, Oct 11, 2011 at 03:44:32PM +0200, Guido Günther wrote:
> On Tue, Oct 11, 2011 at 08:41:09AM +0100, Daniel P. Berrange wrote:
> > On Mon, Oct 10, 2011 at 04:15:47PM -0600, Eric Blake wrote:
> > > On 10/10/2011 03:46 PM, Guido Günther wrote:
> > > >Hi,
> > > >having JUnit like XML allows for easy integration into CI tools like
> > > >Jenkins. Attach patch adds this using TAP::Formatter::JUnit.
> > > >Does this look reasonable?
> > > 
> > > Do we need to modify a spec file to pull in the
> > > TAP::Formatter::JUnit module when installing the tck on Fedora?
> > > Other than that, it seems reasonable to me, but I'd also like Dan's
> > > feedback.
> > 
> > Normally you don't need to add Perl modules to the SPEC because RPM
> > will autodetect them, but because of the way the TAP system works,
> > we *do* need to add any TAP::Formatter::* modules manually.
> > 
> > So ACK if you add this as a Requires and BuildRequires in the RPM
> > perl-Sys-Virt-TCK.spec.PL
> I also had to adjust Build.PL. Although I assume that's o.k. I'd a final
> ACK would be great.
> Cheers,
>  -- Guido

> From 3d39a20d5f97de7cdf1effe17f25aa64fb13d872 Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?Guido=20G=C3=BCnther?= <agx at sigxcpu.org>
> Date: Mon, 10 Oct 2011 23:39:41 +0200
> Subject: [PATCH] Add --format=junit test result output
> 
> for easy integration into e.g. Jenkins. This needs
> TAP::Formatter::JUnit.
> ---
>  Build.PL                  |    1 +
>  bin/libvirt-tck           |   10 ++++++++--
>  perl-Sys-Virt-TCK.spec.PL |    1 +
>  3 files changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/Build.PL b/Build.PL
> index b0c53a2..e682c3a 100644
> --- a/Build.PL
> +++ b/Build.PL
> @@ -79,6 +79,7 @@ my $b = $class->new(
>  	'IO::Uncompress::Gunzip' => 0,
>  	'IO::Uncompress::Bunzip2' => 0,
>  	'TAP::Formatter::HTML' => 0,
> +	'TAP::Formatter::JUnit' => 0,
>  	'TAP::Harness' => 3.11,
>  	'TAP::Harness::Archive' => 0,
>  	'Test::Exception' => 0,
> diff --git a/bin/libvirt-tck b/bin/libvirt-tck
> index ee40743..dcb053c 100644
> --- a/bin/libvirt-tck
> +++ b/bin/libvirt-tck
> @@ -26,6 +26,10 @@ Generate a formal XML document of results
>  
>   # libvirt-tck --format xml
>  
> +Generate a JUnit XML document of results
> +
> + # libvirt-tck --format junit
> +
>  =head1 DESCRIPTION
>  
>  The C<libvirt-tck> (libvirt Technology Compatability Kit) command
> @@ -77,7 +81,7 @@ the name of each test case
>  Specify the name of the configuration file to use, rather than
>  the default C</etc/libvirt-tck/default.cfg>
>  
> -=item --format text|html|xml
> +=item --format text|html|xml|junit
>  
>  Choose the output format for the test results. The default format
>  is C<text>, producing human readable results on the console. The
> @@ -192,8 +196,10 @@ if ($format eq "xml") {
>      push @newargv, "--formatter=Sys::Virt::TCK::TAP::XMLFormatter";
>  } elsif ($format eq "html") {
>      push @newargv, "--formatter=TAP::Formatter::HTML"
> +} elsif ($format eq "junit") {
> +    push @newargv, "--formatter=TAP::Formatter::JUnit"
>  } elsif ($format ne "text") {
> -    pod2usage(-msg => "unknown format '$format', expecting one of 'text', 'html', or 'xml'\n",
> +    pod2usage(-msg => "unknown format '$format', expecting one of 'text', 'html', 'junit' or 'xml'\n",
>  	      -exitval => 2,
>  	      -output => \*STDERR);
>  }
> diff --git a/perl-Sys-Virt-TCK.spec.PL b/perl-Sys-Virt-TCK.spec.PL
> index b6a989e..479aabe 100644
> --- a/perl-Sys-Virt-TCK.spec.PL
> +++ b/perl-Sys-Virt-TCK.spec.PL
> @@ -58,6 +58,7 @@ BuildRequires: perl(IO::Uncompress::Gunzip)
>  BuildRequires: perl(IO::Uncompress::Bunzip2)
>  BuildRequires: perl(Module::Build)
>  BuildRequires: perl(TAP::Formatter::HTML)
> +BuildRequires: perl(TAP::Formatter::JUnit)
>  BuildRequires: perl(TAP::Harness)
>  BuildRequires: perl(TAP::Harness::Archive)
>  BuildRequires: perl(Test::Builder)

You also need  "Requires: perl(TAP::Formatter::JUnit)"

ACK with that addition



Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvir-list mailing list