Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
qtest: add qtest_pid()
Used in the following test on win32, to share sockets with the QEMU
process.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20230606115658.677673-7-marcandre.lureau@redhat.com>
  • Loading branch information
elmarco committed Jun 27, 2023
1 parent 6cc5a61 commit ed09764
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tests/qtest/libqtest.c
Expand Up @@ -142,6 +142,11 @@ static int socket_accept(int sock)
return ret;
}

pid_t qtest_pid(QTestState *s)
{
return s->qemu_pid;
}

bool qtest_probe_child(QTestState *s)
{
pid_t pid = s->qemu_pid;
Expand Down
9 changes: 9 additions & 0 deletions tests/qtest/libqtest.h
Expand Up @@ -985,4 +985,13 @@ void qtest_qom_set_bool(QTestState *s, const char *path, const char *property,
* Returns: Value retrieved from property.
*/
bool qtest_qom_get_bool(QTestState *s, const char *path, const char *property);

/**
* qtest_pid:
* @s: QTestState instance to operate on.
*
* Returns: the PID of the QEMU process, or <= 0
*/
pid_t qtest_pid(QTestState *s);

#endif

0 comments on commit ed09764

Please sign in to comment.