tests/qtest: qtest_init_after_exec
Define a function to create a QTestState object representing the state of QEMU after old QEMU exec's new QEMU. This is needed for testing the cpr-exec migration mode. Signed-off-by: Steve Sistare <steven.sistare@oracle.com> Reviewed-by: Fabiano Rosas <farosas@suse.de> Link: https://lore.kernel.org/qemu-devel/1759332851-370353-14-git-send-email-steven.sistare@oracle.com Signed-off-by: Fabiano Rosas <farosas@suse.de>
This commit is contained in:
committed by
Fabiano Rosas
parent
e9fbd9e6b1
commit
5419f36e9e
@@ -615,6 +615,25 @@ QTestState *qtest_init_ext(const char *var, const char *extra_args,
|
||||
return s;
|
||||
}
|
||||
|
||||
static QTestState *qtest_attach_qemu(const char *qemu_bin,
|
||||
const char *extra_args,
|
||||
void *opaque)
|
||||
{
|
||||
int pid = *(int *)opaque;
|
||||
return qtest_create_test_state(pid);
|
||||
}
|
||||
|
||||
QTestState *qtest_init_after_exec(QTestState *qts)
|
||||
{
|
||||
void *opaque = (void *)&qts->qemu_pid;
|
||||
QTestState *s;
|
||||
|
||||
s = qtest_init_internal(NULL, NULL, true, qtest_attach_qemu, opaque);
|
||||
qts->qemu_pid = -1;
|
||||
qtest_qmp_handshake(s, NULL);
|
||||
return s;
|
||||
}
|
||||
|
||||
QTestState *qtest_init(const char *extra_args)
|
||||
{
|
||||
return qtest_init_ext(NULL, extra_args, NULL, true);
|
||||
|
||||
@@ -56,6 +56,14 @@ QTestState *qtest_vinitf(const char *fmt, va_list ap) G_GNUC_PRINTF(1, 0);
|
||||
*/
|
||||
const char *qtest_qemu_binary(const char *var);
|
||||
|
||||
/**
|
||||
* qtest_init_after_exec:
|
||||
* @qts: the previous QEMU state
|
||||
*
|
||||
* Return a test state representing new QEMU after @qts exec's it.
|
||||
*/
|
||||
QTestState *qtest_init_after_exec(QTestState *qts);
|
||||
|
||||
/**
|
||||
* qtest_qemu_args:
|
||||
* @extra_args: Other arguments to pass to QEMU.
|
||||
|
||||
Reference in New Issue
Block a user