Skip to content

Commit

Permalink
tests/qtest/migration: Remove vmstate-static-checker test
Browse files Browse the repository at this point in the history
I fumbled one of my last pull requests when fixing in-tree an issue
with commit 87d67fa ("monitor: Stop removing non-duplicated
fds"). Basically mixed-up my `git add -p` and `git checkout -p` and
committed a piece of test infra that has not been reviewed yet.

This has not caused any bad symptoms because the test is not enabled
by default anywhere: make check doesn't use two qemu binaries and the
CI doesn't have PYTHON set for the compat tests. Besides, the test
works fine anyway, it would not break anything.

Remove this because it was never intended to be merged.

Reviewed-by: Peter Xu <peterx@redhat.com>
Signed-off-by: Fabiano Rosas <farosas@suse.de>
  • Loading branch information
Fabiano Rosas committed Sep 3, 2024
1 parent c83b77f commit ceb1ab1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 95 deletions.
17 changes: 6 additions & 11 deletions tests/qtest/libqtest.c
Original file line number Diff line number Diff line change
Expand Up @@ -514,29 +514,24 @@ static QTestState *qtest_init_internal(const char *qemu_bin,
kill(s->qemu_pid, SIGSTOP);
}
#endif
return s;

/* ask endianness of the target */

s->big_endian = qtest_query_target_endianness(s);

return s;
}

QTestState *qtest_init_without_qmp_handshake(const char *extra_args)
{
return qtest_init_internal(qtest_qemu_binary(NULL), extra_args);
}

QTestState *qtest_init_with_env_no_handshake(const char *var,
const char *extra_args)
{
return qtest_init_internal(qtest_qemu_binary(var), extra_args);
}

QTestState *qtest_init_with_env(const char *var, const char *extra_args)
{
QTestState *s = qtest_init_internal(qtest_qemu_binary(var), extra_args);
QDict *greeting;

/* ask endianness of the target */

s->big_endian = qtest_query_target_endianness(s);

/* Read the QMP greeting and then do the handshake */
greeting = qtest_qmp_receive(s);
qobject_unref(greeting);
Expand Down
2 changes: 0 additions & 2 deletions tests/qtest/libqtest.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,6 @@ QTestState *qtest_init(const char *extra_args);
*/
QTestState *qtest_init_with_env(const char *var, const char *extra_args);

QTestState *qtest_init_with_env_no_handshake(const char *var,
const char *extra_args);
/**
* qtest_init_without_qmp_handshake:
* @extra_args: other arguments to pass to QEMU. CAUTION: these
Expand Down
82 changes: 0 additions & 82 deletions tests/qtest/migration-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ static QTestMigrationState dst_state;
#define DIRTYLIMIT_TOLERANCE_RANGE 25 /* MB/s */

#define ANALYZE_SCRIPT "scripts/analyze-migration.py"
#define VMSTATE_CHECKER_SCRIPT "scripts/vmstate-static-checker.py"

#define QEMU_VM_FILE_MAGIC 0x5145564d
#define FILE_TEST_FILENAME "migfile"
Expand Down Expand Up @@ -1692,85 +1691,6 @@ static void test_analyze_script(void)
test_migrate_end(from, to, false);
cleanup("migfile");
}

static void test_vmstate_checker_script(void)
{
g_autofree gchar *cmd_src = NULL;
g_autofree gchar *cmd_dst = NULL;
g_autofree gchar *vmstate_src = NULL;
g_autofree gchar *vmstate_dst = NULL;
const char *machine_alias, *machine_opts = "";
g_autofree char *machine = NULL;
const char *arch = qtest_get_arch();
int pid, wstatus;
const char *python = g_getenv("PYTHON");

if (!getenv(QEMU_ENV_SRC) && !getenv(QEMU_ENV_DST)) {
g_test_skip("Test needs two different QEMU versions");
return;
}

if (!python) {
g_test_skip("PYTHON variable not set");
return;
}

if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) {
if (g_str_equal(arch, "i386")) {
machine_alias = "pc";
} else {
machine_alias = "q35";
}
} else if (g_str_equal(arch, "s390x")) {
machine_alias = "s390-ccw-virtio";
} else if (strcmp(arch, "ppc64") == 0) {
machine_alias = "pseries";
} else if (strcmp(arch, "aarch64") == 0) {
machine_alias = "virt";
} else {
g_assert_not_reached();
}

if (!qtest_has_machine(machine_alias)) {
g_autofree char *msg = g_strdup_printf("machine %s not supported", machine_alias);
g_test_skip(msg);
return;
}

machine = resolve_machine_version(machine_alias, QEMU_ENV_SRC,
QEMU_ENV_DST);

vmstate_src = g_strdup_printf("%s/vmstate-src", tmpfs);
vmstate_dst = g_strdup_printf("%s/vmstate-dst", tmpfs);

cmd_dst = g_strdup_printf("-machine %s,%s -dump-vmstate %s",
machine, machine_opts, vmstate_dst);
cmd_src = g_strdup_printf("-machine %s,%s -dump-vmstate %s",
machine, machine_opts, vmstate_src);

qtest_init_with_env_no_handshake(QEMU_ENV_SRC, cmd_src);
qtest_init_with_env_no_handshake(QEMU_ENV_DST, cmd_dst);

pid = fork();
if (!pid) {
close(1);
open("/dev/null", O_WRONLY);
execl(python, python, VMSTATE_CHECKER_SCRIPT,
"-s", vmstate_src,
"-d", vmstate_dst,
NULL);
g_assert_not_reached();
}

g_assert(waitpid(pid, &wstatus, 0) == pid);
if (!WIFEXITED(wstatus) || WEXITSTATUS(wstatus) != 0) {
g_test_message("Failed to run vmstate-static-checker.py");
g_test_fail();
}

cleanup("vmstate-src");
cleanup("vmstate-dst");
}
#endif

static void test_precopy_common(MigrateCommon *args)
Expand Down Expand Up @@ -3823,8 +3743,6 @@ int main(int argc, char **argv)
migration_test_add("/migration/bad_dest", test_baddest);
#ifndef _WIN32
migration_test_add("/migration/analyze-script", test_analyze_script);
migration_test_add("/migration/vmstate-checker-script",
test_vmstate_checker_script);
#endif

if (is_x86) {
Expand Down

0 comments on commit ceb1ab1

Please sign in to comment.