]> git.proxmox.com Git - mirror_qemu.git/commitdiff
qtest: add qtest_pid()
authorMarc-André Lureau <marcandre.lureau@redhat.com>
Tue, 6 Jun 2023 11:56:43 +0000 (15:56 +0400)
committerMarc-André Lureau <marcandre.lureau@redhat.com>
Tue, 27 Jun 2023 15:08:56 +0000 (17:08 +0200)
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>

tests/qtest/libqtest.c
tests/qtest/libqtest.h

index de03ef5f6035a938055dcc9da057e48636d43586..79152f0ec32b2ea1f3a7a0989eef78384f78a3ff 100644 (file)
@@ -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;
index a12acf7fa9061c7d6ecb6f0da6facc9719fce869..913acc3d5c077d589a57499663ed8ce53bf8cf12 100644 (file)
@@ -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