tests/qtest: Use qtest_system_reset_nowait() where appropriate
In the device and drive plug/unplug tests we want to trigger a system reset and then see if we get the appropriate DEVICE_DELETED event. Use qtest_system_reset_nowait() here. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Fabiano Rosas <farosas@suse.de> Signed-off-by: Fabiano Rosas <farosas@suse.de>
This commit is contained in:
parent
9881d3d168
commit
de62427cce
@ -15,15 +15,6 @@
|
|||||||
#include "qapi/qmp/qdict.h"
|
#include "qapi/qmp/qdict.h"
|
||||||
#include "qapi/qmp/qstring.h"
|
#include "qapi/qmp/qstring.h"
|
||||||
|
|
||||||
static void system_reset(QTestState *qtest)
|
|
||||||
{
|
|
||||||
QDict *resp;
|
|
||||||
|
|
||||||
resp = qtest_qmp(qtest, "{'execute': 'system_reset'}");
|
|
||||||
g_assert(qdict_haskey(resp, "return"));
|
|
||||||
qobject_unref(resp);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void wait_device_deleted_event(QTestState *qtest, const char *id)
|
static void wait_device_deleted_event(QTestState *qtest, const char *id)
|
||||||
{
|
{
|
||||||
QDict *resp, *data;
|
QDict *resp, *data;
|
||||||
@ -58,7 +49,7 @@ static void process_device_remove(QTestState *qtest, const char *id)
|
|||||||
* handled, removing the device.
|
* handled, removing the device.
|
||||||
*/
|
*/
|
||||||
qtest_qmp_device_del_send(qtest, id);
|
qtest_qmp_device_del_send(qtest, id);
|
||||||
system_reset(qtest);
|
qtest_system_reset_nowait(qtest);
|
||||||
wait_device_deleted_event(qtest, id);
|
wait_device_deleted_event(qtest, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -154,15 +154,10 @@ static void device_add(QTestState *qts)
|
|||||||
|
|
||||||
static void device_del(QTestState *qts, bool and_reset)
|
static void device_del(QTestState *qts, bool and_reset)
|
||||||
{
|
{
|
||||||
QDict *response;
|
|
||||||
|
|
||||||
qtest_qmp_device_del_send(qts, "dev0");
|
qtest_qmp_device_del_send(qts, "dev0");
|
||||||
|
|
||||||
if (and_reset) {
|
if (and_reset) {
|
||||||
response = qtest_qmp(qts, "{'execute': 'system_reset' }");
|
qtest_system_reset_nowait(qts);
|
||||||
g_assert(response);
|
|
||||||
g_assert(qdict_haskey(response, "return"));
|
|
||||||
qobject_unref(response);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
qtest_qmp_eventwait(qts, "DEVICE_DELETED");
|
qtest_qmp_eventwait(qts, "DEVICE_DELETED");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user