From: Dan Zheng <dzheng(a)redhat.com>
Some APIs are only supported from new version. This is to compare
the current running version to the supporting version in order to
decide if one test should be skipped.
Signed-off-by: Dan Zheng <dzheng(a)redhat.com>
---
lib/Sys/Virt/TCK.pm | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/lib/Sys/Virt/TCK.pm b/lib/Sys/Virt/TCK.pm
index a641d01..98ea945 100644
--- a/lib/Sys/Virt/TCK.pm
+++ b/lib/Sys/Virt/TCK.pm
@@ -1229,6 +1229,21 @@ sub get_host_block_device {
return $match ? $device : undef;
}
+sub compare_version {
+ my $self = shift;
+ my $to_version = shift;
+
+ my $from_version = `rpm -q perl-Sys-Virt | cut -d'-' -f4`;
+ $from_version =~ s/\R//g;
+ print "Current version:$from_version compares to $to_version\n";
+ $from_version =~ /(\d+).(\d+).(\d+)/;
+ $from_version = $1 * 1000000 + $2 * 1000 + $3;
+
+ $to_version =~ /(\d+).(\d+).(\d+)/;
+ $to_version = $1 * 1000000 + $2 * 1000 + $3;
+ return ($from_version ge $to_version)? 1 : 0;
+}
+
sub get_host_network_device {
my $self = shift;
my $devindex = @_ ? shift : 0;
--
2.18.1
Show replies by date