libqtest: add qtest_socket_server()

Add an API that returns a new UNIX domain socket in the listen state.
The code for this was already there but only used internally in
init_socket().

This new API will be used by vhost-user-blk-test.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
Message-Id: <20210223144653.811468-3-stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
Stefan Hajnoczi 2021-02-23 14:46:43 +00:00 committed by Kevin Wolf
parent 535255b438
commit 9fb7bb0698
2 changed files with 31 additions and 17 deletions

View file

@ -132,6 +132,14 @@ void qtest_qmp_send(QTestState *s, const char *fmt, ...)
void qtest_qmp_send_raw(QTestState *s, const char *fmt, ...)
GCC_FMT_ATTR(2, 3);
/**
* qtest_socket_server:
* @socket_path: the UNIX domain socket path
*
* Create and return a listen socket file descriptor, or abort on failure.
*/
int qtest_socket_server(const char *socket_path);
/**
* qtest_vqmp_fds:
* @s: #QTestState instance to operate on.