[libvirt] [PATCH tck] 300-vsitype.t: skip earlier if lldptool is not available

Move the test for /usr/sbin/lldptool up so libvirt-tck will report the skip and reason, rather than passing the test as 'ok'. --- scripts/nwfilter/300-vsitype.t | 48 ++++++++++++++++++++++-------------------- 1 file changed, 25 insertions(+), 23 deletions(-) diff --git a/scripts/nwfilter/300-vsitype.t b/scripts/nwfilter/300-vsitype.t index 3d06803..58e8469 100644 --- a/scripts/nwfilter/300-vsitype.t +++ b/scripts/nwfilter/300-vsitype.t @@ -26,7 +26,14 @@ The test case validates that the corrrect VSI is set in the adjacent switch use strict; use warnings; -use Test::More tests => 3; +use Test::More; + +if ( ! -e '/usr/sbin/lldptool' ) { + eval "use Test::More skip_all => \"lldptool is not available\";"; +} else { + eval "use Test::More tests => 3"; +} + use Sys::Virt::TCK; use Sys::Virt::TCK::NetworkHelpers; @@ -41,34 +48,29 @@ END { $tck->cleanup if $tck; } -SKIP: { - skip "lldptool not present", 3 unless -e "/usr/sbin/lldptool"; - # creating domain - my $dom1; - my $dom_name ="tck8021Qbgtest"; +my $dom1; +my $dom_name ="tck8021Qbgtest"; # speficy mode="vepa" for a direct interface - $dom1 = prepare_test_disk_and_vm($tck, $conn, $dom_name, "vepa"); - $dom1->create(); +$dom1 = prepare_test_disk_and_vm($tck, $conn, $dom_name, "vepa"); +$dom1->create(); - ok($dom1->get_id() > 0, "running domain has an ID > 0"); - my $xml = $dom1->get_xml_description; - diag $xml; - my $mac1 = get_first_macaddress($dom1); - diag "mac is $mac1"; +ok($dom1->get_id() > 0, "running domain has an ID > 0"); +my $xml = $dom1->get_xml_description; +diag $xml; +my $mac1 = get_first_macaddress($dom1); +diag "mac is $mac1"; - sleep(30); +sleep(30); # check vsi information - diag "Verifying VSI information using lldptool"; - my $lldptool = `/usr/sbin/lldptool -t -i eth2 -V vdp mode`; - diag $lldptool; +diag "Verifying VSI information using lldptool"; +my $lldptool = `/usr/sbin/lldptool -t -i eth2 -V vdp mode`; +diag $lldptool; # check if instance is listed - ok($lldptool =~ "instance", "check instance"); - ok($lldptool =~ $mac1, "check mac as well"); - - shutdown_vm_gracefully($dom1); - exit 0; +ok($lldptool =~ "instance", "check instance"); +ok($lldptool =~ $mac1, "check mac as well"); -}; +shutdown_vm_gracefully($dom1); +exit 0; -- 1.8.4.5

On Thu, Mar 27, 2014 at 04:12:16PM -0600, Mike Latimer wrote:
Move the test for /usr/sbin/lldptool up so libvirt-tck will report the skip and reason, rather than passing the test as 'ok'.
So we're talking about the difference between the test indicating "OK 3 out of 3 tests skipped" vs "SKIPPED" ? If so, that sounds like a nice improvement Regards, 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 :|

On Friday, March 28, 2014 12:28:43 PM Daniel P. Berrange wrote:
On Thu, Mar 27, 2014 at 04:12:16PM -0600, Mike Latimer wrote:
Move the test for /usr/sbin/lldptool up so libvirt-tck will report the skip and reason, rather than passing the test as 'ok'.
So we're talking about the difference between the test indicating "OK 3 out of 3 tests skipped" vs "SKIPPED" ? If so, that sounds like a nice improvement
Yes, but the real reason for the change is when you are running the full libvirt-tck suite. This patch changes the following output: .../230-no-mac-broadcast.t .............. ok .../240-no-arp-spoofing.t ............... ok .../300-vsitype.t ....................... ok .../100-disk-encryption.t ................... ok .../200-qcow2-single-backing-file.t ......... ok To this: .../230-no-mac-broadcast.t .............. ok .../240-no-arp-spoofing.t ............... ok .../300-vsitype.t ....................... skipped: lldptool is not available .../100-disk-encryption.t ................... ok .../200-qcow2-single-backing-file.t ......... ok -Mike

On Fri, Mar 28, 2014 at 08:11:20AM -0600, Mike Latimer wrote:
On Friday, March 28, 2014 12:28:43 PM Daniel P. Berrange wrote:
On Thu, Mar 27, 2014 at 04:12:16PM -0600, Mike Latimer wrote:
Move the test for /usr/sbin/lldptool up so libvirt-tck will report the skip and reason, rather than passing the test as 'ok'.
So we're talking about the difference between the test indicating "OK 3 out of 3 tests skipped" vs "SKIPPED" ? If so, that sounds like a nice improvement
Yes, but the real reason for the change is when you are running the full libvirt-tck suite. This patch changes the following output:
.../230-no-mac-broadcast.t .............. ok .../240-no-arp-spoofing.t ............... ok .../300-vsitype.t ....................... ok .../100-disk-encryption.t ................... ok .../200-qcow2-single-backing-file.t ......... ok
To this:
.../230-no-mac-broadcast.t .............. ok .../240-no-arp-spoofing.t ............... ok .../300-vsitype.t ....................... skipped: lldptool is not available .../100-disk-encryption.t ................... ok .../200-qcow2-single-backing-file.t ......... ok
Yep. that makes sense. Will push this, and rebase mine change on top of it. Regards, 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 :|
participants (2)
-
Daniel P. Berrange
-
Mike Latimer