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 <mihaj...@linux.vnet.ibm.com>
---
 .../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-full-fast-cpus.json
 create mode 100644 
tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-full-fast-hotplug.json
 create mode 100644 
tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-full-fast.data

diff --git 
a/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-ppc64-hotplug-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='vcpu0'
     qom_path='/machine/peripheral/vcpu0'
     topology: core='8' vcpus='8'
+    halted
 [vcpu libvirt-id='9']
     online=yes
     hotpluggable=yes
     thread-id='23171'
     query-cpus-id='17'
+    halted
 [vcpu libvirt-id='10']
     online=yes
     hotpluggable=yes
     thread-id='23172'
     query-cpus-id='18'
+    halted
 [vcpu libvirt-id='11']
     online=yes
     hotpluggable=yes
     thread-id='23173'
     query-cpus-id='19'
+    halted
 [vcpu libvirt-id='12']
     online=yes
     hotpluggable=yes
     thread-id='23174'
     query-cpus-id='20'
+    halted
 [vcpu libvirt-id='13']
     online=yes
     hotpluggable=yes
     thread-id='23175'
     query-cpus-id='21'
+    halted
 [vcpu libvirt-id='14']
     online=yes
     hotpluggable=yes
     thread-id='23176'
     query-cpus-id='22'
+    halted
 [vcpu libvirt-id='15']
     online=yes
     hotpluggable=yes
     thread-id='23177'
     query-cpus-id='23'
+    halted
 [vcpu libvirt-id='16']
     online=yes
     hotpluggable=yes
diff --git 
a/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-basic-pluggable.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='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
@@ -16,6 +17,7 @@
     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
@@ -25,6 +27,7 @@
     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
@@ -34,6 +37,7 @@
     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
@@ -43,6 +47,7 @@
     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-full-fast-cpus.json 
b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-full-fast-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-fast-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-hotplug.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-fast.data 
b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-full-fast.data
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='0']
+    online=yes
+    hotpluggable=no
+    thread-id='895040'
+    enable-id='1'
+    query-cpus-id='0'
+    type='Broadwell-x86_64-cpu'
+    qom_path='/machine/unattached/device[0]'
+    topology: socket='0' core='0' thread='0' vcpus='1'
+[vcpu libvirt-id='1']
+    online=yes
+    hotpluggable=yes
+    thread-id='895056'
+    enable-id='2'
+    query-cpus-id='1'
+    type='Broadwell-x86_64-cpu'
+    alias='vcpu1'
+    qom_path='/machine/peripheral/vcpu1'
+    topology: socket='1' core='0' thread='0' vcpus='1'
+[vcpu libvirt-id='2']
+    online=yes
+    hotpluggable=yes
+    thread-id='895057'
+    enable-id='3'
+    query-cpus-id='2'
+    type='Broadwell-x86_64-cpu'
+    alias='vcpu2'
+    qom_path='/machine/peripheral/vcpu2'
+    topology: socket='2' core='0' thread='0' vcpus='1'
+[vcpu libvirt-id='3']
+    online=yes
+    hotpluggable=yes
+    thread-id='895058'
+    enable-id='4'
+    query-cpus-id='3'
+    type='Broadwell-x86_64-cpu'
+    alias='vcpu3'
+    qom_path='/machine/peripheral/vcpu3'
+    topology: socket='3' core='0' thread='0' vcpus='1'
+[vcpu libvirt-id='4']
+    online=yes
+    hotpluggable=yes
+    thread-id='895059'
+    enable-id='5'
+    query-cpus-id='4'
+    type='Broadwell-x86_64-cpu'
+    alias='vcpu4'
+    qom_path='/machine/peripheral/vcpu4'
+    topology: socket='4' core='0' thread='0' vcpus='1'
+[vcpu libvirt-id='5']
+    online=yes
+    hotpluggable=yes
+    thread-id='895060'
+    enable-id='6'
+    query-cpus-id='5'
+    type='Broadwell-x86_64-cpu'
+    alias='vcpu5'
+    qom_path='/machine/peripheral/vcpu5'
+    topology: socket='5' core='0' thread='0' vcpus='1'
+[vcpu libvirt-id='6']
+    online=yes
+    hotpluggable=yes
+    thread-id='895061'
+    enable-id='7'
+    query-cpus-id='6'
+    type='Broadwell-x86_64-cpu'
+    alias='vcpu6'
+    qom_path='/machine/peripheral/vcpu6'
+    topology: socket='6' core='0' thread='0' vcpus='1'
+[vcpu libvirt-id='7']
+    online=yes
+    hotpluggable=yes
+    thread-id='895062'
+    enable-id='8'
+    query-cpus-id='7'
+    type='Broadwell-x86_64-cpu'
+    alias='vcpu7'
+    qom_path='/machine/peripheral/vcpu7'
+    topology: socket='7' core='0' thread='0' vcpus='1'
+[vcpu libvirt-id='8']
+    online=yes
+    hotpluggable=yes
+    thread-id='895063'
+    enable-id='9'
+    query-cpus-id='8'
+    type='Broadwell-x86_64-cpu'
+    alias='vcpu8'
+    qom_path='/machine/peripheral/vcpu8'
+    topology: socket='8' core='0' thread='0' vcpus='1'
+[vcpu libvirt-id='9']
+    online=yes
+    hotpluggable=yes
+    thread-id='895064'
+    enable-id='10'
+    query-cpus-id='9'
+    type='Broadwell-x86_64-cpu'
+    alias='vcpu9'
+    qom_path='/machine/peripheral/vcpu9'
+    topology: socket='9' core='0' thread='0' vcpus='1'
+[vcpu libvirt-id='10']
+    online=yes
+    hotpluggable=yes
+    thread-id='895065'
+    enable-id='11'
+    query-cpus-id='10'
+    type='Broadwell-x86_64-cpu'
+    alias='vcpu10'
+    qom_path='/machine/peripheral/vcpu10'
+    topology: socket='10' core='0' thread='0' vcpus='1'
diff --git 
a/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-node-full.data 
b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-node-full.data
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='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
@@ -16,6 +17,7 @@
     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 0add50a..5daa2c9 100644
