From nobody Wed May 14 12:05:11 2025 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1522853173328632.5829403719179; Wed, 4 Apr 2018 07:46:13 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EE35F97869; Wed, 4 Apr 2018 14:46:11 +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 97D3889E68; Wed, 4 Apr 2018 14:46:11 +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 57B3E65D3E; Wed, 4 Apr 2018 14:46:11 +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 w34Ek9L5022170 for ; Wed, 4 Apr 2018 10:46:09 -0400 Received: by smtp.corp.redhat.com (Postfix) id F3AB06266C; Wed, 4 Apr 2018 14:46:08 +0000 (UTC) Received: from mx1.redhat.com (ext-mx07.extmail.prod.ext.phx2.redhat.com [10.5.110.31]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E9CD417B95 for ; Wed, 4 Apr 2018 14:45:53 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 05277C070E1E for ; Wed, 4 Apr 2018 14:45:21 +0000 (UTC) Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w34EjHqX117882 for ; Wed, 4 Apr 2018 10:45:20 -0400 Received: from e06smtp15.uk.ibm.com (e06smtp15.uk.ibm.com [195.75.94.111]) by mx0a-001b2d01.pphosted.com with ESMTP id 2h4xmrxndj-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Wed, 04 Apr 2018 10:45:19 -0400 Received: from localhost by e06smtp15.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 4 Apr 2018 15:45:13 +0100 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) by e06smtp15.uk.ibm.com (192.168.101.145) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 4 Apr 2018 15:45:11 +0100 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w34EjB8s37879944; Wed, 4 Apr 2018 14:45:11 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A65805204B; Wed, 4 Apr 2018 14:36:18 +0100 (BST) Received: from bradbury.ibm.com (unknown [9.152.222.211]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id 81A1952045; Wed, 4 Apr 2018 14:36:18 +0100 (BST) From: Viktor Mihajlovski To: libvir-list@redhat.com Date: Wed, 4 Apr 2018 16:45:04 +0200 In-Reply-To: <1522853107-22727-1-git-send-email-mihajlov@linux.vnet.ibm.com> References: <1522853107-22727-1-git-send-email-mihajlov@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18040414-0020-0000-0000-0000040E05B9 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18040414-0021-0000-0000-000042A2157A Message-Id: <1522853107-22727-4-git-send-email-mihajlov@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2018-04-04_04:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1804040148 X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 207 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Wed, 04 Apr 2018 14:45:21 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Wed, 04 Apr 2018 14:45:21 +0000 (UTC) for IP:'148.163.158.5' DOMAIN:'mx0b-001b2d01.pphosted.com' HELO:'mx0a-001b2d01.pphosted.com' FROM:'mihajlov@de.ibm.com' RCPT:'' X-RedHat-Spam-Score: -0.701 (RCVD_IN_DNSWL_LOW, SPF_PASS) 148.163.158.5 mx0b-001b2d01.pphosted.com 148.163.158.5 mx0b-001b2d01.pphosted.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.31 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: pkrempa@redhat.com Subject: [libvirt] [PATCHv3 3/6] tests: add qemumonitorjson tests for query-cpus-fast 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 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.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Wed, 04 Apr 2018 14:46:12 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Extended the json monitor test program with support for query-cpus-fast and added a sample file set for x86 data obtained using the it. Also extend the test program to recognize the halted property. Signed-off-by: Viktor Mihajlovski --- .../qemumonitorjson-cpuinfo-ppc64-hotplug-4.data | 8 ++ ...emumonitorjson-cpuinfo-x86-basic-pluggable.data | 5 + ...qemumonitorjson-cpuinfo-x86-full-fast-cpus.json | 126 +++++++++++++++++= ++++ ...umonitorjson-cpuinfo-x86-full-fast-hotplug.json | 115 +++++++++++++++++= ++ .../qemumonitorjson-cpuinfo-x86-full-fast.data | 109 ++++++++++++++++++ .../qemumonitorjson-cpuinfo-x86-node-full.data | 2 + tests/qemumonitorjsontest.c | 121 +++++++++++++++--= --- tests/qemumonitortestutils.c | 7 ++ tests/qemumonitortestutils.h | 1 + 9 files changed, 468 insertions(+), 26 deletions(-) create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-f= ull-fast-cpus.json create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-f= ull-fast-hotplug.json create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-f= ull-fast.data diff --git a/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-ppc64-hotplu= g-4.data b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-ppc64-hotplug-= 4.data index 7c90889..5f6b865 100644 --- a/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-ppc64-hotplug-4.data +++ b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-ppc64-hotplug-4.data @@ -52,41 +52,49 @@ alias=3D'vcpu0' qom_path=3D'/machine/peripheral/vcpu0' topology: core=3D'8' vcpus=3D'8' + halted [vcpu libvirt-id=3D'9'] online=3Dyes hotpluggable=3Dyes thread-id=3D'23171' query-cpus-id=3D'17' + halted [vcpu libvirt-id=3D'10'] online=3Dyes hotpluggable=3Dyes thread-id=3D'23172' query-cpus-id=3D'18' + halted [vcpu libvirt-id=3D'11'] online=3Dyes hotpluggable=3Dyes thread-id=3D'23173' query-cpus-id=3D'19' + halted [vcpu libvirt-id=3D'12'] online=3Dyes hotpluggable=3Dyes thread-id=3D'23174' query-cpus-id=3D'20' + halted [vcpu libvirt-id=3D'13'] online=3Dyes hotpluggable=3Dyes thread-id=3D'23175' query-cpus-id=3D'21' + halted [vcpu libvirt-id=3D'14'] online=3Dyes hotpluggable=3Dyes thread-id=3D'23176' query-cpus-id=3D'22' + halted [vcpu libvirt-id=3D'15'] online=3Dyes hotpluggable=3Dyes thread-id=3D'23177' query-cpus-id=3D'23' + halted [vcpu libvirt-id=3D'16'] online=3Dyes hotpluggable=3Dyes diff --git a/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-basic-pl= uggable.data b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-basic-= pluggable.data index 93cefb9..9a1788d 100644 --- a/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-basic-pluggable= .data +++ b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-basic-pluggable= .data @@ -7,6 +7,7 @@ type=3D'qemu64-x86_64-cpu' qom_path=3D'/machine/unattached/device[0]' topology: socket=3D'0' core=3D'0' thread=3D'0' vcpus=3D'1' + halted [vcpu libvirt-id=3D'1'] online=3Dyes hotpluggable=3Dno @@ -16,6 +17,7 @@ type=3D'qemu64-x86_64-cpu' qom_path=3D'/machine/unattached/device[2]' topology: socket=3D'0' core=3D'0' thread=3D'1' vcpus=3D'1' + halted [vcpu libvirt-id=3D'2'] online=3Dyes hotpluggable=3Dno @@ -25,6 +27,7 @@ type=3D'qemu64-x86_64-cpu' qom_path=3D'/machine/unattached/device[3]' topology: socket=3D'0' core=3D'1' thread=3D'0' vcpus=3D'1' + halted [vcpu libvirt-id=3D'3'] online=3Dyes hotpluggable=3Dno @@ -34,6 +37,7 @@ type=3D'qemu64-x86_64-cpu' qom_path=3D'/machine/unattached/device[4]' topology: socket=3D'0' core=3D'1' thread=3D'1' vcpus=3D'1' + halted [vcpu libvirt-id=3D'4'] online=3Dyes hotpluggable=3Dno @@ -43,6 +47,7 @@ type=3D'qemu64-x86_64-cpu' qom_path=3D'/machine/unattached/device[5]' topology: socket=3D'1' core=3D'0' thread=3D'0' vcpus=3D'1' + halted [vcpu libvirt-id=3D'5'] online=3Dno hotpluggable=3Dyes diff --git a/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-full-fas= t-cpus.json b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-full-fa= st-cpus.json new file mode 100644 index 0000000..b8c2553 --- /dev/null +++ b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-full-fast-cpus.= json @@ -0,0 +1,126 @@ +{ + "return": [ + { + "arch": "x86", + "cpu-index": 0, + "props": { + "core-id": 0, + "thread-id": 0, + "socket-id": 0 + }, + "qom-path": "/machine/unattached/device[0]", + "thread-id": 895040 + }, + { + "arch": "x86", + "cpu-index": 1, + "props": { + "core-id": 0, + "thread-id": 0, + "socket-id": 1 + }, + "qom-path": "/machine/peripheral/vcpu1", + "thread-id": 895056 + }, + { + "arch": "x86", + "cpu-index": 2, + "props": { + "core-id": 0, + "thread-id": 0, + "socket-id": 2 + }, + "qom-path": "/machine/peripheral/vcpu2", + "thread-id": 895057 + }, + { + "arch": "x86", + "cpu-index": 3, + "props": { + "core-id": 0, + "thread-id": 0, + "socket-id": 3 + }, + "qom-path": "/machine/peripheral/vcpu3", + "thread-id": 895058 + }, + { + "arch": "x86", + "cpu-index": 4, + "props": { + "core-id": 0, + "thread-id": 0, + "socket-id": 4 + }, + "qom-path": "/machine/peripheral/vcpu4", + "thread-id": 895059 + }, + { + "arch": "x86", + "cpu-index": 5, + "props": { + "core-id": 0, + "thread-id": 0, + "socket-id": 5 + }, + "qom-path": "/machine/peripheral/vcpu5", + "thread-id": 895060 + }, + { + "arch": "x86", + "cpu-index": 6, + "props": { + "core-id": 0, + "thread-id": 0, + "socket-id": 6 + }, + "qom-path": "/machine/peripheral/vcpu6", + "thread-id": 895061 + }, + { + "arch": "x86", + "cpu-index": 7, + "props": { + "core-id": 0, + "thread-id": 0, + "socket-id": 7 + }, + "qom-path": "/machine/peripheral/vcpu7", + "thread-id": 895062 + }, + { + "arch": "x86", + "cpu-index": 8, + "props": { + "core-id": 0, + "thread-id": 0, + "socket-id": 8 + }, + "qom-path": "/machine/peripheral/vcpu8", + "thread-id": 895063 + }, + { + "arch": "x86", + "cpu-index": 9, + "props": { + "core-id": 0, + "thread-id": 0, + "socket-id": 9 + }, + "qom-path": "/machine/peripheral/vcpu9", + "thread-id": 895064 + }, + { + "arch": "x86", + "cpu-index": 10, + "props": { + "core-id": 0, + "thread-id": 0, + "socket-id": 10 + }, + "qom-path": "/machine/peripheral/vcpu10", + "thread-id": 895065 + } + ], + "id": "libvirt-52" +} diff --git a/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-full-fas= t-hotplug.json b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-full= -fast-hotplug.json new file mode 100644 index 0000000..aff5aa3 --- /dev/null +++ b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-full-fast-hotpl= ug.json @@ -0,0 +1,115 @@ +{ + "return": [ + { + "props": { + "core-id": 0, + "thread-id": 0, + "socket-id": 10 + }, + "vcpus-count": 1, + "qom-path": "/machine/peripheral/vcpu10", + "type": "Broadwell-x86_64-cpu" + }, + { + "props": { + "core-id": 0, + "thread-id": 0, + "socket-id": 9 + }, + "vcpus-count": 1, + "qom-path": "/machine/peripheral/vcpu9", + "type": "Broadwell-x86_64-cpu" + }, + { + "props": { + "core-id": 0, + "thread-id": 0, + "socket-id": 8 + }, + "vcpus-count": 1, + "qom-path": "/machine/peripheral/vcpu8", + "type": "Broadwell-x86_64-cpu" + }, + { + "props": { + "core-id": 0, + "thread-id": 0, + "socket-id": 7 + }, + "vcpus-count": 1, + "qom-path": "/machine/peripheral/vcpu7", + "type": "Broadwell-x86_64-cpu" + }, + { + "props": { + "core-id": 0, + "thread-id": 0, + "socket-id": 6 + }, + "vcpus-count": 1, + "qom-path": "/machine/peripheral/vcpu6", + "type": "Broadwell-x86_64-cpu" + }, + { + "props": { + "core-id": 0, + "thread-id": 0, + "socket-id": 5 + }, + "vcpus-count": 1, + "qom-path": "/machine/peripheral/vcpu5", + "type": "Broadwell-x86_64-cpu" + }, + { + "props": { + "core-id": 0, + "thread-id": 0, + "socket-id": 4 + }, + "vcpus-count": 1, + "qom-path": "/machine/peripheral/vcpu4", + "type": "Broadwell-x86_64-cpu" + }, + { + "props": { + "core-id": 0, + "thread-id": 0, + "socket-id": 3 + }, + "vcpus-count": 1, + "qom-path": "/machine/peripheral/vcpu3", + "type": "Broadwell-x86_64-cpu" + }, + { + "props": { + "core-id": 0, + "thread-id": 0, + "socket-id": 2 + }, + "vcpus-count": 1, + "qom-path": "/machine/peripheral/vcpu2", + "type": "Broadwell-x86_64-cpu" + }, + { + "props": { + "core-id": 0, + "thread-id": 0, + "socket-id": 1 + }, + "vcpus-count": 1, + "qom-path": "/machine/peripheral/vcpu1", + "type": "Broadwell-x86_64-cpu" + }, + { + "props": { + "core-id": 0, + "thread-id": 0, + "socket-id": 0 + }, + "vcpus-count": 1, + "qom-path": "/machine/unattached/device[0]", + "type": "Broadwell-x86_64-cpu" + } + ], + "id": "libvirt-51" +} diff --git a/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-full-fas= t.data b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-full-fast.da= ta new file mode 100644 index 0000000..1908e39 --- /dev/null +++ b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-full-fast.data @@ -0,0 +1,109 @@ +[vcpu libvirt-id=3D'0'] + online=3Dyes + hotpluggable=3Dno + thread-id=3D'895040' + enable-id=3D'1' + query-cpus-id=3D'0' + type=3D'Broadwell-x86_64-cpu' + qom_path=3D'/machine/unattached/device[0]' + topology: socket=3D'0' core=3D'0' thread=3D'0' vcpus=3D'1' +[vcpu libvirt-id=3D'1'] + online=3Dyes + hotpluggable=3Dyes + thread-id=3D'895056' + enable-id=3D'2' + query-cpus-id=3D'1' + type=3D'Broadwell-x86_64-cpu' + alias=3D'vcpu1' + qom_path=3D'/machine/peripheral/vcpu1' + topology: socket=3D'1' core=3D'0' thread=3D'0' vcpus=3D'1' +[vcpu libvirt-id=3D'2'] + online=3Dyes + hotpluggable=3Dyes + thread-id=3D'895057' + enable-id=3D'3' + query-cpus-id=3D'2' + type=3D'Broadwell-x86_64-cpu' + alias=3D'vcpu2' + qom_path=3D'/machine/peripheral/vcpu2' + topology: socket=3D'2' core=3D'0' thread=3D'0' vcpus=3D'1' +[vcpu libvirt-id=3D'3'] + online=3Dyes + hotpluggable=3Dyes + thread-id=3D'895058' + enable-id=3D'4' + query-cpus-id=3D'3' + type=3D'Broadwell-x86_64-cpu' + alias=3D'vcpu3' + qom_path=3D'/machine/peripheral/vcpu3' + topology: socket=3D'3' core=3D'0' thread=3D'0' vcpus=3D'1' +[vcpu libvirt-id=3D'4'] + online=3Dyes + hotpluggable=3Dyes + thread-id=3D'895059' + enable-id=3D'5' + query-cpus-id=3D'4' + type=3D'Broadwell-x86_64-cpu' + alias=3D'vcpu4' + qom_path=3D'/machine/peripheral/vcpu4' + topology: socket=3D'4' core=3D'0' thread=3D'0' vcpus=3D'1' +[vcpu libvirt-id=3D'5'] + online=3Dyes + hotpluggable=3Dyes + thread-id=3D'895060' + enable-id=3D'6' + query-cpus-id=3D'5' + type=3D'Broadwell-x86_64-cpu' + alias=3D'vcpu5' + qom_path=3D'/machine/peripheral/vcpu5' + topology: socket=3D'5' core=3D'0' thread=3D'0' vcpus=3D'1' +[vcpu libvirt-id=3D'6'] + online=3Dyes + hotpluggable=3Dyes + thread-id=3D'895061' + enable-id=3D'7' + query-cpus-id=3D'6' + type=3D'Broadwell-x86_64-cpu' + alias=3D'vcpu6' + qom_path=3D'/machine/peripheral/vcpu6' + topology: socket=3D'6' core=3D'0' thread=3D'0' vcpus=3D'1' +[vcpu libvirt-id=3D'7'] + online=3Dyes + hotpluggable=3Dyes + thread-id=3D'895062' + enable-id=3D'8' + query-cpus-id=3D'7' + type=3D'Broadwell-x86_64-cpu' + alias=3D'vcpu7' + qom_path=3D'/machine/peripheral/vcpu7' + topology: socket=3D'7' core=3D'0' thread=3D'0' vcpus=3D'1' +[vcpu libvirt-id=3D'8'] + online=3Dyes + hotpluggable=3Dyes + thread-id=3D'895063' + enable-id=3D'9' + query-cpus-id=3D'8' + type=3D'Broadwell-x86_64-cpu' + alias=3D'vcpu8' + qom_path=3D'/machine/peripheral/vcpu8' + topology: socket=3D'8' core=3D'0' thread=3D'0' vcpus=3D'1' +[vcpu libvirt-id=3D'9'] + online=3Dyes + hotpluggable=3Dyes + thread-id=3D'895064' + enable-id=3D'10' + query-cpus-id=3D'9' + type=3D'Broadwell-x86_64-cpu' + alias=3D'vcpu9' + qom_path=3D'/machine/peripheral/vcpu9' + topology: socket=3D'9' core=3D'0' thread=3D'0' vcpus=3D'1' +[vcpu libvirt-id=3D'10'] + online=3Dyes + hotpluggable=3Dyes + thread-id=3D'895065' + enable-id=3D'11' + query-cpus-id=3D'10' + type=3D'Broadwell-x86_64-cpu' + alias=3D'vcpu10' + qom_path=3D'/machine/peripheral/vcpu10' + topology: socket=3D'10' core=3D'0' thread=3D'0' vcpus=3D'1' diff --git a/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-node-ful= l.data b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-node-full.da= ta index 070ea08..0f7dbf1 100644 --- a/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-node-full.data +++ b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-node-full.data @@ -7,6 +7,7 @@ type=3D'Broadwell-x86_64-cpu' qom_path=3D'/machine/unattached/device[0]' topology: socket=3D'0' core=3D'0' thread=3D'0' node=3D'0' vcpus=3D'1' + halted [vcpu libvirt-id=3D'1'] online=3Dyes hotpluggable=3Dno @@ -16,6 +17,7 @@ type=3D'Broadwell-x86_64-cpu' qom_path=3D'/machine/unattached/device[2]' topology: socket=3D'0' core=3D'0' thread=3D'1' node=3D'1' vcpus=3D'1' + halted [vcpu libvirt-id=3D'2'] online=3Dno hotpluggable=3Dyes diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index 0add50a..5daa2c9 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -1363,6 +1363,42 @@ testQemuMonitorJSONqemuMonitorJSONQueryCPUsEqual(str= uct qemuMonitorQueryCpusEntr return true; } =20 +static int +testQEMUMonitorJSONqemuMonitorJSONQueryCPUsHelper(qemuMonitorTestPtr test, + struct qemuMonitorQueryC= pusEntry *expect, + bool fast, + size_t num) +{ + struct qemuMonitorQueryCpusEntry *cpudata =3D NULL; + size_t ncpudata =3D 0; + size_t i; + int ret =3D -1; + + if (qemuMonitorJSONQueryCPUs(qemuMonitorTestGetMonitor(test), + &cpudata, &ncpudata, true, fast) < 0) + goto cleanup; + + if (ncpudata !=3D num) { + virReportError(VIR_ERR_INTERNAL_ERROR, + "Expecting ncpupids =3D %zu but got %zu", num, ncpu= data); + goto cleanup; + } + + for (i =3D 0; i < ncpudata; i++) { + if (!testQemuMonitorJSONqemuMonitorJSONQueryCPUsEqual(cpudata + i, + expect + i))= { + virReportError(VIR_ERR_INTERNAL_ERROR, + "vcpu entry %zu does not match expected data", = i); + goto cleanup; + } + } + + ret =3D 0; + + cleanup: + qemuMonitorQueryCpusFree(cpudata, ncpudata); + return ret; +} =20 static int testQemuMonitorJSONqemuMonitorJSONQueryCPUs(const void *data) @@ -1370,15 +1406,16 @@ testQemuMonitorJSONqemuMonitorJSONQueryCPUs(const v= oid *data) virDomainXMLOptionPtr xmlopt =3D (virDomainXMLOptionPtr)data; qemuMonitorTestPtr test =3D qemuMonitorTestNewSimple(true, xmlopt); int ret =3D -1; - struct qemuMonitorQueryCpusEntry *cpudata =3D NULL; - struct qemuMonitorQueryCpusEntry expect[] =3D { - {0, 17622, (char *) "/machine/unattached/device[0]", true}, - {1, 17624, (char *) "/machine/unattached/device[1]", true}, - {2, 17626, (char *) "/machine/unattached/device[2]", true}, - {3, 17628, NULL, true}, + struct qemuMonitorQueryCpusEntry expect_slow[] =3D { + {0, 17622, (char *) "/machine/unattached/device[0]", true}, + {1, 17624, (char *) "/machine/unattached/device[1]", true}, + {2, 17626, (char *) "/machine/unattached/device[2]", true}, + {3, 17628, NULL, true}, + }; + struct qemuMonitorQueryCpusEntry expect_fast[] =3D { + {0, 17629, (char *) "/machine/unattached/device[0]", false}, + {1, 17630, (char *) "/machine/unattached/device[1]", false}, }; - size_t ncpudata =3D 0; - size_t i; =20 if (!test) return -1; @@ -1422,29 +1459,37 @@ testQemuMonitorJSONqemuMonitorJSONQueryCPUs(const v= oid *data) "}") < 0) goto cleanup; =20 - if (qemuMonitorJSONQueryCPUs(qemuMonitorTestGetMonitor(test), - &cpudata, &ncpudata, true, false) < 0) + if (qemuMonitorTestAddItem(test, "query-cpus-fast", + "{" + " \"return\": [" + " {" + " \"cpu-index\": 0," + " \"qom-path\": \"/machine/unatt= ached/device[0]\"," + " \"thread-id\": 17629" + " }," + " {" + " \"cpu-index\": 1," + " \"qom-path\": \"/machine/unatt= ached/device[1]\"," + " \"thread-id\": 17630" + " }" + " ]," + " \"id\": \"libvirt-8\"" + "}") < 0) goto cleanup; =20 - if (ncpudata !=3D 4) { - virReportError(VIR_ERR_INTERNAL_ERROR, - "Expecting ncpupids =3D 4 but got %zu", ncpudata); + /* query-cpus */ + if (testQEMUMonitorJSONqemuMonitorJSONQueryCPUsHelper(test, expect_slo= w, + false, 4)) goto cleanup; - } =20 - for (i =3D 0; i < ncpudata; i++) { - if (!testQemuMonitorJSONqemuMonitorJSONQueryCPUsEqual(cpudata + i, - expect + i))= { - virReportError(VIR_ERR_INTERNAL_ERROR, - "vcpu entry %zu does not match expected data", = i); - goto cleanup; - } - } + /* query-cpus-fast */ + if (testQEMUMonitorJSONqemuMonitorJSONQueryCPUsHelper(test, expect_fas= t, + true, 2)) + goto cleanup; =20 ret =3D 0; =20 cleanup: - qemuMonitorQueryCpusFree(cpudata, ncpudata); qemuMonitorTestFree(test); return ret; } @@ -2615,6 +2660,7 @@ struct testCPUInfoData { const char *name; size_t maxvcpus; virDomainXMLOptionPtr xmlopt; + bool fast; }; =20 =20 @@ -2669,6 +2715,9 @@ testQemuMonitorCPUInfoFormat(qemuMonitorCPUInfoPtr vc= pus, virBufferAddLit(&buf, "\n"); } =20 + if (vcpu->halted) + virBufferAddLit(&buf, "halted\n"); + virBufferAdjustIndent(&buf, -4); } =20 @@ -2681,12 +2730,14 @@ testQemuMonitorCPUInfo(const void *opaque) { const struct testCPUInfoData *data =3D opaque; qemuMonitorTestPtr test =3D qemuMonitorTestNewSimple(true, data->xmlop= t); + virDomainObjPtr vm =3D NULL; char *queryCpusFile =3D NULL; char *queryHotpluggableFile =3D NULL; char *dataFile =3D NULL; char *queryCpusStr =3D NULL; char *queryHotpluggableStr =3D NULL; char *actual =3D NULL; + const char *queryCpusFunction; qemuMonitorCPUInfoPtr vcpus =3D NULL; int rc; int ret =3D -1; @@ -2715,11 +2766,20 @@ testQemuMonitorCPUInfo(const void *opaque) queryHotpluggableStr) < 0) goto cleanup; =20 - if (qemuMonitorTestAddItem(test, "query-cpus", queryCpusStr) < 0) + if (data->fast) + queryCpusFunction =3D "query-cpus-fast"; + else + queryCpusFunction =3D "query-cpus"; + + if (qemuMonitorTestAddItem(test, queryCpusFunction, queryCpusStr) < 0) goto cleanup; =20 + vm =3D qemuMonitorTestGetDomainObj(test); + if (!vm) + return -1; + rc =3D qemuMonitorGetCPUInfo(qemuMonitorTestGetMonitor(test), - &vcpus, data->maxvcpus, true, false); + &vcpus, data->maxvcpus, true, data->fast); =20 if (rc < 0) goto cleanup; @@ -2930,7 +2990,15 @@ mymain(void) =20 #define DO_TEST_CPU_INFO(name, maxvcpus) \ do { \ - struct testCPUInfoData data =3D {name, maxvcpus, driver.xmlopt}; \ + struct testCPUInfoData data =3D {name, maxvcpus, driver.xmlopt, fa= lse}; \ + if (virTestRun("GetCPUInfo(" name ")", testQemuMonitorCPUInfo, \ + &data) < 0) \ + ret =3D -1; \ + } while (0) + +#define DO_TEST_CPU_INFO_FAST(name, maxvcpus) \ + do { \ + struct testCPUInfoData data =3D {name, maxvcpus, driver.xmlopt, tr= ue}; \ if (virTestRun("GetCPUInfo(" name ")", testQemuMonitorCPUInfo, \ &data) < 0) \ ret =3D -1; \ @@ -3014,6 +3082,7 @@ mymain(void) DO_TEST_CPU_INFO("x86-basic-pluggable", 8); DO_TEST_CPU_INFO("x86-full", 11); DO_TEST_CPU_INFO("x86-node-full", 8); + DO_TEST_CPU_INFO_FAST("x86-full-fast", 11); =20 DO_TEST_CPU_INFO("ppc64-basic", 24); DO_TEST_CPU_INFO("ppc64-hotplug-1", 24); diff --git a/tests/qemumonitortestutils.c b/tests/qemumonitortestutils.c index 66bccac..62f68ee 100644 --- a/tests/qemumonitortestutils.c +++ b/tests/qemumonitortestutils.c @@ -1518,3 +1518,10 @@ qemuMonitorTestGetAgent(qemuMonitorTestPtr test) { return test->agent; } + + +virDomainObjPtr +qemuMonitorTestGetDomainObj(qemuMonitorTestPtr test) +{ + return test->vm; +} diff --git a/tests/qemumonitortestutils.h b/tests/qemumonitortestutils.h index d3dc029..855e625 100644 --- a/tests/qemumonitortestutils.h +++ b/tests/qemumonitortestutils.h @@ -99,5 +99,6 @@ void qemuMonitorTestFree(qemuMonitorTestPtr test); =20 qemuMonitorPtr qemuMonitorTestGetMonitor(qemuMonitorTestPtr test); qemuAgentPtr qemuMonitorTestGetAgent(qemuMonitorTestPtr test); +virDomainObjPtr qemuMonitorTestGetDomainObj(qemuMonitorTestPtr test); =20 #endif /* __VIR_QEMU_MONITOR_TEST_UTILS_H__ */ --=20 1.9.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list