aboutsummaryrefslogtreecommitdiff
path: root/tests/migration-test.c
diff options
context:
space:
mode:
authorWei Huang <wei@redhat.com>2018-10-04 12:08:46 -0400
committerDr. David Alan Gilbert <dgilbert@redhat.com>2018-10-11 18:12:47 +0100
commitc02b37814cf6962b3320ab34e1b3a26a2323772f (patch)
treebc8a18c51cd49d3aae5be9fa2367393acca48041 /tests/migration-test.c
parent75e50c80e051423a6f55a34ee4a1eec842444a5b (diff)
tests: Add migration test for aarch64
This patch adds migration test support for aarch64. The test code, which implements the same functionality as x86, is booted as a kernel in qemu. Here are the design choices we make for aarch64: * We choose this -kernel approach because aarch64 QEMU doesn't provide a built-in fw like x86 does. So instead of relying on a boot loader, we use -kernel approach for aarch64. * The serial output is sent to PL011 directly. * The physical memory base for mach-virt machine is 0x40000000. We change the start_address and end_address for aarch64. In addition to providing the binary, this patch also includes the source code and the build script in tests/migration/aarch64. So users can change the source and/or re-compile the binary as they wish. Reviewed-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Andrew Jones <drjones@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com> Signed-off-by: Wei Huang <wei@redhat.com> Message-Id: <1538669326-28135-1-git-send-email-wei@redhat.com> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Diffstat (limited to 'tests/migration-test.c')
-rw-r--r--tests/migration-test.c27
1 files changed, 23 insertions, 4 deletions
diff --git a/tests/migration-test.c b/tests/migration-test.c
index 20f38f1930..5bdc0bd519 100644
--- a/tests/migration-test.c
+++ b/tests/migration-test.c
@@ -86,12 +86,13 @@ static const char *tmpfs;
* repeatedly. It outputs a 'B' at a fixed rate while it's still running.
*/
#include "tests/migration/i386/a-b-bootblock.h"
+#include "tests/migration/aarch64/a-b-kernel.h"
-static void init_bootfile_x86(const char *bootpath)
+static void init_bootfile(const char *bootpath, void *content)
{
FILE *bootfile = fopen(bootpath, "wb");
- g_assert_cmpint(fwrite(x86_bootsect, 512, 1, bootfile), ==, 1);
+ g_assert_cmpint(fwrite(content, 512, 1, bootfile), ==, 1);
fclose(bootfile);
}
@@ -428,7 +429,7 @@ static int test_migrate_start(QTestState **from, QTestState **to,
got_stop = false;
if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) {
- init_bootfile_x86(bootpath);
+ init_bootfile(bootpath, x86_bootsect);
cmd_src = g_strdup_printf("-machine accel=%s -m 150M"
" -name source,debug-threads=on"
" -serial file:%s/src_serial"
@@ -459,6 +460,24 @@ static int test_migrate_start(QTestState **from, QTestState **to,
start_address = PPC_TEST_MEM_START;
end_address = PPC_TEST_MEM_END;
+ } else if (strcmp(arch, "aarch64") == 0) {
+ init_bootfile(bootpath, aarch64_kernel);
+ 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 ",
+ accel, tmpfs, bootpath);
+ 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 ",
+ accel, tmpfs, bootpath, uri);
+
+ start_address = ARM_TEST_MEM_START;
+ end_address = ARM_TEST_MEM_END;
+
+ g_assert(sizeof(aarch64_kernel) <= ARM_TEST_MAX_KERNEL_SIZE);
} else {
g_assert_not_reached();
}
@@ -545,7 +564,7 @@ static void test_deprecated(void)
{
QTestState *from;
- from = qtest_start("");
+ from = qtest_start("-machine none");
deprecated_set_downtime(from, 0.12345);
deprecated_set_speed(from, 12345);