On 08/02/2023 18.19, Paolo Bonzini wrote:
Test that it does not cause a SIGSEGV, and cover a valid configuration
as well.
Signed-off-by: Paolo Bonzini <pbonz...@redhat.com>
---
tests/qtest/libqtest.c | 28 +++++++++++++++++-----
tests/qtest/libqtest.h | 12 ++++++++++
tests/qtest/readconfig-test.c | 45 ++++++++++++++++++++++++++++-------
3 files changed, 70 insertions(+), 15 deletions(-)
diff --git a/tests/qtest/libqtest.c b/tests/qtest/libqtest.c
index ce5f235e25f1..4fba2bb27f06 100644
--- a/tests/qtest/libqtest.c
+++ b/tests/qtest/libqtest.c
@@ -420,6 +420,26 @@ static QTestState *G_GNUC_PRINTF(1, 2)
qtest_spawn_qemu(const char *fmt, ...)
return s;
}
+QTestState *G_GNUC_PRINTF(1, 0) qtest_init_bare(const char *args)
+{
+ QTestState *s = qtest_spawn_qemu("%s", args);
+
+ /*
+ * Stopping QEMU for debugging is not supported on Windows.
+ *
+ * Using DebugActiveProcess() API can suspend the QEMU process,
+ * but gdb cannot attach to the process. Using the undocumented
+ * NtSuspendProcess() can suspend the QEMU process and gdb can
+ * attach to the process, but gdb cannot resume it.
+ */
+#ifndef _WIN32
+ if (getenv("QTEST_STOP")) {
+ kill(s->qemu_pid, SIGSTOP);
+ }
+#endif
+ return s;
+}
You missed my review comments here:
https://lore.kernel.org/qemu-devel/2f17c06f-90a9-9bac-8e9a-a1a284266...@redhat.com/
Thomas