[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 3/7] tests/qtest/migration: Initialize MigrationTestEnv::arch
From: |
Fabiano Rosas |
Subject: |
Re: [PATCH 3/7] tests/qtest/migration: Initialize MigrationTestEnv::arch early |
Date: |
Tue, 28 Jan 2025 11:43:05 -0300 |
Philippe Mathieu-Daudé <philmd@linaro.org> writes:
> Some tests expect MigrationTestEnv::arch to be set. Initialize
> it early enough to avoid SIGSEGV, for example like the following
> g_str_equal() call in migration/precopy-tests.c:
>
> 954 void migration_test_add_precopy(MigrationTestEnv *env)
> 955 {
> ...
> 1001 if (g_str_equal(env->arch, "x86_64") && env->has_dirty_ring) {
> 1002
> 1003 migration_test_add("/migration/dirty_ring",
> 1004 test_precopy_unix_dirty_ring);
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> tests/qtest/migration/framework.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/tests/qtest/migration/framework.c
> b/tests/qtest/migration/framework.c
> index a3bd92a9519..38a0a1a5264 100644
> --- a/tests/qtest/migration/framework.c
> +++ b/tests/qtest/migration/framework.c
> @@ -938,6 +938,8 @@ MigrationTestEnv *migration_get_env(void)
> exit(1);
> }
>
> + env->arch = qtest_get_arch();
> +
> env->has_kvm = qtest_has_accel("kvm");
> env->has_tcg = qtest_has_accel("tcg");
>
> @@ -948,7 +950,6 @@ MigrationTestEnv *migration_get_env(void)
>
> env->has_dirty_ring = env->has_kvm && kvm_dirty_ring_supported();
> env->has_uffd = ufd_version_check(&env->uffd_feature_thread_id);
> - env->arch = qtest_get_arch();
> env->is_x86 = !strcmp(env->arch, "i386") || !strcmp(env->arch, "x86_64");
>
> env->tmpfs = g_dir_make_tmp("migration-test-XXXXXX", &err);
Reviewed-by: Fabiano Rosas <farosas@suse.de>
The change itself is fine, but I think the actual issue is that we
shouldn't be calling g_test_skip() from migration_get_env(). There's no
point adding a bunch of tests if none of them will run because there's
no supported accel present. So:
if (!env->has_tcg && !env->has_kvm) {
- g_test_skip("No KVM or TCG accelerator available");
- return env;
+ g_test_message("No KVM or TCG accelerator available");
+ exit(0);
}
- [PATCH 0/7] tests/qtest/migration: Update framework to allow using HVF accelerator, Philippe Mathieu-Daudé, 2025/01/28
- [PATCH 1/7] migration/dirtyrate: Do not unlock cpu_list lock twice, Philippe Mathieu-Daudé, 2025/01/28
- [PATCH 3/7] tests/qtest/migration: Initialize MigrationTestEnv::arch early, Philippe Mathieu-Daudé, 2025/01/28
- [PATCH 2/7] tests/qtest/migration: Make 'has_dirty_ring' generic, Philippe Mathieu-Daudé, 2025/01/28
- [PATCH 4/7] tests/qtest/migration: Pass accelerator arguments as machine option, Philippe Mathieu-Daudé, 2025/01/28
- [RFC PATCH 6/7] tests/qtest/migration: Run aarch64/HVF tests using GICv2, Philippe Mathieu-Daudé, 2025/01/28
- [PATCH 5/7] tests/qtest/migration: Add MigrationTestEnv::has_hvf field, Philippe Mathieu-Daudé, 2025/01/28