Skip to contentSkip to conversation

qtest: Add tests for x86 PC cpu-add

PATCH New Andreas Färber 1 participant 3 messages Mar 16, 2015

lore
Share & tools
lore
#0 lore raw

cover qtest: Add tests for x86 PC cpu-add

Hello,

As prerequisite for upcoming changes to CPU initialization and hot-plug code, I would like to merge these two patches from my x86 CPU branch.

For now the coverage is limited to one test case per PC machine and is testing both a non-default sockets/cores/hyperthreads combination, a non-default model and monotonic cpu-add via QMP for 1.5+ and graceful error handling otherwise.

Regards,
Andreas

Cc Eduardo Habkost <[email protected]>
Cc Zhu Guihua <[email protected]>
Cc Chen Fan <[email protected]>
Cc Peter Maydell <[email protected]>

Andreas Färber (2):
pc: Suppress APIC ID compatibility warning for QTest
tests: Add PC CPU test

 hw/i386/pc.c        |   3 +-
 tests/Makefile      |   2 +
 tests/pc-cpu-test.c | 147 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 151 insertions(+), 1 deletion(-)
 create mode 100644 tests/pc-cpu-test.c
Signature · 1 line
2.1.4
#1 lore raw

PATCH 1/2 pc: Suppress APIC ID compatibility warning for QTest

This avoids cluttering GTester output with irrelevant warnings.

---
 hw/i386/pc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
hw/i386/pc.c +2 -1
index c756404..4b46c29 100644
@@ -45,6 +45,7 @@
 #include "sysemu/sysemu.h"
 #include "sysemu/numa.h"
 #include "sysemu/kvm.h"
+#include "sysemu/qtest.h"
 #include "kvm_i386.h"
 #include "hw/xen/xen.h"
 #include "sysemu/block-backend.h"
@@ -653,7 +654,7 @@ static uint32_t x86_cpu_apic_id_from_index(unsigned int cpu_index)
 
     correct_id = x86_apicid_from_cpu_idx(smp_cores, smp_threads, cpu_index);
     if (compat_apic_id_mode) {
-        if (cpu_index != correct_id && !warned) {
+        if (cpu_index != correct_id && !warned && !qtest_enabled()) {
             error_report("APIC IDs set in compatibility mode, "
                          "CPU topology won't match the configuration");
             warned = true;
Signature · 1 line
2.1.4
#2 lore raw

PATCH 2/2 tests: Add PC CPU test

In reply to Andreas Färber

Test non-default -smp core and thread counts and a non-default CPU model on all PC machines except for isapc. Note that not all historic versions actually supported this particular configuration, ignored for simplicity.

For machines pc-*-1.5+ test QMP cpu-add with monotonically increasing ID, and test for graceful failure otherwise.

---
 tests/Makefile      |   2 +
 tests/pc-cpu-test.c | 147 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 149 insertions(+)
 create mode 100644 tests/pc-cpu-test.c
tests/Makefile +2 -0
index 1ef95c9..55aa745 100644
@@ -173,6 +173,7 @@ gcov-files-i386-y += hw/usb/dev-hid.c
 gcov-files-i386-y += hw/usb/dev-storage.c
 check-qtest-i386-y += tests/usb-hcd-xhci-test$(EXESUF)
 gcov-files-i386-y += hw/usb/hcd-xhci.c
+check-qtest-i386-y += tests/pc-cpu-test$(EXESUF)
 check-qtest-i386-$(CONFIG_LINUX) += tests/vhost-user-test$(EXESUF)
 check-qtest-x86_64-y = $(check-qtest-i386-y)
 gcov-files-i386-y += i386-softmmu/hw/timer/mc146818rtc.c
@@ -363,6 +364,7 @@ tests/usb-hcd-ohci-test$(EXESUF): tests/usb-hcd-ohci-test.o $(libqos-usb-obj-y)
 tests/usb-hcd-uhci-test$(EXESUF): tests/usb-hcd-uhci-test.o $(libqos-usb-obj-y)
 tests/usb-hcd-ehci-test$(EXESUF): tests/usb-hcd-ehci-test.o $(libqos-usb-obj-y)
 tests/usb-hcd-xhci-test$(EXESUF): tests/usb-hcd-xhci-test.o $(libqos-usb-obj-y)
+tests/pc-cpu-test$(EXESUF): tests/pc-cpu-test.o
 tests/vhost-user-test$(EXESUF): tests/vhost-user-test.o qemu-char.o qemu-timer.o $(qtest-obj-y)
 tests/qemu-iotests/socket_scm_helper$(EXESUF): tests/qemu-iotests/socket_scm_helper.o
 tests/test-qemu-opts$(EXESUF): tests/test-qemu-opts.o libqemuutil.a libqemustub.a
tests/pc-cpu-test.c new file +147 -0

147 lines not on this page · raw message

Signature · 1 line
2.1.4