Add qemuMonitorTestEmitDeviceDeleted() so monitor tests can emit a DEVICE_DELETED event after the command reply has already been consumed.
The helper uses the monitor callback path directly and avoids adding event JSON to command/reply fixtures. Signed-off-by: Akash Kulhalli <[email protected]> --- tests/qemumonitortestutils.c | 9 +++++++++ tests/qemumonitortestutils.h | 3 +++ 2 files changed, 12 insertions(+) diff --git a/tests/qemumonitortestutils.c b/tests/qemumonitortestutils.c index b6e17fc2cac4..e83dd1d9c40b 100644 --- a/tests/qemumonitortestutils.c +++ b/tests/qemumonitortestutils.c @@ -1240,3 +1240,12 @@ qemuMonitorTestGetDomainObj(qemuMonitorTest *test) { return test->vm; } + +void +qemuMonitorTestEmitDeviceDeleted(qemuMonitorTest *test, + const char *alias) +{ + virObjectLock(test->mon); + qemuMonitorEmitDeviceDeleted(test->mon, alias); + virObjectUnlock(test->mon); +} diff --git a/tests/qemumonitortestutils.h b/tests/qemumonitortestutils.h index 4f136410ee61..c87cdf0e6a32 100644 --- a/tests/qemumonitortestutils.h +++ b/tests/qemumonitortestutils.h @@ -109,5 +109,8 @@ qemuAgent * qemuMonitorTestGetAgent(qemuMonitorTest *test); virDomainObj * qemuMonitorTestGetDomainObj(qemuMonitorTest *test); +void +qemuMonitorTestEmitDeviceDeleted(qemuMonitorTest *test, + const char *alias); G_DEFINE_AUTOPTR_CLEANUP_FUNC(qemuMonitorTest, qemuMonitorTestFree); -- 2.47.3
