[libvirt] [PATCH] tests: Test for nwfilter

Daniel P. Berrange berrange at redhat.com
Wed May 12 08:10:47 UTC 2010


On Tue, May 11, 2010 at 05:28:37PM -0400, Stefan Berger wrote:
> Eric Blake <eblake at redhat.com> wrote on 05/11/2010 03:31:10 PM:
> 
> 
> > 
> > On 05/07/2010 03:39 PM, Stefan Berger wrote:
> > > This is a repost of a previously posted patch.
> > > 
> > > Attached is a test for automatic testing of of the nwfilter rules as 
> the
> > > are instantiated in form of ebtables, iptables and ip6tables rules on
> > > running VMs.
> > > 
> > > The test automatically starts libvirtd from the build directory unless
> > > it finds libvirtd running. My hope is that one won't notice this. It
> > > uses virsh from the build directory to create two dummy VMs with 
> random
> > > name suffixes. The VMs don't boot any OS but just stop in the BIOS. 
> This
> > > is enough to run the nwfilter tests. Afterwards the nwfilter of the 
> one
> > > VM are continuously modified and the instantiation is checked. The
> > > instantiation of rules of the 2nd VM are also continously checked to
> > > verify that the modifications on the 1st VM has had no effect on the
> > > instantiated rules of the 2nd VM.
> > 
> > I'm still a bit wary of this patch.  Is this something that can be done
> > with 'virsh -c test:///default' can do?  Or can we at least copy how
> 
> test doesn't support the functionality, so no, it cannot be used like 
> that.
> 
> > daemon-conf runs an instance of libvirtd pointing to an independent pid
> > and config file, whether or not the system libvirtd is running?
> 
> yes, I am looking into this.
> 
> > 
> > Or should we be trying to do this as part of libvirt-tck instead?
> 
> I know. Hurdle being Perl for me and I so far have had lots of problems 
> getting that test suite to run; some problems were related just to compile 
> the dependent libvirt perl project, others then with a perl dependency and 
> my FC13 installation etc.

FYI Fedora 13 has all the neccessary Perl modules required  to run the TCK,
so you shouldn't need to compile/install any others manually.

Although I'd like all the test scripts to be written in Perl for consistency,
if neccessary, it is actually possible to write the test scripts in pretty
much any programming language. 

The only core requirement is compliance with the TAP protocol[1] for displaying
success/fail status. This is an incredibly simple syntax that can be easily
output from any language[2], including shell[2]. Essentially when the test 
starts, print out how many tests are expect to run. Then for each test, 
print 'ok' or 'not ok' on a new line.  eg a compete test output might look
like this:

   1..4
   ok 1 - Input file opened
   not ok 2 - First line of the input valid
   ok 3 - Read the rest of the file
   not ok 4 - Summarized correctly # TODO Not written yet

Your current shell script could easily be made to print out this kind of
syntax if you don't feel you can rewrite it in Perl easily.


Regards,
Daniel

[1] Friendly format docs:  http://search.cpan.org/~petdance/TAP-1.00/TAP.pm
    IETF standard: http://testanything.org/wiki/index.php/TAP_at_IETF:_Draft_Standard

[2] Language support: http://testanything.org/wiki/index.php/TAP_Producers
[3] Shell helper functions: http://testanything.org/wiki/index.php/Tap-functions
-- 
|: Red Hat, Engineering, London    -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.org :|
|: http://autobuild.org        -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|




More information about the libvir-list mailing list