qemu-arm.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Igor Mammedov <imammedo@redhat.com>
To: qemu-devel@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>,
	Andrew Jones <drjones@redhat.com>,
	Eduardo Habkost <ehabkost@redhat.com>,
	qemu-arm@nongnu.org, qemu-ppc@nongnu.org,
	Shannon Zhao <zhaoshenglong@huawei.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Eric Blake <eblake@redhat.com>,
	David Gibson <david@gibson.dropbear.id.au>
Subject: [Qemu-arm] [PATCH for-2.10 01/23] tests: add CPUs to numa node mapping test
Date: Wed, 22 Mar 2017 14:32:26 +0100	[thread overview]
Message-ID: <1490189568-167621-2-git-send-email-imammedo@redhat.com> (raw)
In-Reply-To: <1490189568-167621-1-git-send-email-imammedo@redhat.com>

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 tests/Makefile.include |   5 +++
 tests/numa-test.c      | 106 +++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 111 insertions(+)
 create mode 100644 tests/numa-test.c

diff --git a/tests/Makefile.include b/tests/Makefile.include
index 402e71c..4547b01 100644
--- a/tests/Makefile.include
+++ b/tests/Makefile.include
@@ -260,6 +260,7 @@ check-qtest-i386-y += tests/test-filter-mirror$(EXESUF)
 check-qtest-i386-y += tests/test-filter-redirector$(EXESUF)
 check-qtest-i386-y += tests/postcopy-test$(EXESUF)
 check-qtest-i386-y += tests/test-x86-cpuid-compat$(EXESUF)
+check-qtest-i386-y += tests/numa-test$(EXESUF)
 check-qtest-x86_64-y += $(check-qtest-i386-y)
 gcov-files-i386-y += i386-softmmu/hw/timer/mc146818rtc.c
 gcov-files-x86_64-y = $(subst i386-softmmu/,x86_64-softmmu/,$(gcov-files-i386-y))
@@ -300,6 +301,7 @@ check-qtest-ppc64-y += tests/test-netfilter$(EXESUF)
 check-qtest-ppc64-y += tests/test-filter-mirror$(EXESUF)
 check-qtest-ppc64-y += tests/test-filter-redirector$(EXESUF)
 check-qtest-ppc64-y += tests/display-vga-test$(EXESUF)
+check-qtest-ppc64-y += tests/numa-test$(EXESUF)
 check-qtest-ppc64-$(CONFIG_EVENTFD) += tests/ivshmem-test$(EXESUF)
 
 check-qtest-sh4-y = tests/endianness-test$(EXESUF)
@@ -324,6 +326,8 @@ gcov-files-arm-y += arm-softmmu/hw/block/virtio-blk.c
 check-qtest-arm-y += tests/test-arm-mptimer$(EXESUF)
 gcov-files-arm-y += hw/timer/arm_mptimer.c
 
+check-qtest-aarch64-y = tests/numa-test$(EXESUF)
+
 check-qtest-microblazeel-y = $(check-qtest-microblaze-y)
 
 check-qtest-xtensaeb-y = $(check-qtest-xtensa-y)
@@ -747,6 +751,7 @@ tests/vhost-user-bridge$(EXESUF): tests/vhost-user-bridge.o contrib/libvhost-use
 tests/test-uuid$(EXESUF): tests/test-uuid.o $(test-util-obj-y)
 tests/test-arm-mptimer$(EXESUF): tests/test-arm-mptimer.o
 tests/test-qapi-util$(EXESUF): tests/test-qapi-util.o $(test-util-obj-y)
+tests/numa-test$(EXESUF): tests/numa-test.o
 
 tests/migration/stress$(EXESUF): tests/migration/stress.o
 	$(call quiet-command, $(LINKPROG) -static -O3 $(PTHREAD_LIB) -o $@ $< ,"LINK","$(TARGET_DIR)$@")
