* [PATCH] tests/qtest: Add numa test for loongarch system
@ 2024-05-28 8:21 Bibo Mao
2024-05-29 7:17 ` Thomas Huth
2024-05-31 9:58 ` gaosong
0 siblings, 2 replies; 3+ messages in thread
From: Bibo Mao @ 2024-05-28 8:21 UTC (permalink / raw)
To: Thomas Huth, Laurent Vivier; +Cc: Paolo Bonzini, qemu-devel
Add numa test case for loongarch system, it passes to run
with command "make check-qtest".
Signed-off-by: Bibo Mao <maobibo@loongson.cn>
---
tests/qtest/meson.build | 2 +-
tests/qtest/numa-test.c | 53 +++++++++++++++++++++++++++++++++++++++++
2 files changed, 54 insertions(+), 1 deletion(-)
diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build
index b98fae6a6d..12792948ff 100644
--- a/tests/qtest/meson.build
+++ b/tests/qtest/meson.build
@@ -140,7 +140,7 @@ qtests_hppa = ['boot-serial-test'] + \
(config_all_devices.has_key('CONFIG_VGA') ? ['display-vga-test'] : [])
qtests_loongarch64 = qtests_filter + \
- ['boot-serial-test']
+ ['boot-serial-test', 'numa-test']
qtests_m68k = ['boot-serial-test'] + \
qtests_filter
diff --git a/tests/qtest/numa-test.c b/tests/qtest/numa-test.c
index 7aa262dbb9..5518f6596b 100644
--- a/tests/qtest/numa-test.c
+++ b/tests/qtest/numa-test.c
@@ -265,6 +265,54 @@ static void aarch64_numa_cpu(const void *data)
qtest_quit(qts);
}
+static void loongarch64_numa_cpu(const void *data)
+{
+ QDict *resp;
+ QList *cpus;
+ QObject *e;
+ QTestState *qts;
+ g_autofree char *cli = NULL;
+
+ cli = make_cli(data, "-machine "
+ "smp.cpus=2,smp.sockets=2,smp.cores=1,smp.threads=1 "
+ "-numa node,nodeid=0,memdev=ram -numa node,nodeid=1 "
+ "-numa cpu,node-id=0,socket-id=1,core-id=0,thread-id=0 "
+ "-numa cpu,node-id=1,socket-id=0,core-id=0,thread-id=0");
+ qts = qtest_init(cli);
+ cpus = get_cpus(qts, &resp);
+ g_assert(cpus);
+
+ while ((e = qlist_pop(cpus))) {
+ QDict *cpu, *props;
+ int64_t socket, core, thread, node;
+
+ cpu = qobject_to(QDict, e);
+ g_assert(qdict_haskey(cpu, "props"));
+ props = qdict_get_qdict(cpu, "props");
+
+ g_assert(qdict_haskey(props, "node-id"));
+ node = qdict_get_int(props, "node-id");
+ g_assert(qdict_haskey(props, "socket-id"));
+ socket = qdict_get_int(props, "socket-id");
+ g_assert(qdict_haskey(props, "core-id"));
+ core = qdict_get_int(props, "core-id");
+ g_assert(qdict_haskey(props, "thread-id"));
+ thread = qdict_get_int(props, "thread-id");
+
+ if (socket == 0 && core == 0 && thread == 0) {
+ g_assert_cmpint(node, ==, 1);
+ } else if (socket == 1 && core == 0 && thread == 0) {
+ g_assert_cmpint(node, ==, 0);
+ } else {
+ g_assert(false);
+ }
+ qobject_unref(e);
+ }
+
+ qobject_unref(resp);
+ qtest_quit(qts);
+}
+
static void pc_dynamic_cpu_cfg(const void *data)
{
QObject *e;
@@ -593,6 +641,11 @@ int main(int argc, char **argv)
aarch64_numa_cpu);
}
+ if (!strcmp(arch, "loongarch64")) {
+ qtest_add_data_func("/numa/loongarch64/cpu/explicit", args,
+ loongarch64_numa_cpu);
+ }
+
out:
return g_test_run();
}
--
2.39.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] tests/qtest: Add numa test for loongarch system
2024-05-28 8:21 [PATCH] tests/qtest: Add numa test for loongarch system Bibo Mao
@ 2024-05-29 7:17 ` Thomas Huth
2024-05-31 9:58 ` gaosong
1 sibling, 0 replies; 3+ messages in thread
From: Thomas Huth @ 2024-05-29 7:17 UTC (permalink / raw)
To: Bibo Mao, Laurent Vivier, Song Gao; +Cc: Paolo Bonzini, qemu-devel
On 28/05/2024 10.21, Bibo Mao wrote:
> Add numa test case for loongarch system, it passes to run
> with command "make check-qtest".
>
> Signed-off-by: Bibo Mao <maobibo@loongson.cn>
> ---
> tests/qtest/meson.build | 2 +-
> tests/qtest/numa-test.c | 53 +++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 54 insertions(+), 1 deletion(-)
Acked-by: Thomas Huth <thuth@redhat.com>
I assume this will also go through the loongarch tree? Let me know if you
want to have this merged via the qtest tree instead.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] tests/qtest: Add numa test for loongarch system
2024-05-28 8:21 [PATCH] tests/qtest: Add numa test for loongarch system Bibo Mao
2024-05-29 7:17 ` Thomas Huth
@ 2024-05-31 9:58 ` gaosong
1 sibling, 0 replies; 3+ messages in thread
From: gaosong @ 2024-05-31 9:58 UTC (permalink / raw)
To: Bibo Mao, Thomas Huth, Laurent Vivier; +Cc: Paolo Bonzini, qemu-devel
在 2024/5/28 下午4:21, Bibo Mao 写道:
> Add numa test case for loongarch system, it passes to run
> with command "make check-qtest".
>
> Signed-off-by: Bibo Mao <maobibo@loongson.cn>
> ---
> tests/qtest/meson.build | 2 +-
> tests/qtest/numa-test.c | 53 +++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 54 insertions(+), 1 deletion(-)
Tested-by: Song Gao <gaosong@loongson.cn>
Thanks.
Song Gao
> diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build
> index b98fae6a6d..12792948ff 100644
> --- a/tests/qtest/meson.build
> +++ b/tests/qtest/meson.build
> @@ -140,7 +140,7 @@ qtests_hppa = ['boot-serial-test'] + \
> (config_all_devices.has_key('CONFIG_VGA') ? ['display-vga-test'] : [])
>
> qtests_loongarch64 = qtests_filter + \
> - ['boot-serial-test']
> + ['boot-serial-test', 'numa-test']
>
> qtests_m68k = ['boot-serial-test'] + \
> qtests_filter
> diff --git a/tests/qtest/numa-test.c b/tests/qtest/numa-test.c
> index 7aa262dbb9..5518f6596b 100644
> --- a/tests/qtest/numa-test.c
> +++ b/tests/qtest/numa-test.c
> @@ -265,6 +265,54 @@ static void aarch64_numa_cpu(const void *data)
> qtest_quit(qts);
> }
>
> +static void loongarch64_numa_cpu(const void *data)
> +{
> + QDict *resp;
> + QList *cpus;
> + QObject *e;
> + QTestState *qts;
> + g_autofree char *cli = NULL;
> +
> + cli = make_cli(data, "-machine "
> + "smp.cpus=2,smp.sockets=2,smp.cores=1,smp.threads=1 "
> + "-numa node,nodeid=0,memdev=ram -numa node,nodeid=1 "
> + "-numa cpu,node-id=0,socket-id=1,core-id=0,thread-id=0 "
> + "-numa cpu,node-id=1,socket-id=0,core-id=0,thread-id=0");
> + qts = qtest_init(cli);
> + cpus = get_cpus(qts, &resp);
> + g_assert(cpus);
> +
> + while ((e = qlist_pop(cpus))) {
> + QDict *cpu, *props;
> + int64_t socket, core, thread, node;
> +
> + cpu = qobject_to(QDict, e);
> + g_assert(qdict_haskey(cpu, "props"));
> + props = qdict_get_qdict(cpu, "props");
> +
> + g_assert(qdict_haskey(props, "node-id"));
> + node = qdict_get_int(props, "node-id");
> + g_assert(qdict_haskey(props, "socket-id"));
> + socket = qdict_get_int(props, "socket-id");
> + g_assert(qdict_haskey(props, "core-id"));
> + core = qdict_get_int(props, "core-id");
> + g_assert(qdict_haskey(props, "thread-id"));
> + thread = qdict_get_int(props, "thread-id");
> +
> + if (socket == 0 && core == 0 && thread == 0) {
> + g_assert_cmpint(node, ==, 1);
> + } else if (socket == 1 && core == 0 && thread == 0) {
> + g_assert_cmpint(node, ==, 0);
> + } else {
> + g_assert(false);
> + }
> + qobject_unref(e);
> + }
> +
> + qobject_unref(resp);
> + qtest_quit(qts);
> +}
> +
> static void pc_dynamic_cpu_cfg(const void *data)
> {
> QObject *e;
> @@ -593,6 +641,11 @@ int main(int argc, char **argv)
> aarch64_numa_cpu);
> }
>
> + if (!strcmp(arch, "loongarch64")) {
> + qtest_add_data_func("/numa/loongarch64/cpu/explicit", args,
> + loongarch64_numa_cpu);
> + }
> +
> out:
> return g_test_run();
> }
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-05-31 9:59 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-28 8:21 [PATCH] tests/qtest: Add numa test for loongarch system Bibo Mao
2024-05-29 7:17 ` Thomas Huth
2024-05-31 9:58 ` gaosong
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).