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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]