test: add cpu topology tests

Add cpu driver types in TestQMPCPUDeviceAdd

Signed-off-by: Alice Frosi <afrosi@de.ibm.com>
This commit is contained in:
Alice Frosi 2019-07-25 15:53:33 +02:00
parent e0cf9d5c14
commit 68cdf64fe5

View File

@ -1059,6 +1059,17 @@ func TestQMPPCIVFIOMediatedDeviceAdd(t *testing.T) {
// Checks that CPU are correctly added using device_add // Checks that CPU are correctly added using device_add
func TestQMPCPUDeviceAdd(t *testing.T) { func TestQMPCPUDeviceAdd(t *testing.T) {
drivers := []string{"host-x86_64-cpu", "host-s390x-cpu", "host-powerpc64-cpu"}
cpuID := "cpu-0"
socketID := "0"
dieID := "0"
coreID := "1"
threadID := "0"
version := &QMPVersion{
Major: 4,
Minor: 1,
}
for _, d := range drivers {
connectedCh := make(chan *QMPVersion) connectedCh := make(chan *QMPVersion)
disconnectedCh := make(chan struct{}) disconnectedCh := make(chan struct{})
buf := newQMPTestCommandBuffer(t) buf := newQMPTestCommandBuffer(t)
@ -1066,23 +1077,15 @@ func TestQMPCPUDeviceAdd(t *testing.T) {
cfg := QMPConfig{Logger: qmpTestLogger{}} cfg := QMPConfig{Logger: qmpTestLogger{}}
q := startQMPLoop(buf, cfg, connectedCh, disconnectedCh) q := startQMPLoop(buf, cfg, connectedCh, disconnectedCh)
checkVersion(t, connectedCh) checkVersion(t, connectedCh)
driver := "qemu64-x86_64-cpu" q.version = version
cpuID := "cpu-0" err := q.ExecuteCPUDeviceAdd(context.Background(), d, cpuID, socketID, dieID, coreID, threadID, "")
socketID := "0"
dieID := "0"
coreID := "1"
threadID := "0"
q.version = &QMPVersion{
Major: 4,
Minor: 1,
}
err := q.ExecuteCPUDeviceAdd(context.Background(), driver, cpuID, socketID, dieID, coreID, threadID, "")
if err != nil { if err != nil {
t.Fatalf("Unexpected error %v", err) t.Fatalf("Unexpected error %v", err)
} }
q.Shutdown() q.Shutdown()
<-disconnectedCh <-disconnectedCh
} }
}
// Checks that hotpluggable CPUs are listed correctly // Checks that hotpluggable CPUs are listed correctly
func TestQMPExecuteQueryHotpluggableCPUs(t *testing.T) { func TestQMPExecuteQueryHotpluggableCPUs(t *testing.T) {