mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 15:53:54 -06:00
tests/qtest: Add qtest_system_reset() utility function
We have several qtest tests which want to reset the QEMU under test during the course of testing something. They currently generally have their own functions to do this, which work by sending a "system_reset" QMP command. However, "system_reset" only requests a reset, and many of the tests which send the QMP command forget the "and then wait for the QMP RESET event" part which is needed to ensure that the reset has completed. Provide a qtest_system_reset() function in libqtest so that we don't need to reimplement this in multiple different tests. A few tests (for example device hotplug related tests) want to perform the reset command and then wait for some other event that is produced during the reset sequence. For them we provide qtest_system_reset_nowait() so they can clearly indicate that they are deliberately not waiting for the RESET event. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Signed-off-by: Fabiano Rosas <farosas@suse.de>
This commit is contained in:
parent
94aa1a0e30
commit
6b76264ed0
2 changed files with 41 additions and 0 deletions
|
@ -215,6 +215,22 @@ static void qtest_check_status(QTestState *s)
|
|||
#endif
|
||||
}
|
||||
|
||||
void qtest_system_reset_nowait(QTestState *s)
|
||||
{
|
||||
/* Request the system reset, but do not wait for it to complete */
|
||||
qtest_qmp_assert_success(s, "{'execute': 'system_reset' }");
|
||||
}
|
||||
|
||||
void qtest_system_reset(QTestState *s)
|
||||
{
|
||||
qtest_system_reset_nowait(s);
|
||||
/*
|
||||
* Wait for the RESET event, which is sent once the system reset
|
||||
* has actually completed.
|
||||
*/
|
||||
qtest_qmp_eventwait(s, "RESET");
|
||||
}
|
||||
|
||||
void qtest_wait_qemu(QTestState *s)
|
||||
{
|
||||
if (s->qemu_pid != -1) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue