tests/qtest: tighten up the checks on clock_step
It is invalid to call clock_step with an implied time to step forward as if no timers are running we won't be able to advance. Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20250207153112.3939799-7-alex.bennee@linaro.org>
This commit is contained in:
parent
31ef3c333d
commit
14fa0e6b20
@ -708,10 +708,19 @@ static void qtest_process_command(CharBackend *chr, gchar **words)
|
|||||||
} else {
|
} else {
|
||||||
ns = qemu_clock_deadline_ns_all(QEMU_CLOCK_VIRTUAL,
|
ns = qemu_clock_deadline_ns_all(QEMU_CLOCK_VIRTUAL,
|
||||||
QEMU_TIMER_ATTR_ALL);
|
QEMU_TIMER_ATTR_ALL);
|
||||||
|
if (ns < 0) {
|
||||||
|
qtest_send(chr, "FAIL "
|
||||||
|
"cannot advance clock to the next deadline "
|
||||||
|
"because there is no pending deadline\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
new_ns = qemu_clock_advance_virtual_time(old_ns + ns);
|
new_ns = qemu_clock_advance_virtual_time(old_ns + ns);
|
||||||
qtest_sendf(chr, "%s %"PRIi64"\n",
|
if (new_ns > old_ns) {
|
||||||
new_ns > old_ns ? "OK" : "FAIL", new_ns);
|
qtest_sendf(chr, "OK %"PRIi64"\n", new_ns);
|
||||||
|
} else {
|
||||||
|
qtest_sendf(chr, "FAIL could not advance time\n");
|
||||||
|
}
|
||||||
} else if (strcmp(words[0], "module_load") == 0) {
|
} else if (strcmp(words[0], "module_load") == 0) {
|
||||||
Error *local_err = NULL;
|
Error *local_err = NULL;
|
||||||
int rv;
|
int rv;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user