[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 02/62] migration-test: Create cmd_soure and cmd_target
From: |
Paolo Bonzini |
Subject: |
[PULL 02/62] migration-test: Create cmd_soure and cmd_target |
Date: |
Mon, 16 Dec 2019 17:27:46 +0100 |
From: Juan Quintela <address@hidden>
We are repeating almost everything for each machine while creating the
command line for migration. And once for source and another for
destination. We start putting there opts_src and opts_dst.
Signed-off-by: Juan Quintela <address@hidden>
Tested-by: Cornelia Huck <address@hidden> #s390x
Tested-by: Laurent Vivier <address@hidden>
---
tests/migration-test.c | 44 +++++++++++++++++++++++++-------------------
1 file changed, 25 insertions(+), 19 deletions(-)
diff --git a/tests/migration-test.c b/tests/migration-test.c
index ebd77a5..9573861 100644
--- a/tests/migration-test.c
+++ b/tests/migration-test.c
@@ -557,6 +557,7 @@ static int test_migrate_start(QTestState **from, QTestState
**to,
const char *opts_dst)
{
gchar *cmd_src, *cmd_dst;
+ gchar *cmd_source, *cmd_target;
char *bootpath = NULL;
char *extra_opts = NULL;
char *shmem_path = NULL;
@@ -584,16 +585,16 @@ static int test_migrate_start(QTestState **from,
QTestState **to,
cmd_src = g_strdup_printf("-machine accel=%s -m 150M"
" -name source,debug-threads=on"
" -serial file:%s/src_serial"
- " -drive file=%s,format=raw %s %s",
+ " -drive file=%s,format=raw %s",
accel, tmpfs, bootpath,
- extra_opts ? extra_opts : "", opts_src);
+ extra_opts ? extra_opts : "");
cmd_dst = g_strdup_printf("-machine accel=%s -m 150M"
" -name target,debug-threads=on"
" -serial file:%s/dest_serial"
" -drive file=%s,format=raw"
- " -incoming %s %s %s",
+ " -incoming %s %s",
accel, tmpfs, bootpath, uri,
- extra_opts ? extra_opts : "", opts_dst);
+ extra_opts ? extra_opts : "");
start_address = X86_TEST_MEM_START;
end_address = X86_TEST_MEM_END;
} else if (g_str_equal(arch, "s390x")) {
@@ -601,15 +602,15 @@ static int test_migrate_start(QTestState **from,
QTestState **to,
extra_opts = use_shmem ? get_shmem_opts("128M", shmem_path) : NULL;
cmd_src = g_strdup_printf("-machine accel=%s -m 128M"
" -name source,debug-threads=on"
- " -serial file:%s/src_serial -bios %s %s %s",
+ " -serial file:%s/src_serial -bios %s %s",
accel, tmpfs, bootpath,
- extra_opts ? extra_opts : "", opts_src);
+ extra_opts ? extra_opts : "");
cmd_dst = g_strdup_printf("-machine accel=%s -m 128M"
" -name target,debug-threads=on"
" -serial file:%s/dest_serial -bios %s"
- " -incoming %s %s %s",
+ " -incoming %s %s",
accel, tmpfs, bootpath, uri,
- extra_opts ? extra_opts : "", opts_dst);
+ extra_opts ? extra_opts : "");
start_address = S390_TEST_MEM_START;
end_address = S390_TEST_MEM_END;
} else if (strcmp(arch, "ppc64") == 0) {
@@ -620,15 +621,14 @@ static int test_migrate_start(QTestState **from,
QTestState **to,
" -prom-env 'use-nvramrc?=true' -prom-env "
"'nvramrc=hex .\" _\" begin %x %x "
"do i c@ 1 + i c! 1000 +loop .\" B\" 0 "
- "until' %s %s", accel, tmpfs, end_address,
- start_address, extra_opts ? extra_opts : "",
- opts_src);
+ "until' %s", accel, tmpfs, end_address,
+ start_address, extra_opts ? extra_opts : "");
cmd_dst = g_strdup_printf("-machine accel=%s,vsmt=8 -m 256M"
" -name target,debug-threads=on"
" -serial file:%s/dest_serial"
- " -incoming %s %s %s",
+ " -incoming %s %s",
accel, tmpfs, uri,
- extra_opts ? extra_opts : "", opts_dst);
+ extra_opts ? extra_opts : "");
start_address = PPC_TEST_MEM_START;
end_address = PPC_TEST_MEM_END;
@@ -638,16 +638,16 @@ static int test_migrate_start(QTestState **from,
QTestState **to,
cmd_src = g_strdup_printf("-machine virt,accel=%s,gic-version=max "
"-name vmsource,debug-threads=on -cpu max "
"-m 150M -serial file:%s/src_serial "
- "-kernel %s %s %s",
+ "-kernel %s %s",
accel, tmpfs, bootpath,
- extra_opts ? extra_opts : "", opts_src);
+ extra_opts ? extra_opts : "");
cmd_dst = g_strdup_printf("-machine virt,accel=%s,gic-version=max "
"-name vmdest,debug-threads=on -cpu max "
"-m 150M -serial file:%s/dest_serial "
"-kernel %s "
- "-incoming %s %s %s",
+ "-incoming %s %s",
accel, tmpfs, bootpath, uri,
- extra_opts ? extra_opts : "", opts_dst);
+ extra_opts ? extra_opts : "");
start_address = ARM_TEST_MEM_START;
end_address = ARM_TEST_MEM_END;
@@ -671,11 +671,17 @@ static int test_migrate_start(QTestState **from,
QTestState **to,
cmd_dst = tmp;
}
- *from = qtest_init(cmd_src);
+ cmd_source = g_strdup_printf("%s %s",
+ cmd_src, opts_src);
g_free(cmd_src);
+ *from = qtest_init(cmd_source);
+ g_free(cmd_source);
- *to = qtest_init(cmd_dst);
+ cmd_target = g_strdup_printf("%s %s",
+ cmd_dst, opts_dst);
g_free(cmd_dst);
+ *to = qtest_init(cmd_target);
+ g_free(cmd_target);
/*
* Remove shmem file immediately to avoid memory leak in test failed case.
--
1.8.3.1
- [PULL 00/62] Misc patches for 2019-12-16, Paolo Bonzini, 2019/12/16
- [PULL 01/62] kvm: Reallocate dirty_bmap when we change a slot, Paolo Bonzini, 2019/12/16
- [PULL 02/62] migration-test: Create cmd_soure and cmd_target,
Paolo Bonzini <=
- [PULL 03/62] migration-test: Move hide_stderr to common commandline, Paolo Bonzini, 2019/12/16
- [PULL 04/62] migration-test: Move -machine to common commandline, Paolo Bonzini, 2019/12/16
- [PULL 05/62] migration-test: Move memory size to common commandline, Paolo Bonzini, 2019/12/16
- [PULL 06/62] migration-test: Move shmem handling to common commandline, Paolo Bonzini, 2019/12/16
- [PULL 07/62] migration-test: Move -name handling to common commandline, Paolo Bonzini, 2019/12/16
- [PULL 09/62] migration-test: Move -incomming handling to common commandline, Paolo Bonzini, 2019/12/16
- [PULL 08/62] migration-test: Move -serial handling to common commandline, Paolo Bonzini, 2019/12/16
- [PULL 10/62] migration-test: Rename cmd_src/dst to arch_source/arch_target, Paolo Bonzini, 2019/12/16
- [PULL 12/62] memory: do not look at current_machine->accel, Paolo Bonzini, 2019/12/16
- [PULL 11/62] migration-test: Use a struct for test_migrate_start parameters, Paolo Bonzini, 2019/12/16