[libvirt] [perl PATCH] make Time::HiRes optional in test suite

Daniel P. Berrangé posted 1 patch 2 weeks ago
Failed in applying to current master (apply log)
t/800-events.t | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)

[libvirt] [perl PATCH] make Time::HiRes optional in test suite

Posted by Daniel P. Berrangé 2 weeks ago
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
 t/800-events.t | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/t/800-events.t b/t/800-events.t
index dfbba8f..b7e767f 100644
--- a/t/800-events.t
+++ b/t/800-events.t
@@ -3,20 +3,24 @@
 use strict;
 use warnings;
 
-use Test::More tests => 23;
+use Test::More;
 
 my $URI = "test:///default";
 my $DOM = "test";
 
 BEGIN {
-        use_ok('Sys::Virt');
+    eval 'use Time::HiRes  qw(gettimeofday)';
+    if ($@) {
+	plan skip_all => "Time::HiRes is not available";
+	return;
+    }
+    plan tests => 23;
+    use_ok('Sys::Virt');
 }
 
 
 package Sys::Virt::Event::Simple;
 
-use Time::HiRes qw(gettimeofday);
-
 use base qw(Sys::Virt::Event);
 
 sub new {
@@ -38,7 +42,7 @@ sub new {
 
 sub _now {
     my $self;
-    my @now = gettimeofday;
+    my @now = &Time::HiRes::gettimeofday();
     return $now[0] * 1000 + (($now[1] - ($now[1] % 1000)) / 1000);
 }
 
-- 
2.23.0

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

Re: [libvirt] [perl PATCH] make Time::HiRes optional in test suite

Posted by Fabiano Fidêncio 2 weeks ago
On Wed, Jan 8, 2020 at 3:23 PM Daniel P. Berrangé <berrange@redhat.com> wrote:
>
> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>

Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>


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