summary refs log tree commit diff stats
path: root/tests/migration-test.c
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2019-11-13 10:10:47 +0100
committerPaolo Bonzini <pbonzini@redhat.com>2019-12-17 19:32:26 +0100
commit6f6e1698a68ceb49e57676528612f22eaf2c16c3 (patch)
treef6d9b5d646eaec9965450b044957b02ebf827182 /tests/migration-test.c
parente5db4bd863c8fdf155b003446b98a7aec65a931c (diff)
downloadfocaccia-qemu-6f6e1698a68ceb49e57676528612f22eaf2c16c3.tar.gz
focaccia-qemu-6f6e1698a68ceb49e57676528612f22eaf2c16c3.zip
vl: configure accelerators from -accel options
Drop the "accel" property from MachineState, and instead desugar
"-machine accel=" to a list of "-accel" options.

This has a semantic change due to removing merge_lists from -accel.
For example:

- "-accel kvm -accel tcg" all but ignored "-accel kvm".  This is a bugfix.

- "-accel kvm -accel thread=single" ignored "thread=single", since it
  applied the option to KVM.  Now it fails due to not specifying the
  accelerator on "-accel thread=single".

- "-accel tcg -accel thread=single" chose single-threaded TCG, while now
  it will fail due to not specifying the accelerator on "-accel
  thread=single".

Also, "-machine accel" and "-accel" become incompatible.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'tests/migration-test.c')
-rw-r--r--tests/migration-test.c23
1 files changed, 9 insertions, 14 deletions
diff --git a/tests/migration-test.c b/tests/migration-test.c
index dbe25b8d7c..e56e6dcb00 100644
--- a/tests/migration-test.c
+++ b/tests/migration-test.c
@@ -577,8 +577,7 @@ static int test_migrate_start(QTestState **from, QTestState **to,
     char *shmem_opts;
     char *shmem_path;
     const char *arch = qtest_get_arch();
-    const char *machine_type;
-    const char *machine_args;
+    const char *machine_opts = NULL;
     const char *memory_size;
 
     if (args->use_shmem) {
@@ -594,8 +593,6 @@ static int test_migrate_start(QTestState **from, QTestState **to,
         /* the assembled x86 boot sector should be exactly one sector large */
         assert(sizeof(x86_bootsect) == 512);
         init_bootfile(bootpath, x86_bootsect, sizeof(x86_bootsect));
-        machine_type = "";
-        machine_args = "";
         memory_size = "150M";
         arch_source = g_strdup_printf("-drive file=%s,format=raw", bootpath);
         arch_target = g_strdup(arch_source);
@@ -603,16 +600,13 @@ static int test_migrate_start(QTestState **from, QTestState **to,
         end_address = X86_TEST_MEM_END;
     } else if (g_str_equal(arch, "s390x")) {
         init_bootfile(bootpath, s390x_elf, sizeof(s390x_elf));
-        machine_type = "";
-        machine_args = "";
         memory_size = "128M";
         arch_source = g_strdup_printf("-bios %s", bootpath);
         arch_target = g_strdup(arch_source);
         start_address = S390_TEST_MEM_START;
         end_address = S390_TEST_MEM_END;
     } else if (strcmp(arch, "ppc64") == 0) {
-        machine_type = "";
-        machine_args = ",vsmt=8";
+        machine_opts = "vsmt=8";
         memory_size = "256M";
         arch_source = g_strdup_printf("-nodefaults "
                                       "-prom-env 'use-nvramrc?=true' -prom-env "
@@ -624,8 +618,7 @@ static int test_migrate_start(QTestState **from, QTestState **to,
         end_address = PPC_TEST_MEM_END;
     } else if (strcmp(arch, "aarch64") == 0) {
         init_bootfile(bootpath, aarch64_kernel, sizeof(aarch64_kernel));
-        machine_type = "virt,";
-        machine_args = "gic-version=max";
+        machine_opts = "virt,gic-version=max";
         memory_size = "150M";
         arch_source = g_strdup_printf("-cpu max "
                                       "-kernel %s",
@@ -658,12 +651,13 @@ static int test_migrate_start(QTestState **from, QTestState **to,
         shmem_opts = g_strdup("");
     }
 
-    cmd_source = g_strdup_printf("-machine %saccel=kvm:tcg%s "
+    cmd_source = g_strdup_printf("-accel kvm -accel tcg%s%s "
                                  "-name source,debug-threads=on "
                                  "-m %s "
                                  "-serial file:%s/src_serial "
                                  "%s %s %s %s",
-                                 machine_type, machine_args,
+                                 machine_opts ? " -machine " : "",
+                                 machine_opts ? machine_opts : "",
                                  memory_size, tmpfs,
                                  arch_source, shmem_opts, args->opts_source,
                                  ignore_stderr);
@@ -671,13 +665,14 @@ static int test_migrate_start(QTestState **from, QTestState **to,
     *from = qtest_init(cmd_source);
     g_free(cmd_source);
 
-    cmd_target = g_strdup_printf("-machine %saccel=kvm:tcg%s "
+    cmd_target = g_strdup_printf("-accel kvm -accel tcg%s%s "
                                  "-name target,debug-threads=on "
                                  "-m %s "
                                  "-serial file:%s/dest_serial "
                                  "-incoming %s "
                                  "%s %s %s %s",
-                                 machine_type, machine_args,
+                                 machine_opts ? " -machine " : "",
+                                 machine_opts ? machine_opts : "",
                                  memory_size, tmpfs, uri,
                                  arch_target, shmem_opts,
                                  args->opts_target, ignore_stderr);