--- a/tests/qemumonitorjsontest.c
+++ b/tests/qemumonitorjsontest.c
@@ -1363,6 +1363,42 @@ testQemuMonitorJSONqemuMonitorJSONQueryCPUsEqual(struct 
qemuMonitorQueryCpusEntr
     return true;
 }
 
+static int
+testQEMUMonitorJSONqemuMonitorJSONQueryCPUsHelper(qemuMonitorTestPtr test,
+                                                  struct 
qemuMonitorQueryCpusEntry *expect,
+                                                  bool fast,
+                                                  size_t num)
+{
+    struct qemuMonitorQueryCpusEntry *cpudata = NULL;
+    size_t ncpudata = 0;
+    size_t i;
+    int ret = -1;
+
+    if (qemuMonitorJSONQueryCPUs(qemuMonitorTestGetMonitor(test),
+                                 &cpudata, &ncpudata, true, fast) < 0)
+        goto cleanup;
+
+    if (ncpudata != num) {
+        virReportError(VIR_ERR_INTERNAL_ERROR,
+                       "Expecting ncpupids = %zu but got %zu", num, ncpudata);
+        goto cleanup;
+    }
+
+    for (i = 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 = 0;
+
+ cleanup:
+    qemuMonitorQueryCpusFree(cpudata, ncpudata);
+    return ret;
+}
 
 static int
 testQemuMonitorJSONqemuMonitorJSONQueryCPUs(const void *data)
@@ -1370,15 +1406,16 @@ testQemuMonitorJSONqemuMonitorJSONQueryCPUs(const void 
*data)
     virDomainXMLOptionPtr xmlopt = (virDomainXMLOptionPtr)data;
     qemuMonitorTestPtr test = qemuMonitorTestNewSimple(true, xmlopt);
     int ret = -1;
-    struct qemuMonitorQueryCpusEntry *cpudata = NULL;
-    struct qemuMonitorQueryCpusEntry expect[] = {
-        {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[] = {
+            {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[] = {
+            {0, 17629, (char *) "/machine/unattached/device[0]", false},
+            {1, 17630, (char *) "/machine/unattached/device[1]", false},
     };
-    size_t ncpudata = 0;
-    size_t i;
 
     if (!test)
         return -1;
@@ -1422,29 +1459,37 @@ testQemuMonitorJSONqemuMonitorJSONQueryCPUs(const void 
*data)
                                "}") < 0)
         goto cleanup;
 
-    if (qemuMonitorJSONQueryCPUs(qemuMonitorTestGetMonitor(test),
-                                 &cpudata, &ncpudata, true, false) < 0)
+    if (qemuMonitorTestAddItem(test, "query-cpus-fast",
+                               "{"
+                               "    \"return\": ["
+                               "        {"
+                               "            \"cpu-index\": 0,"
+                               "            \"qom-path\": 
\"/machine/unattached/device[0]\","
+                               "            \"thread-id\": 17629"
+                               "        },"
+                               "        {"
+                               "            \"cpu-index\": 1,"
+                               "            \"qom-path\": 
\"/machine/unattached/device[1]\","
+                               "            \"thread-id\": 17630"
+                               "        }"
+                               "    ],"
+                               "    \"id\": \"libvirt-8\""
+                               "}") < 0)
         goto cleanup;
 
-    if (ncpudata != 4) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
-                       "Expecting ncpupids = 4 but got %zu", ncpudata);
+    /* query-cpus */
+    if (testQEMUMonitorJSONqemuMonitorJSONQueryCPUsHelper(test, expect_slow,
+                                                          false, 4))
         goto cleanup;
-    }
 
-    for (i = 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_fast,
+                                                          true, 2))
+        goto cleanup;
 
     ret = 0;
 
  cleanup:
