On 8/5/2025 2:06 AM, Markus Armbruster wrote:
Steven Sistare <steven.sist...@oracle.com> writes:
On 7/25/2025 9:50 AM, Markus Armbruster wrote:
Signed-off-by: Markus Armbruster <arm...@redhat.com>
---
   tests/qtest/qom-test.c | 4 ----
   1 file changed, 4 deletions(-)
diff --git a/tests/qtest/qom-test.c b/tests/qtest/qom-test.c
index d358b69c7e..6421f2d9d9 100644
--- a/tests/qtest/qom-test.c
+++ b/tests/qtest/qom-test.c
@@ -215,10 +215,6 @@ static void test_machine(gconstpointer data)
      test_list_get(qts, paths);
      test_list_get_value(qts);
-    response = qtest_qmp(qts, "{ 'execute': 'quit' }");
-    g_assert(qdict_haskey(response, "return"));
-    qobject_unref(response);
-
      qtest_quit(qts);
   }

IMO the quit command improves test coverage, albeit by a small amount.
It guarantees that qemu did not die after returning the qom result to
the client.

What if it dies afte returning the quit response?

Detecting QEMU dying on us is the test harness's job.  Check out
qtest_check_status() called by qtest_wait_qemu() called by
qtest_kill_qemu() called by qtest_quit() called by the test.

For what it's worth, the only other qtest using the quit command is
machine-none-test.c.

In qtests, quit races with the test harness's termination of QEMU.  The
quit command requests immediate shutdown.  By the time the test receives
the response, the QEMU process may be alive (still shutting down) or
dead.  If dead, it's in zombie state.  qtest_quit() then kill()s it some
more (does nothing for zombies), and finally reaps it with waitpid().
Works, but the race between quit and kill give me a queasy feeling.

Can't say whether the Windows code handles this robustly.

OK.

Reviewed-by: Steve Sistare <steven.sist...@oracle.com>


Reply via email to