From nobody Fri May 3 18:35:04 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1579156610; cv=none; d=zohomail.com; s=zohoarc; b=D+zHdZCePLHq0dsFzDrL/ps0cAxFsnK38oMDCVnR337Jv+fKRReAP5j5zjIXMcDsmbsd/RpBevmV6bFsgvr3I0n3+jFr2OEoXCnhMhUA2QjHgLZRlB+NLmeEbuCJRaRHn+UDtEoPkPT8NwXFxviA054SY17qclOicWMNmG6s3/o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1579156610; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=L84i8lMfk3Gd7LwImQphtF2z/lDt/KDGWXq+yCCV7i0=; b=HoCQ/IPopwGjAKEbdConQ53y0RzLNVuzHQ4rcuhEqaqIN2JHlW56+Tqdr7KASIyElsusIgdE/OFrQRTaYeqS701OfFIyc8MlJpDQSWffI2FQvC7wj/VnJmd+EFCPOxfgQzNvPY8Q+if6SVStojPwbCKzAweuDFuLt+rW9zwT9r4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by mx.zohomail.com with SMTPS id 1579156610664622.1465812079899; Wed, 15 Jan 2020 22:36:50 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-369-n3MsxI4pN_K4VKKVQCEF9w-1; Thu, 16 Jan 2020 01:36:47 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0E8E2801E67; Thu, 16 Jan 2020 06:36:41 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9D53C1084194; Thu, 16 Jan 2020 06:36:37 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id A32771809565; Thu, 16 Jan 2020 06:36:30 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 00G6aS05028077 for ; Thu, 16 Jan 2020 01:36:28 -0500 Received: by smtp.corp.redhat.com (Postfix) id 810F410841A7; Thu, 16 Jan 2020 06:36:28 +0000 (UTC) Received: from tcktest.nay.redhat.com (unknown [10.66.85.225]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7B7791084194; Thu, 16 Jan 2020 06:36:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1579156609; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=L84i8lMfk3Gd7LwImQphtF2z/lDt/KDGWXq+yCCV7i0=; b=VSNTEcqiCi3Sfnaloh1b1bHXTku3rNJ/IILOQ2Omgg9gECBfKMaKVj8z2X15mBFxPxU3dI nDuOzHzT0JeaTuZxk0o3mZpjTLRUUdZ7bSCJ6JDmFnwrtWvmFYmkecAPcqB1eDqXzXBr5O XU1TJy2XunBv2JIDDtcMDP+iDJEFY0k= From: dzheng@redhat.com To: libvir-list@redhat.com Date: Thu, 16 Jan 2020 14:36:18 +0800 Message-Id: <20200116063618.30503-1-dzheng@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Cc: Dan Zheng Subject: [libvirt] [libvirt-tck PATCH] Support version compare X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-MC-Unique: n3MsxI4pN_K4VKKVQCEF9w-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Dan Zheng 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 --- 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; } =20 +sub compare_version { + my $self =3D shift; + my $to_version =3D shift; + + my $from_version =3D `rpm -q perl-Sys-Virt | cut -d'-' -f4`; + $from_version =3D~ s/\R//g; + print "Current version:$from_version compares to $to_version\n"; + $from_version =3D~ /(\d+).(\d+).(\d+)/; + $from_version =3D $1 * 1000000 + $2 * 1000 + $3; + + $to_version =3D~ /(\d+).(\d+).(\d+)/; + $to_version =3D $1 * 1000000 + $2 * 1000 + $3; + return ($from_version ge $to_version)? 1 : 0; +} + sub get_host_network_device { my $self =3D shift; my $devindex =3D @_ ? shift : 0; --=20 2.18.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list