[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 27/42] migration-test: Create guest_extra_opts()
From: |
Juan Quintela |
Subject: |
[PATCH 27/42] migration-test: Create guest_extra_opts() |
Date: |
Fri, 9 Jun 2023 00:49:28 +0200 |
If a guest has extra command line options, add it with this.
Signed-off-by: Juan Quintela <quintela@redhat.com>
---
tests/qtest/migration-test.c | 28 ++++++++++++++++------------
1 file changed, 16 insertions(+), 12 deletions(-)
diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c
index 0130a00707..b9b11ebb0f 100644
--- a/tests/qtest/migration-test.c
+++ b/tests/qtest/migration-test.c
@@ -156,6 +156,7 @@ typedef struct {
gchar *arch_opts;
gchar *arch_source;
gchar *arch_target;
+ const gchar *extra_opts;
gchar *kvm_opts;
const gchar *memory_size;
/*
@@ -243,6 +244,12 @@ static void guest_use_shmem(GuestState *vm)
vm->memory_size, vm->shmem_path);
}
+static void guest_extra_opts(GuestState *vm, const gchar *opts)
+{
+ g_assert(vm->extra_opts == NULL);
+ vm->extra_opts = opts;
+}
+
/*
* Wait for some output in the serial output file,
* we get an 'A' followed by an endless string of 'B's
@@ -640,8 +647,6 @@ typedef struct {
bool hide_stderr;
/* only launch the target process */
bool only_target;
- const char *opts_source;
- const char *opts_target;
} MigrateStart;
/*
@@ -764,7 +769,7 @@ static void test_migrate_start(GuestState *from, GuestState
*to,
from->arch_opts ? from->arch_opts : "",
from->arch_source ? from->arch_source : "",
from->shmem_opts ? from->shmem_opts : "",
- args->opts_source ? args->opts_source : "",
+ from->extra_opts ? from->extra_opts : "",
ignore_stderr ? ignore_stderr : "");
if (!args->only_target) {
@@ -788,7 +793,7 @@ static void test_migrate_start(GuestState *from, GuestState
*to,
to->arch_opts ? to->arch_opts : "",
to->arch_target ? to->arch_target : "",
to->shmem_opts ? to->shmem_opts : "",
- args->opts_target ? args->opts_target : "",
+ to->extra_opts ? to->extra_opts : "",
ignore_stderr ? ignore_stderr : "");
to->qs = qtest_init(cmd_target);
qtest_qmp_set_event_callback(to->qs,
@@ -1996,11 +2001,10 @@ static void test_validate_uuid(void)
{
GuestState *from = guest_create("source");
GuestState *to = guest_create("target");
- MigrateStart args = {
- .opts_source = "-uuid 11111111-1111-1111-1111-111111111111",
- .opts_target = "-uuid 11111111-1111-1111-1111-111111111111",
- };
+ MigrateStart args = { };
+ guest_extra_opts(from, "-uuid 11111111-1111-1111-1111-111111111111");
+ guest_extra_opts(to, "-uuid 11111111-1111-1111-1111-111111111111");
do_test_validate_uuid(from, to, &args, false);
}
@@ -2009,11 +2013,11 @@ static void test_validate_uuid_error(void)
GuestState *from = guest_create("source");
GuestState *to = guest_create("target");
MigrateStart args = {
- .opts_source = "-uuid 11111111-1111-1111-1111-111111111111",
- .opts_target = "-uuid 22222222-2222-2222-2222-222222222222",
.hide_stderr = true,
};
+ guest_extra_opts(from, "-uuid 11111111-1111-1111-1111-111111111111");
+ guest_extra_opts(to, "-uuid 22222222-2222-2222-2222-222222222222");
do_test_validate_uuid(from, to, &args, true);
}
@@ -2022,10 +2026,10 @@ static void test_validate_uuid_src_not_set(void)
GuestState *from = guest_create("source");
GuestState *to = guest_create("target");
MigrateStart args = {
- .opts_target = "-uuid 22222222-2222-2222-2222-222222222222",
.hide_stderr = true,
};
+ guest_extra_opts(to, "-uuid 22222222-2222-2222-2222-222222222222");
do_test_validate_uuid(from, to, &args, false);
}
@@ -2034,10 +2038,10 @@ static void test_validate_uuid_dst_not_set(void)
GuestState *from = guest_create("source");
GuestState *to = guest_create("target");
MigrateStart args = {
- .opts_source = "-uuid 11111111-1111-1111-1111-111111111111",
.hide_stderr = true,
};
+ guest_extra_opts(from, "-uuid 11111111-1111-1111-1111-111111111111");
do_test_validate_uuid(from, to, &args, false);
}
--
2.40.1
- [PATCH 21/42] migration-test: Move common guest code to guest_create(), (continued)
- [PATCH 26/42] migration-test: create guest_use_shmem(), Juan Quintela, 2023/06/08
- [PATCH 29/42] migration-test: Create the migration unix socket by guest, Juan Quintela, 2023/06/08
- [PATCH 25/42] migration-test: We were not waiting for "target" to finish, Juan Quintela, 2023/06/08
- [PATCH 27/42] migration-test: Create guest_extra_opts(),
Juan Quintela <=
- [PATCH 28/42] migration-test: Create guest_hide_stderr(), Juan Quintela, 2023/06/08
- [PATCH 30/42] migration-test: Hooks also need GuestState, Juan Quintela, 2023/06/08
- [PATCH 32/42] migration-test: Create guest_set_uri(), Juan Quintela, 2023/06/08
- [PATCH 33/42] migration-test: Remove connect_uri, Juan Quintela, 2023/06/08
- [PATCH 31/42] migration-test: Preffer to->uri to uri parameter for migration, Juan Quintela, 2023/06/08
- [PATCH 36/42] migration-test: Remove unused listen_uri, Juan Quintela, 2023/06/08
- [PATCH 34/42] migration-test: Use new schema for all tests that use unix sockets, Juan Quintela, 2023/06/08
- [PATCH 35/42] migration-test: Set uri for tcp tests with guest_set_uri(), Juan Quintela, 2023/06/08
- [PATCH 37/42] migration-test: Create get_event GuestState variable, Juan Quintela, 2023/06/08
- [PATCH 38/42] migration-test: Create guest_realize(), Juan Quintela, 2023/06/08