-    qemuMonitorQueryCpusFree(cpudata, ncpudata);
     qemuMonitorTestFree(test);
     return ret;
 }
@@ -2615,6 +2660,7 @@ struct testCPUInfoData {
     const char *name;
     size_t maxvcpus;
     virDomainXMLOptionPtr xmlopt;
+    bool fast;
 };
 
 
@@ -2669,6 +2715,9 @@ testQemuMonitorCPUInfoFormat(qemuMonitorCPUInfoPtr vcpus,
             virBufferAddLit(&buf, "\n");
         }
 
+        if (vcpu->halted)
+            virBufferAddLit(&buf, "halted\n");
+
         virBufferAdjustIndent(&buf, -4);
     }
 
@@ -2681,12 +2730,14 @@ testQemuMonitorCPUInfo(const void *opaque)
 {
     const struct testCPUInfoData *data = opaque;
     qemuMonitorTestPtr test = qemuMonitorTestNewSimple(true, data->xmlopt);
+    virDomainObjPtr vm = NULL;
     char *queryCpusFile = NULL;
     char *queryHotpluggableFile = NULL;
     char *dataFile = NULL;
     char *queryCpusStr = NULL;
     char *queryHotpluggableStr = NULL;
     char *actual = NULL;
+    const char *queryCpusFunction;
     qemuMonitorCPUInfoPtr vcpus = NULL;
     int rc;
     int ret = -1;
@@ -2715,11 +2766,20 @@ testQemuMonitorCPUInfo(const void *opaque)
                                queryHotpluggableStr) < 0)
         goto cleanup;
 
-    if (qemuMonitorTestAddItem(test, "query-cpus", queryCpusStr) < 0)
+    if (data->fast)
+        queryCpusFunction = "query-cpus-fast";
+    else
+        queryCpusFunction = "query-cpus";
+
+    if (qemuMonitorTestAddItem(test, queryCpusFunction, queryCpusStr) < 0)
         goto cleanup;
 
+    vm = qemuMonitorTestGetDomainObj(test);
+    if (!vm)
+        return -1;
+
     rc = qemuMonitorGetCPUInfo(qemuMonitorTestGetMonitor(test),
-                               &vcpus, data->maxvcpus, true, false);
+                               &vcpus, data->maxvcpus, true, data->fast);
 
     if (rc < 0)
         goto cleanup;
@@ -2930,7 +2990,15 @@ mymain(void)
 
 #define DO_TEST_CPU_INFO(name, maxvcpus) \
     do { \
-        struct testCPUInfoData data = {name, maxvcpus, driver.xmlopt}; \
+        struct testCPUInfoData data = {name, maxvcpus, driver.xmlopt, false}; \
+        if (virTestRun("GetCPUInfo(" name ")", testQemuMonitorCPUInfo, \
+                       &data) < 0) \
+            ret = -1; \
+    } while (0)
+
+#define DO_TEST_CPU_INFO_FAST(name, maxvcpus) \
+    do { \
+        struct testCPUInfoData data = {name, maxvcpus, driver.xmlopt, true}; \
         if (virTestRun("GetCPUInfo(" name ")", testQemuMonitorCPUInfo, \
                        &data) < 0) \
             ret = -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);
 
     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);
 
 qemuMonitorPtr qemuMonitorTestGetMonitor(qemuMonitorTestPtr test);
 qemuAgentPtr qemuMonitorTestGetAgent(qemuMonitorTestPtr test);
+virDomainObjPtr qemuMonitorTestGetDomainObj(qemuMonitorTestPtr test);
 
 #endif /* __VIR_QEMU_MONITOR_TEST_UTILS_H__ */
-- 
1.9.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to