From nobody Sun Feb 8 20:35:18 2026 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 1554713001099476.0257986940935; Mon, 8 Apr 2019 01:43:21 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7CA65307E04F; Mon, 8 Apr 2019 08:43:19 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 55DFE60CD6; Mon, 8 Apr 2019 08:43:19 +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 188373F5CC; Mon, 8 Apr 2019 08:43:19 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x388h1xn009227 for ; Mon, 8 Apr 2019 04:43:01 -0400 Received: by smtp.corp.redhat.com (Postfix) id 4910460FD5; Mon, 8 Apr 2019 08:43:01 +0000 (UTC) Received: from virval.usersys.redhat.com (unknown [10.43.2.188]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1BEF960CD6 for ; Mon, 8 Apr 2019 08:42:59 +0000 (UTC) Received: by virval.usersys.redhat.com (Postfix, from userid 500) id 2E322103826; Mon, 8 Apr 2019 10:42:51 +0200 (CEST) From: Jiri Denemark To: libvir-list@redhat.com Date: Mon, 8 Apr 2019 10:42:32 +0200 Message-Id: <1a845af868bd4188b2bb1a49c8cd1b0417086012.1554711784.git.jdenemar@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 28/36] cputest: Rename in_e[ac]x as e[ac]x_in in cpu-cpuid.py 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.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Mon, 08 Apr 2019 08:43:20 +0000 (UTC) Content-Type: text/plain; charset="utf-8" This will let us simplify the code since the dictionary keys will match attribute names in various XMLs. Signed-off-by: Jiri Denemark Reviewed-by: J=C3=A1n Tomko --- tests/cputestdata/cpu-cpuid.py | 39 ++++++++++++++++------------------ 1 file changed, 18 insertions(+), 21 deletions(-) diff --git a/tests/cputestdata/cpu-cpuid.py b/tests/cputestdata/cpu-cpuid.py index 0a2710689d..cba5fc165a 100755 --- a/tests/cputestdata/cpu-cpuid.py +++ b/tests/cputestdata/cpu-cpuid.py @@ -6,17 +6,17 @@ import json import xmltodict =20 def checkFeature(cpuid, feature): - in_eax =3D feature["in_eax"] - in_ecx =3D feature["in_ecx"] + eax_in =3D feature["eax_in"] + ecx_in =3D feature["ecx_in"] eax =3D feature["eax"] ebx =3D feature["ebx"] ecx =3D feature["ecx"] edx =3D feature["edx"] =20 - if in_eax not in cpuid or in_ecx not in cpuid[in_eax]: + if eax_in not in cpuid or ecx_in not in cpuid[eax_in]: return False =20 - leaf =3D cpuid[in_eax][in_ecx] + leaf =3D cpuid[eax_in][ecx_in] return ((eax > 0 and leaf["eax"] & eax =3D=3D eax) or (ebx > 0 and leaf["ebx"] & ebx =3D=3D ebx) or (ecx > 0 and leaf["ecx"] & ecx =3D=3D ecx) or @@ -24,13 +24,13 @@ def checkFeature(cpuid, feature): =20 =20 def addFeature(cpuid, feature): - if feature["in_eax"] not in cpuid: - cpuid[feature["in_eax"]] =3D {} - leaf =3D cpuid[feature["in_eax"]] + if feature["eax_in"] not in cpuid: + cpuid[feature["eax_in"]] =3D {} + leaf =3D cpuid[feature["eax_in"]] =20 - if feature["in_ecx"] not in leaf: - leaf[feature["in_ecx"]] =3D {"eax": 0, "ebx": 0, "ecx": 0, "edx": = 0} - leaf =3D leaf[feature["in_ecx"]] + if feature["ecx_in"] not in leaf: + leaf[feature["ecx_in"]] =3D {"eax": 0, "ebx": 0, "ecx": 0, "edx": = 0} + leaf =3D leaf[feature["ecx_in"]] =20 for reg in ["eax", "ebx", "ecx", "edx"]: leaf[reg] |=3D feature[reg] @@ -55,8 +55,8 @@ def parseCPUData(path): =20 for leaf in data["cpudata"]["cpuid"]: feature =3D {} - feature["in_eax"] =3D int(leaf["@eax_in"], 0) - feature["in_ecx"] =3D int(leaf["@ecx_in"], 0) + feature["eax_in"] =3D int(leaf["@eax_in"], 0) + feature["ecx_in"] =3D int(leaf["@ecx_in"], 0) for reg in ["eax", "ebx", "ecx", "edx"]: feature[reg] =3D int(leaf["@" + reg], 0) =20 @@ -67,11 +67,8 @@ def parseCPUData(path): =20 def parseMapFeature(data): cpuid =3D {} - for reg in ["in_eax", "in_ecx", "eax", "ebx", "ecx", "edx"]: - if reg.startswith("in_"): - attr =3D "@%s_in" % reg[3:] - else: - attr =3D "@%s" % reg + for reg in ["eax_in", "ecx_in", "eax", "ebx", "ecx", "edx"]: + attr =3D "@%s" % reg =20 if attr in data: cpuid[reg] =3D int(data[attr], 0) @@ -100,14 +97,14 @@ def formatCPUData(cpuid, path, comment): with open(path, "w") as f: f.write("\n") f.write("\n") - for in_eax in sorted(cpuid.keys()): - for in_ecx in sorted(cpuid[in_eax].keys()): - leaf =3D cpuid[in_eax][in_ecx] + for eax_in in sorted(cpuid.keys()): + for ecx_in in sorted(cpuid[eax_in].keys()): + leaf =3D cpuid[eax_in][ecx_in] line =3D (" \n") f.write(line % ( - in_eax, in_ecx, + eax_in, ecx_in, leaf["eax"], leaf["ebx"], leaf["ecx"], leaf["edx"]= )) f.write("\n") =20 --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list