From nobody Mon Feb 9 19:05:35 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 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=1608049579; cv=none; d=zohomail.com; s=zohoarc; b=VqBBw69giB7mGSExSrOkmKhhzCK0N0fEP+oplTudZkY1I6aGO7GYyqZrEIH2bpupiPdlsQ4F2n3eRMaAaf0p52cvFB7/a7ak/XGTXjxMo2o0awVPlPKEgv4zguDB+uArHtv1D9u+DNkge4IZenYwLzVySGoWeQcNOiDNhayg7o8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1608049579; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=2940OYERded0nuBRSa/Hw2pV7v73ofwaJv6B/9AaI/I=; b=Hjn6TLbsAiknJWgtTEOGXaCe69TRyb22osWcUDXOf/6gdM1NN8K5uiOBQhnkUMXkpq6lAd5xKwnjAyfnffOtSs37G4Oe7wC+p7hMRSyhwVRoNdoZ8GVbgZb+RIqQfW9Rjzqn1akahPrEMA57XmY6r9r3fI5d4TQ50gM4v5IKTo4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 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-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1608049579662169.7055490655672; Tue, 15 Dec 2020 08:26:19 -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-173--4qcnK9CMruoXlZm3g0n8Q-1; Tue, 15 Dec 2020 11:26:08 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4FA36100F36A; Tue, 15 Dec 2020 16:25:53 +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 DF3F7722E7; Tue, 15 Dec 2020 16:25:52 +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 A3B521809C9F; Tue, 15 Dec 2020 16:25:52 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0BFGPeE6025809 for ; Tue, 15 Dec 2020 11:25:40 -0500 Received: by smtp.corp.redhat.com (Postfix) id 1B3D05D9E4; Tue, 15 Dec 2020 16:25:40 +0000 (UTC) Received: from work.redhat.com (ovpn-114-20.ams2.redhat.com [10.36.114.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id 464035D9D7; Tue, 15 Dec 2020 16:25:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1608049576; 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: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=2940OYERded0nuBRSa/Hw2pV7v73ofwaJv6B/9AaI/I=; b=B0kL2+pX6YQW8xFvF8oiVkdxqicdGD7lnbBiNQSugYshxS86N7F+iKXruCEVevmtDBrbCv 0F5luXa9mWAdCqNKBNVX5lXHqz9fdxF0Ulcyg+LCa6sVS5qg5wau/Jt9L3a+vb1aKyWb5/ fNGXiqo1x84W3dEMkKbLrbW+0b+MN0k= X-MC-Unique: -4qcnK9CMruoXlZm3g0n8Q-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 20/29] cpu-parse: Move xml output to new script Date: Tue, 15 Dec 2020 17:25:06 +0100 Message-Id: <20201215162515.53742-21-twiederh@redhat.com> In-Reply-To: <20201215162515.53742-1-twiederh@redhat.com> References: <20201215162515.53742-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Tim Wiederhake --- tests/cputestdata/cpu-gather.py | 40 +++++++++++++++++++++++++++++++++ tests/cputestdata/cpu-parse.sh | 18 --------------- 2 files changed, 40 insertions(+), 18 deletions(-) diff --git a/tests/cputestdata/cpu-gather.py b/tests/cputestdata/cpu-gather= .py index 1a15cc1ff0..bc5c7dbb15 100755 --- a/tests/cputestdata/cpu-gather.py +++ b/tests/cputestdata/cpu-gather.py @@ -207,10 +207,50 @@ def parse_filename(data): return "x86_64-cpuid-{}".format(filename) =20 =20 +def output_xml(data, filename): + leave_pattern =3D re.compile( + "^\\s*" + "(0x[0-9a-f]+)\\s*" + "(0x[0-9a-f]+):\\s*" + "eax=3D(0x[0-9a-f]+)\\s*" + "ebx=3D(0x[0-9a-f]+)\\s*" + "ecx=3D(0x[0-9a-f]+)\\s*" + "edx=3D(0x[0-9a-f]+)\\s*$") + + leave_template =3D \ + " \n" + + msr_template =3D " \n" + + print(filename) + with open(filename, "wt") as f: + f.write("\n".format(data["name"])) + f.write("\n") + for line in data["leaves"]: + match =3D leave_pattern.match(line) + f.write(leave_template.format(*match.groups())) + for key, value in sorted(data["msr"].items()): + f.write(msr_template.format( + int(key), + 0xffffffff & (value >> 32), + 0xffffffff & (value >> 0))) + f.write("\n") + + def parse(args): data =3D json.load(sys.stdin) =20 filename =3D parse_filename(data) + filename_xml =3D "{}.xml".format(filename) + + output_xml(data, filename_xml) =20 os.environ["CPU_GATHER_PY"] =3D "true" os.environ["model"] =3D data["name"] diff --git a/tests/cputestdata/cpu-parse.sh b/tests/cputestdata/cpu-parse.sh index 2a41897538..84d37d0df4 100755 --- a/tests/cputestdata/cpu-parse.sh +++ b/tests/cputestdata/cpu-parse.sh @@ -7,21 +7,6 @@ fi =20 data=3D`cat` =20 -xml() -{ - hex=3D'\(0x[0-9a-f]\+\)' - matchCPUID=3D"$hex $hex: eax=3D$hex ebx=3D$hex ecx=3D$hex edx=3D$hex" - substCPUID=3D"" - - matchMSR=3D"$hex: $hex\(.......[0-9a-f]\)" - substMSR=3D"" - - echo "" - echo "" - sed -ne "s/^ *$matchCPUID$/ $substCPUID/p; s/^ *$matchMSR$/ $substMS= R/p" - echo "" -} - json() { first=3Dtrue @@ -36,9 +21,6 @@ json() done } =20 -xml <<<"$data" >$fname.xml -echo $fname.xml - json <<<"$data" >$fname.json if [[ -s $fname.json ]]; then echo $fname.json --=20 2.26.2