mirror of
https://github.com/qemu/qemu.git
synced 2024-12-03 08:43:38 +08:00
tests: boot_sector_test: avoid crashing if status is not available yet
If test case was started in paused mode (-S CLI option) and then allowed to continue via QMP, boot_sector_test could assert on transient state with following error: assertion failed (qdict_get_try_str(qret, "status") == "running"): (NULL == "running") Instead of crashing test if 'status' is not available yet, skip check and repeat iteration again after TEST_DELAY has elapsed. Signed-off-by: Igor Mammedov <imammedo@redhat.com> Message-Id: <20230112140312.3096331-14-imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
parent
debbda1c67
commit
6dfcb0e797
@ -160,7 +160,9 @@ void boot_sector_test(QTestState *qts)
|
||||
qrsp = qtest_qmp(qts, "{ 'execute': 'query-status' }");
|
||||
qret = qdict_get_qdict(qrsp, "return");
|
||||
g_assert_nonnull(qret);
|
||||
g_assert_cmpstr(qdict_get_try_str(qret, "status"), ==, "running");
|
||||
if (qdict_get_try_str(qret, "status")) {
|
||||
g_assert_cmpstr(qdict_get_try_str(qret, "status"), ==, "running");
|
||||
}
|
||||
qobject_unref(qrsp);
|
||||
|
||||
g_usleep(TEST_DELAY);
|
||||
|
Loading…
Reference in New Issue
Block a user