]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
tests: validate parsing of CPUs with dies > 1
authorDaniel P. Berrangé <berrange@redhat.com>
Mon, 16 Mar 2020 12:55:52 +0000 (12:55 +0000)
committerDaniel P. Berrangé <berrange@redhat.com>
Mon, 16 Mar 2020 16:00:27 +0000 (16:00 +0000)
Add sample data files for validating handling of a QEMU guest started
with:

  -smp 7,maxcpus=16,sockets=2,dies=2,cores=2,threads=2

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-dies-cpus.json [new file with mode: 0644]
tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-dies-hotplug.json [new file with mode: 0644]
tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-dies.data [new file with mode: 0644]
tests/qemumonitorjsontest.c

diff --git a/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-dies-cpus.json b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-dies-cpus.json
new file mode 100644 (file)
index 0000000..f90e4ba
--- /dev/null
@@ -0,0 +1,95 @@
+{
+    "return": [
+        {
+            "arch": "x86",
+            "thread-id": 1538346,
+            "props": {
+                "core-id": 0,
+                "thread-id": 0,
+                "die-id": 0,
+                "socket-id": 0
+            },
+            "qom-path": "/machine/unattached/device[0]",
+            "cpu-index": 0,
+            "target": "x86_64"
+        },
+        {
+            "arch": "x86",
+            "thread-id": 1538347,
+            "props": {
+                "core-id": 0,
+                "thread-id": 1,
+                "die-id": 0,
+                "socket-id": 0
+            },
+            "qom-path": "/machine/unattached/device[2]",
+            "cpu-index": 1,
+            "target": "x86_64"
+        },
+        {
+            "arch": "x86",
+            "thread-id": 1538348,
+            "props": {
+                "core-id": 1,
+                "thread-id": 0,
+                "die-id": 0,
+                "socket-id": 0
+            },
+            "qom-path": "/machine/unattached/device[3]",
+            "cpu-index": 2,
+            "target": "x86_64"
+        },
+        {
+            "arch": "x86",
+            "thread-id": 1538349,
+            "props": {
+                "core-id": 1,
+                "thread-id": 1,
+                "die-id": 0,
+                "socket-id": 0
+            },
+            "qom-path": "/machine/unattached/device[4]",
+            "cpu-index": 3,
+            "target": "x86_64"
+        },
+        {
+            "arch": "x86",
+            "thread-id": 1538350,
+            "props": {
+                "core-id": 0,
+                "thread-id": 0,
+                "die-id": 1,
+                "socket-id": 0
+            },
+            "qom-path": "/machine/unattached/device[5]",
+            "cpu-index": 4,
+            "target": "x86_64"
+        },
+        {
+            "arch": "x86",
+            "thread-id": 1538351,
+            "props": {
+                "core-id": 0,
+                "thread-id": 1,
+                "die-id": 1,
+                "socket-id": 0
+            },
+            "qom-path": "/machine/unattached/device[6]",
+            "cpu-index": 5,
+            "target": "x86_64"
+        },
+        {
+            "arch": "x86",
+            "thread-id": 1538352,
+            "props": {
+                "core-id": 1,
+                "thread-id": 0,
+                "die-id": 1,
+                "socket-id": 0
+            },
+            "qom-path": "/machine/unattached/device[7]",
+            "cpu-index": 6,
+            "target": "x86_64"
+        }
+    ]
+}
diff --git a/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-dies-hotplug.json b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-dies-hotplug.json
new file mode 100644 (file)
index 0000000..294f470
--- /dev/null
@@ -0,0 +1,171 @@
+{
+    "return": [
+        {
+            "props": {
+                "core-id": 1,
+                "thread-id": 1,
+                "die-id": 1,
+                "socket-id": 1
+            },
+            "vcpus-count": 1,
+            "type": "host-x86_64-cpu"
+        },
+        {
+            "props": {
+                "core-id": 1,
+                "thread-id": 0,
+                "die-id": 1,
+                "socket-id": 1
+            },
+            "vcpus-count": 1,
+            "type": "host-x86_64-cpu"
+        },
+        {
+            "props": {
+                "core-id": 0,
+                "thread-id": 1,
+                "die-id": 1,
+                "socket-id": 1
+            },
+            "vcpus-count": 1,
+            "type": "host-x86_64-cpu"
+        },
+        {
+            "props": {
+                "core-id": 0,
+                "thread-id": 0,
+                "die-id": 1,
+                "socket-id": 1
+            },
+            "vcpus-count": 1,
+            "type": "host-x86_64-cpu"
+        },
+        {
+            "props": {
+                "core-id": 1,
+                "thread-id": 1,
+                "die-id": 0,
+                "socket-id": 1
+            },
+            "vcpus-count": 1,
+            "type": "host-x86_64-cpu"
+        },
+        {
+            "props": {
+                "core-id": 1,
+                "thread-id": 0,
+                "die-id": 0,
+                "socket-id": 1
+            },
+            "vcpus-count": 1,
+            "type": "host-x86_64-cpu"
+        },
+        {
+            "props": {
+                "core-id": 0,
+                "thread-id": 1,
+                "die-id": 0,
+                "socket-id": 1
+            },
+            "vcpus-count": 1,
+            "type": "host-x86_64-cpu"
+        },
+        {
+            "props": {
+                "core-id": 0,
+                "thread-id": 0,
+                "die-id": 0,
+                "socket-id": 1
+            },
+            "vcpus-count": 1,
+            "type": "host-x86_64-cpu"
+        },
+        {
+            "props": {
+                "core-id": 1,
+                "thread-id": 1,
+                "die-id": 1,
+                "socket-id": 0
+            },
+            "vcpus-count": 1,
+            "type": "host-x86_64-cpu"
+        },
+        {
+            "props": {
+                "core-id": 1,
+                "thread-id": 0,
+                "die-id": 1,
+                "socket-id": 0
+            },
+            "vcpus-count": 1,
+            "qom-path": "/machine/unattached/device[7]",
+            "type": "host-x86_64-cpu"
+        },
+        {
+            "props": {
+                "core-id": 0,
+                "thread-id": 1,
+                "die-id": 1,
+                "socket-id": 0
+            },
+            "vcpus-count": 1,
+            "qom-path": "/machine/unattached/device[6]",
+            "type": "host-x86_64-cpu"
+        },
+        {
+            "props": {
+                "core-id": 0,
+                "thread-id": 0,
+                "die-id": 1,
+                "socket-id": 0
+            },
+            "vcpus-count": 1,
+            "qom-path": "/machine/unattached/device[5]",
+            "type": "host-x86_64-cpu"
+        },
+        {
+            "props": {
+                "core-id": 1,
+                "thread-id": 1,
+                "die-id": 0,
+                "socket-id": 0
+            },
+            "vcpus-count": 1,
+            "qom-path": "/machine/unattached/device[4]",
+            "type": "host-x86_64-cpu"
+        },
+        {
+            "props": {
+                "core-id": 1,
+                "thread-id": 0,
+                "die-id": 0,
+                "socket-id": 0
+            },
+            "vcpus-count": 1,
+            "qom-path": "/machine/unattached/device[3]",
+            "type": "host-x86_64-cpu"
+        },
+        {
+            "props": {
+                "core-id": 0,
+                "thread-id": 1,
+                "die-id": 0,
+                "socket-id": 0
+            },
+            "vcpus-count": 1,
+            "qom-path": "/machine/unattached/device[2]",
+            "type": "host-x86_64-cpu"
+        },
+        {
+            "props": {
+                "core-id": 0,
+                "thread-id": 0,
+                "die-id": 0,
+                "socket-id": 0
+            },
+            "vcpus-count": 1,
+            "qom-path": "/machine/unattached/device[0]",
+            "type": "host-x86_64-cpu"
+        }
+    ]
+}
diff --git a/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-dies.data b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-dies.data
new file mode 100644 (file)
index 0000000..a839b56
--- /dev/null
@@ -0,0 +1,108 @@
+[vcpu libvirt-id='0']
+    online=yes
+    hotpluggable=no
+    thread-id='1538346'
+    enable-id='1'
+    query-cpus-id='0'
+    type='host-x86_64-cpu'
+    qom_path='/machine/unattached/device[0]'
+    topology: socket='0' die='0' core='0' thread='0' vcpus='1'
+[vcpu libvirt-id='1']
+    online=yes
+    hotpluggable=no
+    thread-id='1538347'
+    enable-id='2'
+    query-cpus-id='1'
+    type='host-x86_64-cpu'
+    qom_path='/machine/unattached/device[2]'
+    topology: socket='0' die='0' core='0' thread='1' vcpus='1'
+[vcpu libvirt-id='2']
+    online=yes
+    hotpluggable=no
+    thread-id='1538348'
+    enable-id='3'
+    query-cpus-id='2'
+    type='host-x86_64-cpu'
+    qom_path='/machine/unattached/device[3]'
+    topology: socket='0' die='0' core='1' thread='0' vcpus='1'
+[vcpu libvirt-id='3']
+    online=yes
+    hotpluggable=no
+    thread-id='1538349'
+    enable-id='4'
+    query-cpus-id='3'
+    type='host-x86_64-cpu'
+    qom_path='/machine/unattached/device[4]'
+    topology: socket='0' die='0' core='1' thread='1' vcpus='1'
+[vcpu libvirt-id='4']
+    online=yes
+    hotpluggable=no
+    thread-id='1538350'
+    enable-id='5'
+    query-cpus-id='4'
+    type='host-x86_64-cpu'
+    qom_path='/machine/unattached/device[5]'
+    topology: socket='0' die='1' core='0' thread='0' vcpus='1'
+[vcpu libvirt-id='5']
+    online=yes
+    hotpluggable=no
+    thread-id='1538351'
+    enable-id='6'
+    query-cpus-id='5'
+    type='host-x86_64-cpu'
+    qom_path='/machine/unattached/device[6]'
+    topology: socket='0' die='1' core='0' thread='1' vcpus='1'
+[vcpu libvirt-id='6']
+    online=yes
+    hotpluggable=no
+    thread-id='1538352'
+    enable-id='7'
+    query-cpus-id='6'
+    type='host-x86_64-cpu'
+    qom_path='/machine/unattached/device[7]'
+    topology: socket='0' die='1' core='1' thread='0' vcpus='1'
+[vcpu libvirt-id='7']
+    online=no
+    hotpluggable=yes
+    type='host-x86_64-cpu'
+    topology: socket='0' die='1' core='1' thread='1' vcpus='1'
+[vcpu libvirt-id='8']
+    online=no
+    hotpluggable=yes
+    type='host-x86_64-cpu'
+    topology: socket='1' die='0' core='0' thread='0' vcpus='1'
+[vcpu libvirt-id='9']
+    online=no
+    hotpluggable=yes
+    type='host-x86_64-cpu'
+    topology: socket='1' die='0' core='0' thread='1' vcpus='1'
+[vcpu libvirt-id='10']
+    online=no
+    hotpluggable=yes
+    type='host-x86_64-cpu'
+    topology: socket='1' die='0' core='1' thread='0' vcpus='1'
+[vcpu libvirt-id='11']
+    online=no
+    hotpluggable=yes
+    type='host-x86_64-cpu'
+    topology: socket='1' die='0' core='1' thread='1' vcpus='1'
+[vcpu libvirt-id='12']
+    online=no
+    hotpluggable=yes
+    type='host-x86_64-cpu'
+    topology: socket='1' die='1' core='0' thread='0' vcpus='1'
+[vcpu libvirt-id='13']
+    online=no
+    hotpluggable=yes
+    type='host-x86_64-cpu'
+    topology: socket='1' die='1' core='0' thread='1' vcpus='1'
+[vcpu libvirt-id='14']
+    online=no
+    hotpluggable=yes
+    type='host-x86_64-cpu'
+    topology: socket='1' die='1' core='1' thread='0' vcpus='1'
+[vcpu libvirt-id='15']
+    online=no
+    hotpluggable=yes
+    type='host-x86_64-cpu'
+    topology: socket='1' die='1' core='1' thread='1' vcpus='1'
index 0a6760a794dc5f4840a5cc6887486db0a887fa6a..472775a3cf023313a352d9c9c22b9db0dfb951ee 100644 (file)
@@ -2615,6 +2615,8 @@ testQemuMonitorCPUInfoFormat(qemuMonitorCPUInfoPtr vcpus,
             virBufferAddLit(&buf, "topology:");
             if (vcpu->socket_id != -1)
                 virBufferAsprintf(&buf, " socket='%d'", vcpu->socket_id);
+            if (vcpu->die_id != -1)
+                virBufferAsprintf(&buf, " die='%d'", vcpu->die_id);
             if (vcpu->core_id != -1)
                 virBufferAsprintf(&buf, " core='%d'", vcpu->core_id);
             if (vcpu->thread_id != -1)
@@ -3235,6 +3237,7 @@ mymain(void)
     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_FAST("x86-dies", 16);
 
     DO_TEST_CPU_INFO("ppc64-basic", 24);
     DO_TEST_CPU_INFO("ppc64-hotplug-1", 24);