From nobody Fri May 3 07:57:18 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1550781949674148.43319938927004; Thu, 21 Feb 2019 12:45:49 -0800 (PST) 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 mx1.redhat.com (Postfix) with ESMTPS id 9B0DE30A7695; Thu, 21 Feb 2019 20:45:47 +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 14BD31001DDB; Thu, 21 Feb 2019 20:45:46 +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 EA8C1181A00B; Thu, 21 Feb 2019 20:45:44 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x1LKji3p027401 for ; Thu, 21 Feb 2019 15:45:44 -0500 Received: by smtp.corp.redhat.com (Postfix) id 3ECC15D70D; Thu, 21 Feb 2019 20:45:44 +0000 (UTC) Received: from orkuz.int.mamuti.net (ovpn-204-68.brq.redhat.com [10.40.204.68]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 10ED65D706 for ; Thu, 21 Feb 2019 20:45:42 +0000 (UTC) Received: by orkuz.int.mamuti.net (Postfix, from userid 500) id 68B6D2A0245; Thu, 21 Feb 2019 21:45:39 +0100 (CET) From: Jiri Denemark To: libvir-list@redhat.com Date: Thu, 21 Feb 2019 21:45:32 +0100 Message-Id: <9059cace3ef4988b38577ee3b4718779e4dfba93.1550781812.git.jdenemar@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 1/2] cputest: Adapt scripts to split cpu_map 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: , Content-Transfer-Encoding: quoted-printable 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-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Thu, 21 Feb 2019 20:45:48 +0000 (UTC) Content-Type: text/plain; charset="utf-8" The tests/cputestdata/cpu-parse.sh script has been broken since the cpu_map.xml file was split into several XMLs. Signed-off-by: Jiri Denemark Reviewed-by: J=C3=A1n Tomko --- tests/cputestdata/cpu-cpuid.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/tests/cputestdata/cpu-cpuid.py b/tests/cputestdata/cpu-cpuid.py index c45118512d..9ee83e0cd2 100755 --- a/tests/cputestdata/cpu-cpuid.py +++ b/tests/cputestdata/cpu-cpuid.py @@ -301,15 +301,13 @@ def parseFeature(data): =20 def parseMap(): path =3D os.path.dirname(sys.argv[0]) - path =3D os.path.join(path, "..", "..", "src", "cpu", "cpu_map.xml") + path =3D os.path.join(path, "..", "..", "src", "cpu_map", "x86_feature= s.xml") with open(path, "r") as f: data =3D xmltodict.parse(f) =20 cpuMap =3D {} - for arch in data["cpus"]["arch"]: - if arch["@name"] =3D=3D "x86": - for feature in arch["feature"]: - cpuMap[feature["@name"]] =3D parseFeature(feature["cpuid"]) + for feature in data["cpus"]["feature"]: + cpuMap[feature["@name"]] =3D parseFeature(feature["cpuid"]) =20 return cpuMap =20 --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 07:57:18 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1550846145974513.091810409004; Fri, 22 Feb 2019 06:35:45 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D3FB1305B889; Fri, 22 Feb 2019 14:35:43 +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 A12B05D719; Fri, 22 Feb 2019 14:35:43 +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 57720181A010; Fri, 22 Feb 2019 14:35:43 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x1LKjiGI027411 for ; Thu, 21 Feb 2019 15:45:44 -0500 Received: by smtp.corp.redhat.com (Postfix) id 4EBB317104; Thu, 21 Feb 2019 20:45:44 +0000 (UTC) Received: from orkuz.int.mamuti.net (ovpn-204-68.brq.redhat.com [10.40.204.68]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1C7EF5C28F for ; Thu, 21 Feb 2019 20:45:42 +0000 (UTC) Received: by orkuz.int.mamuti.net (Postfix, from userid 500) id 6B1312A47F7; Thu, 21 Feb 2019 21:45:39 +0100 (CET) From: Jiri Denemark To: libvir-list@redhat.com Date: Thu, 21 Feb 2019 21:45:33 +0100 Message-Id: <1d2467c46202f799ca1a0fa2c5ca859f0e6533a3.1550781812.git.jdenemar@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 2/2] cputest: Use python3 in CPU parser scripts 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Fri, 22 Feb 2019 14:35:44 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Signed-off-by: Jiri Denemark Reviewed-by: J=C3=A1n Tomko --- tests/cputestdata/cpu-cpuid.py | 16 ++++++++-------- tests/cputestdata/cpu-reformat.py | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/tests/cputestdata/cpu-cpuid.py b/tests/cputestdata/cpu-cpuid.py index 9ee83e0cd2..f532475702 100755 --- a/tests/cputestdata/cpu-cpuid.py +++ b/tests/cputestdata/cpu-cpuid.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python3 =20 import os import sys @@ -259,7 +259,7 @@ def parseQemu(path, features): with open(path, "r") as f: data, pos =3D json.JSONDecoder().raw_decode(f.read()) =20 - for (prop, val) in data["return"]["model"]["props"].iteritems(): + for (prop, val) in data["return"]["model"]["props"].items(): if val and prop in features: cpuidAdd(cpuid, features[prop]) =20 @@ -268,7 +268,7 @@ def parseQemu(path, features): =20 def parseCpuid(path): cpuid =3D {} - with open(path, "r") as f: + with open(path, "rb") as f: data =3D xmltodict.parse(f) =20 for leaf in data["cpudata"]["cpuid"]: @@ -302,7 +302,7 @@ def parseFeature(data): def parseMap(): path =3D os.path.dirname(sys.argv[0]) path =3D os.path.join(path, "..", "..", "src", "cpu_map", "x86_feature= s.xml") - with open(path, "r") as f: + with open(path, "rb") as f: data =3D xmltodict.parse(f) =20 cpuMap =3D {} @@ -313,7 +313,7 @@ def parseMap(): =20 =20 def formatCpuid(cpuid, path, comment): - print path + print(path) with open(path, "w") as f: f.write("\n") f.write("\n") @@ -337,7 +337,7 @@ def convert(path): for name in feature["names"]: props[name] =3D value =20 - print path + print(path) with open(path, "w") as f: json.dump({"return": {"model": {"name": "base", "props": props}}, "id": "model-expansion"}, @@ -373,7 +373,7 @@ def diff(cpuMap, path): =20 =20 if len(sys.argv) < 3: - print "Usage: %s convert|diff json_file..." % sys.argv[0] + print("Usage: %s convert|diff json_file..." % sys.argv[0]) sys.exit(1) =20 action =3D sys.argv[1] @@ -387,5 +387,5 @@ elif action =3D=3D "diff": for path in args: diff(cpuMap, path) else: - print "Unknown action: " + action + print("Unknown action: %s" % action) sys.exit(1) diff --git a/tests/cputestdata/cpu-reformat.py b/tests/cputestdata/cpu-refo= rmat.py index d4ed8d8118..2c7bbde262 100755 --- a/tests/cputestdata/cpu-reformat.py +++ b/tests/cputestdata/cpu-reformat.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 =20 import sys import json --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list