diff --git a/tests/numa-test.c b/tests/numa-test.c
new file mode 100644
index 0000000..f5da0c8
--- /dev/null
+++ b/tests/numa-test.c
@@ -0,0 +1,106 @@
+/*
+ * NUMA configuration test cases
+ *
+ * Copyright (c) 2017 Red Hat Inc.
+ * Authors:
+ *  Igor Mammedov <imammedo@redhat.com>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#include "qemu/osdep.h"
+#include "libqtest.h"
+
+static char *make_cli(const char *generic_cli, const char *test_cli)
+{
+    return g_strdup_printf("%s %s", generic_cli ? generic_cli : "", test_cli);
+}
+
+static char *hmp_info_numa(void)
+{
+    QDict *resp;
+    char *s;
+
+    resp = qmp("{ 'execute': 'human-monitor-command', 'arguments': "
+                      "{ 'command-line': 'info numa '} }");
+    g_assert(resp);
+    g_assert(qdict_haskey(resp, "return"));
+    s = g_strdup(qdict_get_str(resp, "return"));
+    g_assert(s);
+    QDECREF(resp);
+    return s;
+}
+
+static void test_mon_explicit(const void *data)
+{
+    char *s;
+    char *cli;
+
+    cli = make_cli(data, "-smp 8 "
+                   "-numa node,nodeid=0,cpus=0-3 "
+                   "-numa node,nodeid=1,cpus=4-7 ");
+    qtest_start(cli);
+
+    s = hmp_info_numa();
+    g_assert(strstr(s, "node 0 cpus: 0 1 2 3"));
+    g_assert(strstr(s, "node 1 cpus: 4 5 6 7"));
+    g_free(s);
+
+    qtest_end();
+    g_free(cli);
+}
+
+static void test_mon_default(const void *data)
+{
+    char *s;
+    char *cli;
+
+    cli = make_cli(data, "-smp 8 -numa node -numa node");
+    qtest_start(cli);
+
+    s = hmp_info_numa();
+    g_assert(strstr(s, "node 0 cpus: 0 2 4 6"));
+    g_assert(strstr(s, "node 1 cpus: 1 3 5 7"));
+    g_free(s);
+
+    qtest_end();
+    g_free(cli);
+}
+
+static void test_mon_partial(const void *data)
+{
+    char *s;
+    char *cli;
+
+    cli = make_cli(data, "-smp 8 "
+                   "-numa node,nodeid=0,cpus=0-1 "
+                   "-numa node,nodeid=1,cpus=4-5 ");
+    qtest_start(cli);
+
+    s = hmp_info_numa();
+    g_assert(strstr(s, "node 0 cpus: 0 1 2 3 6 7"));
+    g_assert(strstr(s, "node 1 cpus: 4 5"));
+    g_free(s);
+
+    qtest_end();
+    g_free(cli);
+}
+
+int main(int argc, char **argv)
+{
+    const char *args = NULL;
+    const char *arch = qtest_get_arch();
+
+    if (strcmp(arch, "aarch64") == 0) {
+        args = "-machine virt";
+    }
+
+    g_test_init(&argc, &argv, NULL);
+
+    qtest_add_data_func("/numa/mon/default", args, test_mon_default);
+    qtest_add_data_func("/numa/mon/cpus/explicit", args, test_mon_explicit);
+    qtest_add_data_func("/numa/mon/cpus/partial", args, test_mon_partial);
+
+    return g_test_run();
+}
-- 
2.7.4


  reply	other threads:[~2017-03-22 13:33 UTC|newest]

Thread overview: 77+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-22 13:32 [Qemu-arm] [PATCH for-2.10 00/23] numa: add '-numa cpu' option Igor Mammedov
2017-03-22 13:32 ` Igor Mammedov [this message]
2017-03-27  0:31   ` [Qemu-arm] [PATCH for-2.10 01/23] tests: add CPUs to numa node mapping test David Gibson
2017-03-22 13:32 ` [Qemu-arm] [PATCH for-2.10 02/23] hw/arm/virt: extract mp-affinity calculation in separate function Igor Mammedov
2017-04-25 14:09   ` [Qemu-arm] [Qemu-devel] " Andrew Jones
2017-04-25 14:39     ` Igor Mammedov
2017-03-22 13:32 ` [Qemu-arm] [PATCH for-2.10 03/23] hw/arm/virt: use machine->possible_cpus for storing possible topology info Igor Mammedov
2017-04-25 14:28   ` [Qemu-arm] [Qemu-devel] " Andrew Jones
2017-04-25 14:36     ` Igor Mammedov
2017-03-22 13:32 ` [Qemu-arm] [PATCH for-2.10 04/23] hw/arm/virt: explicitly allocate cpu_index for cpus Igor Mammedov
2017-04-25 14:33   ` [Qemu-arm] [Qemu-devel] " Andrew Jones
2017-03-22 13:32 ` [Qemu-arm] [PATCH for-2.10 05/23] numa: move source of default CPUs to NUMA node mapping into boards Igor Mammedov
2017-03-23  6:10   ` [Qemu-devel] " Bharata B Rao
2017-03-23  8:48     ` [Qemu-arm] " Igor Mammedov
2017-03-28  4:19   ` David Gibson
2017-03-28 10:53     ` [Qemu-arm] " Igor Mammedov
2017-03-29  2:24       ` David Gibson
2017-03-29 11:48         ` Igor Mammedov
2017-04-20 14:29     ` [Qemu-arm] [Qemu-devel] " Igor Mammedov
2017-04-25 14:48   ` Andrew Jones
2017-04-25 15:07     ` Igor Mammedov
2017-03-22 13:32 ` [Qemu-devel] [PATCH for-2.10 06/23] spapr: add node-id property to sPAPR core Igor Mammedov
2017-03-28  4:23   ` [Qemu-arm] " David Gibson
2017-03-22 13:32 ` [Qemu-arm] [PATCH for-2.10 07/23] pc: add node-id property to CPU Igor Mammedov
2017-04-12 21:02   ` [Qemu-arm] [Qemu-devel] " Eduardo Habkost
2017-04-19 11:14     ` Igor Mammedov
2017-04-26 12:21       ` [Qemu-arm] " Eduardo Habkost
2017-04-27 13:14         ` Igor Mammedov
2017-04-27 16:32           ` Eduardo Habkost
2017-04-27 17:25             ` Igor Mammedov
2017-04-27 17:32               ` Eduardo Habkost
2017-05-02  4:27             ` David Gibson
2017-05-02  8:28               ` Igor Mammedov
2017-03-22 13:32 ` [Qemu-arm] [PATCH for-2.10 08/23] virt-arm: " Igor Mammedov
2017-04-25 17:16   ` [Qemu-arm] [Qemu-devel] " Andrew Jones
2017-04-26 10:47     ` Igor Mammedov
2017-03-22 13:32 ` [Qemu-arm] [PATCH for-2.10 09/23] numa: add check that board supports cpu_index to node mapping Igor Mammedov
2017-03-22 13:32 ` [Qemu-arm] [PATCH for-2.10 10/23] numa: mirror cpu to node mapping in MachineState::possible_cpus Igor Mammedov
2017-03-28  4:44   ` David Gibson
2017-04-12 21:15   ` [Qemu-arm] [Qemu-devel] " Eduardo Habkost
2017-04-19  9:52     ` Igor Mammedov
2017-04-26 11:04       ` [Qemu-arm] " Eduardo Habkost
2017-04-13 13:58   ` Eduardo Habkost
2017-04-19  9:31     ` Igor Mammedov
2017-04-26 11:02       ` Eduardo Habkost
2017-03-22 13:32 ` [Qemu-devel] [PATCH for-2.10 11/23] numa: do default mapping based on possible_cpus instead of node_cpu bitmaps Igor Mammedov
2017-03-28  4:46   ` [Qemu-arm] " David Gibson
2017-03-22 13:32 ` [Qemu-devel] [PATCH for-2.10 12/23] pc: get numa node mapping from possible_cpus instead of numa_get_node_for_cpu() Igor Mammedov
2017-03-22 13:32 ` [Qemu-arm] [PATCH for-2.10 13/23] spapr: " Igor Mammedov
2017-03-22 13:32 ` [Qemu-arm] [PATCH for-2.10 14/23] virt-arm: " Igor Mammedov
2017-04-25 17:06   ` [Qemu-arm] [Qemu-devel] " Andrew Jones
2017-04-26 10:54     ` Igor Mammedov
2017-04-26 11:27       ` Andrew Jones
2017-04-27 13:24         ` Igor Mammedov
2017-03-22 13:32 ` [Qemu-arm] [PATCH for-2.10 15/23] QMP: include CpuInstanceProperties into query_cpus output output Igor Mammedov
2017-03-23 13:19   ` Eric Blake
2017-03-24 12:20     ` [Qemu-arm] [Qemu-devel] " Igor Mammedov
2017-03-22 13:32 ` [Qemu-arm] [PATCH for-2.10 16/23] tests: numa: add case for QMP command query-cpus Igor Mammedov
2017-03-22 13:32 ` [Qemu-arm] [PATCH for-2.10 17/23] numa: remove no longer used numa_get_node_for_cpu() Igor Mammedov
2017-03-28  4:54   ` David Gibson
2017-03-22 13:32 ` [Qemu-arm] [PATCH for-2.10 18/23] numa: remove no longer need numa_post_machine_init() Igor Mammedov
2017-03-28  4:55   ` David Gibson
2017-03-22 13:32 ` [Qemu-arm] [PATCH for-2.10 19/23] machine: call machine init from wrapper Igor Mammedov
2017-03-22 13:32 ` [Qemu-arm] [PATCH for-2.10 20/23] numa: use possible_cpus for not mapped CPUs check Igor Mammedov
2017-03-28  5:13   ` David Gibson
2017-03-22 13:32 ` [Qemu-arm] [PATCH for-2.10 21/23] numa: remove node_cpu bitmaps as they are no longer used Igor Mammedov
2017-03-28  5:13   ` David Gibson
2017-03-22 13:32 ` [Qemu-arm] [PATCH for-2.10 22/23] numa: add '-numa cpu, ...' option for property based node mapping Igor Mammedov
2017-03-23 13:23   ` Eric Blake
2017-03-24 13:29     ` [Qemu-arm] [Qemu-devel] " Igor Mammedov
2017-03-28  5:16   ` [Qemu-arm] " David Gibson
2017-03-28 11:09     ` Igor Mammedov
2017-03-29  2:27       ` David Gibson
2017-03-29 12:08         ` Igor Mammedov
2017-04-03  4:40           ` David Gibson
2017-03-22 13:32 ` [Qemu-arm] [PATCH for-2.10 23/23] tests: check -numa node, cpu=props_list usecase Igor Mammedov
2017-04-12 20:18 ` [Qemu-arm] [Qemu-devel] [PATCH for-2.10 00/23] numa: add '-numa cpu' option Eduardo Habkost

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1490189568-167621-2-git-send-email-imammedo@redhat.com \
    --to=imammedo@redhat.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=drjones@redhat.com \
    --cc=eblake@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=zhaoshenglong@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).