mirror of
https://github.com/xemu-project/xemu.git
synced 2025-01-23 20:36:16 +00:00
migration-test: Create cmd_soure and cmd_target
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 <quintela@redhat.com> Tested-by: Cornelia Huck <cohuck@redhat.com> #s390x Tested-by: Laurent Vivier <lvivier@redhat.com>
This commit is contained in:
parent
9b3a31c745
commit
8443415f9a
@ -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.
|
||||
|
Loading…
x
Reference in New Issue
Block a user