mirror of
https://github.com/aljazceru/kata-containers.git
synced 2025-12-18 06:44:23 +01:00
qemu/qmp: implement function to hotplug character devices
implement function to hotplug character devices using as backend unix sockets, binding a character device with a serial port allows the communnication between processes running in the guest with processes running in the host. Signed-off-by: Julio Montes <julio.montes@intel.com>
This commit is contained in:
@@ -1040,3 +1040,20 @@ func TestExecuteGetFdD(t *testing.T) {
|
||||
q.Shutdown()
|
||||
<-disconnectedCh
|
||||
}
|
||||
|
||||
// Checks chardev-add unix socket
|
||||
func TestExecuteCharDevUnixSocketAdd(t *testing.T) {
|
||||
connectedCh := make(chan *QMPVersion)
|
||||
disconnectedCh := make(chan struct{})
|
||||
buf := newQMPTestCommandBuffer(t)
|
||||
buf.AddCommand("chardev-add", nil, "return", nil)
|
||||
cfg := QMPConfig{Logger: qmpTestLogger{}}
|
||||
q := startQMPLoop(buf, cfg, connectedCh, disconnectedCh)
|
||||
checkVersion(t, connectedCh)
|
||||
err := q.ExecuteCharDevUnixSocketAdd(context.Background(), "foo", "foo.sock", false, true)
|
||||
if err != nil {
|
||||
t.Fatalf("Unexpected error %v", err)
|
||||
}
|
||||
q.Shutdown()
|
||||
<-disconnectedCh
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user