qemu: Add QMP socket unit tests

We test that the QMP socket parameter is properly built.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
This commit is contained in:
Samuel Ortiz 2016-09-13 14:29:42 +02:00
parent 7b2f7eb5d8
commit 5ba8ef79df

View File

@ -74,6 +74,13 @@ func testAppend(structure interface{}, expected string, t *testing.T) {
}
params = appendCPUs([]string{}, config)
case QMPSocket:
config := Config{
QMPSocket: s,
}
params = appendQMPSocket([]string{}, config)
}
result := strings.Join(params, " ")
@ -205,3 +212,27 @@ func TestAppendCPUs(t *testing.T) {
testAppend(smp, cpusString, t)
}
var qmpSocketServerString = "-qmp unix:cc-qmp,server,nowait"
var qmpSocketString = "-qmp unix:cc-qmp"
func TestAppendQMPSocketServer(t *testing.T) {
qmp := QMPSocket{
Type: "unix",
Name: "cc-qmp",
Server: true,
NoWait: true,
}
testAppend(qmp, qmpSocketServerString, t)
}
func TestAppendQMPSocket(t *testing.T) {
qmp := QMPSocket{
Type: "unix",
Name: "cc-qmp",
Server: false,
}
testAppend(qmp, qmpSocketString, t)
}