[PATCH v2 4/7] tests: convert x86_64 tests to query-cpus-fast

Paolo Bonzini pbonzini at redhat.com
Mon Aug 8 15:15:05 UTC 2022


All supported versions of QEMU include the query-cpus-fast QMP command.
In preparation for dropping support for the old "query-cpus" commands,
convert the JSON output for x86 tests to the new format, and drop the
"halted" field from the expected output as it is not available anymore.

The CPU properties were obtained from the query-hotpluggable-cpus output
in tests/qemumonitorjsondata.  CPU, thread_id, and qom_path are renamed
respectively to cpu-index, qom-path and thread-id, while nip and halted
are removed.

Signed-off-by: Paolo Bonzini <pbonzini at redhat.com>
---
 ...json-cpuinfo-x86-basic-pluggable-cpus.json | 65 ++++++++++++-------
 ...nitorjson-cpuinfo-x86-basic-pluggable.data |  5 --
 ...onitorjson-cpuinfo-x86-node-full-cpus.json | 16 ++---
 ...qemumonitorjson-cpuinfo-x86-node-full.data |  2 -
 tests/qemumonitorjsontest.c                   |  4 +-
 5 files changed, 48 insertions(+), 44 deletions(-)

diff --git a/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-basic-pluggable-cpus.json b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-basic-pluggable-cpus.json
index 7a4973195c..c4250dae1d 100644
--- a/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-basic-pluggable-cpus.json
+++ b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-basic-pluggable-cpus.json
@@ -3,47 +3,62 @@
     {
       "arch": "x86",
       "current": true,
-      "CPU": 0,
-      "qom_path": "/machine/unattached/device[0]",
-      "pc": -2130415978,
-      "halted": true,
-      "thread_id": 518291
+      "cpu-index": 0,
+      "props": {
+        "core-id": 0,
+        "thread-id": 0,
+        "socket-id": 0
+      },
+      "qom-path": "/machine/unattached/device[0]",
+      "thread-id": 518291
     },
     {
       "arch": "x86",
       "current": false,
-      "CPU": 1,
-      "qom_path": "/machine/unattached/device[2]",
-      "pc": -2130415978,
-      "halted": true,
-      "thread_id": 518292
+      "cpu-index": 1,
+      "props": {
+        "core-id": 1,
+        "thread-id": 0,
+        "socket-id": 0
+      },
+      "qom-path": "/machine/unattached/device[2]",
+      "thread-id": 518292
     },
     {
       "arch": "x86",
       "current": false,
-      "CPU": 2,
-      "qom_path": "/machine/unattached/device[3]",
-      "pc": -2130415978,
-      "halted": true,
-      "thread_id": 518294
+      "cpu-index": 2,
+      "props": {
+        "core-id": 1,
+        "thread-id": 1,
+        "socket-id": 0
+      },
+      "qom-path": "/machine/unattached/device[3]",
+      "thread-id": 518294
     },
     {
       "arch": "x86",
       "current": false,
-      "CPU": 3,
-      "qom_path": "/machine/unattached/device[4]",
-      "pc": -2130415978,
-      "halted": true,
-      "thread_id": 518295
+      "cpu-index": 3,
+      "props": {
+        "core-id": 0,
+        "thread-id": 0,
+        "socket-id": 1
+      },
+      "qom-path": "/machine/unattached/device[4]",
+      "thread-id": 518295
     },
     {
       "arch": "x86",
       "current": false,
-      "CPU": 4,
-      "qom_path": "/machine/unattached/device[5]",
-      "pc": -2130415978,
-      "halted": true,
-      "thread_id": 518296
+      "cpu-index": 4,
+      "props": {
+        "core-id": 0,
+        "thread-id": 1,
+        "socket-id": 1
+      },
+      "qom-path": "/machine/unattached/device[5]",
+      "thread-id": 518296
     }
   ],
   "id": "libvirt-22"
diff --git a/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-basic-pluggable.data b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-basic-pluggable.data
index 9a1788d947..93cefb9dd2 100644
--- a/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-basic-pluggable.data
+++ b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-basic-pluggable.data
@@ -7,7 +7,6 @@
     type='qemu64-x86_64-cpu'
     qom_path='/machine/unattached/device[0]'
     topology: socket='0' core='0' thread='0' vcpus='1'
