Browse Source

tests/qtest/cpu-plug-test: Add cpu hotplug support for LoongArch

Add cpu hotplug testcase support for LoongArch system, it passes to
run with command "make check-qtest-loongarch64" as following:
  qemu:qtest+qtest-loongarch64 / qtest-loongarch64/cpu-plug-test OK 0.38s 1 subtests passed

Signed-off-by: Bibo Mao <maobibo@loongson.cn>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-ID: <20250314085130.4184272-1-maobibo@loongson.cn>
Signed-off-by: Fabiano Rosas <farosas@suse.de>
pull/291/head
Bibo Mao 1 year ago
committed by Fabiano Rosas
parent
commit
98008aa41b
  1. 24
      tests/qtest/cpu-plug-test.c
  2. 3
      tests/qtest/meson.build

24
tests/qtest/cpu-plug-test.c

@ -156,6 +156,28 @@ static void add_s390x_test_case(const char *mname)
g_free(path);
}
static void add_loongarch_test_case(const char *mname)
{
char *path;
PlugTestData *data;
data = g_new(PlugTestData, 1);
data->machine = g_strdup(mname);
data->cpu_model = "la464";
data->device_model = g_strdup("la464-loongarch-cpu");
data->sockets = 1;
data->cores = 3;
data->threads = 1;
data->maxcpus = data->sockets * data->cores * data->threads;
path = g_strdup_printf("cpu-plug/%s/device-add/%ux%ux%u&maxcpus=%u",
mname, data->sockets, data->cores,
data->threads, data->maxcpus);
qtest_add_data_func_full(path, data, test_plug_with_device_add,
test_data_free);
g_free(path);
}
int main(int argc, char **argv)
{
const char *arch = qtest_get_arch();
@ -168,6 +190,8 @@ int main(int argc, char **argv)
qtest_cb_for_every_machine(add_pseries_test_case, g_test_quick());
} else if (g_str_equal(arch, "s390x")) {
qtest_cb_for_every_machine(add_s390x_test_case, g_test_quick());
} else if (g_str_equal(arch, "loongarch64")) {
add_loongarch_test_case("virt");
}
return g_test_run();

3
tests/qtest/meson.build

@ -148,7 +148,8 @@ qtests_hppa = \
qtests_loongarch64 = qtests_filter + \
(config_all_devices.has_key('CONFIG_LOONGARCH_VIRT') ? ['numa-test'] : []) + \
['boot-serial-test']
['boot-serial-test',
'cpu-plug-test']
qtests_m68k = ['boot-serial-test'] + \
qtests_filter

Loading…
Cancel
Save