diff options
author | Wei Huang <wei@redhat.com> | 2018-09-05 15:15:33 -0400 |
---|---|---|
committer | Dr. David Alan Gilbert <dgilbert@redhat.com> | 2018-09-26 13:20:36 +0100 |
commit | e51e711b1bef44861cf6a9d0f426d0a6bd119227 (patch) | |
tree | 789dd27bf0a2329ebc7f2a16b874b8ccc1668c85 | |
parent | d54927efdc93d0405c12ec94a9f466e41d8c3b52 (diff) | |
download | qemu-e51e711b1bef44861cf6a9d0f426d0a6bd119227.zip qemu-e51e711b1bef44861cf6a9d0f426d0a6bd119227.tar.gz qemu-e51e711b1bef44861cf6a9d0f426d0a6bd119227.tar.bz2 |
tests/migration: Add migration-test header file
This patch moves the settings related migration-test from the
migration-test.c file to a new header file.
Reviewed-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Andrew Jones <drjones@redhat.com>
Signed-off-by: Wei Huang <wei@redhat.com>
Message-Id: <1536174934-26022-4-git-send-email-wei@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
-rw-r--r-- | tests/migration-test.c | 28 | ||||
-rw-r--r-- | tests/migration/migration-test.h | 21 |
2 files changed, 39 insertions, 10 deletions
diff --git a/tests/migration-test.c b/tests/migration-test.c index fe6b41a..17c6896 100644 --- a/tests/migration-test.c +++ b/tests/migration-test.c @@ -21,11 +21,13 @@ #include "chardev/char.h" #include "sysemu/sysemu.h" +#include "migration/migration-test.h" + /* TODO actually test the results and get rid of this */ #define qtest_qmp_discard_response(...) qobject_unref(qtest_qmp(__VA_ARGS__)) -const unsigned start_address = 1024 * 1024; -const unsigned end_address = 100 * 1024 * 1024; +unsigned start_address; +unsigned end_address; bool got_stop; static bool uffd_feature_thread_id; @@ -80,8 +82,8 @@ static bool ufd_version_check(void) static const char *tmpfs; -/* A simple PC boot sector that modifies memory (1-100MB) quickly - * outputting a 'B' every so often if it's still running. +/* The boot file modifies memory area in [start_address, end_address) + * repeatedly. It outputs a 'B' at a fixed rate while it's still running. */ #include "tests/migration/i386/a-b-bootblock.h" @@ -270,11 +272,11 @@ static void wait_for_migration_pass(QTestState *who) static void check_guests_ram(QTestState *who) { /* Our ASM test will have been incrementing one byte from each page from - * 1MB to <100MB in order. - * This gives us a constraint that any page's byte should be equal or less - * than the previous pages byte (mod 256); and they should all be equal - * except for one transition at the point where we meet the incrementer. - * (We're running this with the guest stopped). + * start_address to < end_address in order. This gives us a constraint + * that any page's byte should be equal or less than the previous pages + * byte (mod 256); and they should all be equal except for one transition + * at the point where we meet the incrementer. (We're running this with + * the guest stopped). */ unsigned address; uint8_t first_byte; @@ -285,7 +287,8 @@ static void check_guests_ram(QTestState *who) qtest_memread(who, start_address, &first_byte, 1); last_byte = first_byte; - for (address = start_address + 4096; address < end_address; address += 4096) + for (address = start_address + TEST_MEM_PAGE_SIZE; address < end_address; + address += TEST_MEM_PAGE_SIZE) { uint8_t b; qtest_memread(who, address, &b, 1); @@ -437,6 +440,8 @@ static int test_migrate_start(QTestState **from, QTestState **to, " -drive file=%s,format=raw" " -incoming %s", accel, tmpfs, bootpath, uri); + start_address = X86_TEST_MEM_START; + end_address = X86_TEST_MEM_END; } else if (strcmp(arch, "ppc64") == 0) { cmd_src = g_strdup_printf("-machine accel=%s -m 256M" " -name source,debug-threads=on" @@ -451,6 +456,9 @@ static int test_migrate_start(QTestState **from, QTestState **to, " -serial file:%s/dest_serial" " -incoming %s", accel, tmpfs, uri); + + start_address = PPC_TEST_MEM_START; + end_address = PPC_TEST_MEM_END; } else { g_assert_not_reached(); } diff --git a/tests/migration/migration-test.h b/tests/migration/migration-test.h new file mode 100644 index 0000000..c4c0c52 --- /dev/null +++ b/tests/migration/migration-test.h @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2018 Red Hat, Inc. and/or its affiliates + * + * This work is licensed under the terms of the GNU GPL, version 2 or later. + * See the COPYING file in the top-level directory. + */ +#ifndef _TEST_MIGRATION_H_ +#define _TEST_MIGRATION_H_ + +/* Common */ +#define TEST_MEM_PAGE_SIZE 4096 + +/* x86 */ +#define X86_TEST_MEM_START (1 * 1024 * 1024) +#define X86_TEST_MEM_END (100 * 1024 * 1024) + +/* PPC */ +#define PPC_TEST_MEM_START (1 * 1024 * 1024) +#define PPC_TEST_MEM_END (100 * 1024 * 1024) + +#endif /* _TEST_MIGRATION_H_ */ |