-    halted
 [vcpu libvirt-id='1']
     online=yes
     hotpluggable=no
@@ -17,7 +16,6 @@
     type='qemu64-x86_64-cpu'
     qom_path='/machine/unattached/device[2]'
     topology: socket='0' core='0' thread='1' vcpus='1'
-    halted
 [vcpu libvirt-id='2']
     online=yes
     hotpluggable=no
@@ -27,7 +25,6 @@
     type='qemu64-x86_64-cpu'
     qom_path='/machine/unattached/device[3]'
     topology: socket='0' core='1' thread='0' vcpus='1'
-    halted
 [vcpu libvirt-id='3']
     online=yes
     hotpluggable=no
@@ -37,7 +34,6 @@
     type='qemu64-x86_64-cpu'
     qom_path='/machine/unattached/device[4]'
     topology: socket='0' core='1' thread='1' vcpus='1'
-    halted
 [vcpu libvirt-id='4']
     online=yes
     hotpluggable=no
@@ -47,7 +43,6 @@
     type='qemu64-x86_64-cpu'
     qom_path='/machine/unattached/device[5]'
     topology: socket='1' core='0' thread='0' vcpus='1'
-    halted
 [vcpu libvirt-id='5']
     online=no
     hotpluggable=yes
diff --git a/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-node-full-cpus.json b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-node-full-cpus.json
index 6b39efa69c..a384512330 100644
--- a/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-node-full-cpus.json
+++ b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-node-full-cpus.json
@@ -9,11 +9,9 @@
         "node-id": 0,
         "socket-id": 0
       },
-      "CPU": 0,
-      "qom_path": "/machine/unattached/device[0]",
-      "pc": 1048956,
-      "halted": true,
-      "thread_id": 2033724
+      "cpu-index": 0,
+      "qom-path": "/machine/unattached/device[0]",
+      "thread-id": 2033724
     },
     {
       "arch": "x86",
@@ -24,11 +22,9 @@
         "node-id": 1,
         "socket-id": 0
       },
-      "CPU": 1,
-      "qom_path": "/machine/unattached/device[2]",
-      "pc": 1037318,
-      "halted": true,
-      "thread_id": 2033725
+      "cpu-index": 1,
+      "qom-path": "/machine/unattached/device[2]",
+      "thread-id": 2033725
     }
   ],
   "id": "libvirt-21"
diff --git a/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-node-full.data b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-node-full.data
index 0f7dbf1349..070ea084e7 100644
--- a/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-node-full.data
+++ b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-node-full.data
@@ -7,7 +7,6 @@
     type='Broadwell-x86_64-cpu'
     qom_path='/machine/unattached/device[0]'
     topology: socket='0' core='0' thread='0' node='0' vcpus='1'
-    halted
 [vcpu libvirt-id='1']
     online=yes
     hotpluggable=no
@@ -17,7 +16,6 @@
     type='Broadwell-x86_64-cpu'
     qom_path='/machine/unattached/device[2]'
     topology: socket='0' core='0' thread='1' node='1' vcpus='1'
-    halted
 [vcpu libvirt-id='2']
     online=no
     hotpluggable=yes
diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c
index 56620f16a6..0001df7bb3 100644
--- a/tests/qemumonitorjsontest.c
+++ b/tests/qemumonitorjsontest.c
@@ -3114,9 +3114,9 @@ mymain(void)
     DO_TEST_CPU_DATA("full");
     DO_TEST_CPU_DATA("ecx");
 
-    DO_TEST_CPU_INFO("x86-basic-pluggable", 8);
+    DO_TEST_CPU_INFO_FAST("x86-basic-pluggable", 8);
     DO_TEST_CPU_INFO_FAST("x86-full", 11);
-    DO_TEST_CPU_INFO("x86-node-full", 8);
+    DO_TEST_CPU_INFO_FAST("x86-node-full", 8);
     DO_TEST_CPU_INFO_FAST("x86-dies", 16);
 
     DO_TEST_CPU_INFO_FAST("ppc64-basic", 24);
-- 
2.37.1




More information about the libvir-list mailing list