From: Brendan Jackman <jackmanb@google.com>
To: Brendan Higgins <brendan.higgins@linux.dev>,
David Gow <davidgow@google.com>, Rae Moar <rmoar@google.com>,
Andrew Morton <akpm@linux-foundation.org>,
David Hildenbrand <david@redhat.com>,
Oscar Salvador <osalvador@suse.de>
Cc: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>,
Vlastimil Babka <vbabka@suse.cz>,
Michal Hocko <mhocko@kernel.org>,
linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com,
linux-kernel@vger.kernel.org, linux-mm@kvack.org,
Brendan Jackman <jackmanb@google.com>,
Yosry Ahmed <yosry.ahmed@linux.dev>
Subject: [PATCH RFC 2/4] mm/page_alloc_test: Add empty KUnit boilerplate
Date: Mon, 24 Feb 2025 14:47:12 +0000 [thread overview]
Message-ID: <20250224-page-alloc-kunit-v1-2-d337bb440889@google.com> (raw)
In-Reply-To: <20250224-page-alloc-kunit-v1-0-d337bb440889@google.com>
Add the Kbuild plumbing to create a new KUnit suite. Create the suite,
with no tests inside it.
Signed-off-by: Brendan Jackman <jackmanb@google.com>
---
mm/.kunitconfig | 2 ++
mm/Kconfig | 8 ++++++++
mm/Makefile | 2 ++
mm/page_alloc_test.c | 21 +++++++++++++++++++++
4 files changed, 33 insertions(+)
diff --git a/mm/.kunitconfig b/mm/.kunitconfig
new file mode 100644
index 0000000000000000000000000000000000000000..fcc28557fa1c1412b21f9dbddbf6a63adca6f2b4
--- /dev/null
+++ b/mm/.kunitconfig
@@ -0,0 +1,2 @@
+CONFIG_KUNIT=y
+CONFIG_PAGE_ALLOC_KUNIT_TEST=y
\ No newline at end of file
diff --git a/mm/Kconfig b/mm/Kconfig
index 1b501db064172cf54f1b1259893dfba676473c56..1fac51c536c66243a1321195a78eb40668386158 100644
--- a/mm/Kconfig
+++ b/mm/Kconfig
@@ -1358,6 +1358,14 @@ config PT_RECLAIM
Note: now only empty user PTE page table pages will be reclaimed.
+config PAGE_ALLOC_KUNIT_TEST
+ tristate "KUnit test for page allocator" if !KUNIT_ALL_TESTS
+ depends on KUNIT
+ default KUNIT_ALL_TESTS
+ help
+ Builds unit tests for page allocator.
+
+ If unsure, say N.
source "mm/damon/Kconfig"
diff --git a/mm/Makefile b/mm/Makefile
index 850386a67b3e0e3b543b27691a6512c448815697..7b8018e0e6510881fac6e4295fdd1472e38d743d 100644
--- a/mm/Makefile
+++ b/mm/Makefile
@@ -61,6 +61,8 @@ obj-y := filemap.o mempool.o oom_kill.o fadvise.o \
page-alloc-y := page_alloc.o
page-alloc-$(CONFIG_SHUFFLE_PAGE_ALLOCATOR) += shuffle.o
+obj-$(CONFIG_PAGE_ALLOC_KUNIT_TEST) += page_alloc_test.o
+
# Give 'memory_hotplug' its own module-parameter namespace
memory-hotplug-$(CONFIG_MEMORY_HOTPLUG) += memory_hotplug.o
diff --git a/mm/page_alloc_test.c b/mm/page_alloc_test.c
new file mode 100644
index 0000000000000000000000000000000000000000..377dfdd50a3c6928e15210cc87d5399c1db80da7
--- /dev/null
+++ b/mm/page_alloc_test.c
@@ -0,0 +1,21 @@
+// SPDX-License-Identifier: GPL-2.0-only
+#include <linux/errname.h>
+#include <linux/list.h>
+#include <linux/gfp.h>
+#include <linux/memory.h>
+#include <linux/nodemask.h>
+#include <linux/percpu.h>
+#include <linux/smp.h>
+
+#include <kunit/test.h>
+
+static struct kunit_case test_cases[] = { {} };
+
+static struct kunit_suite test_suite = {
+ .name = "page_alloc",
+ .test_cases = test_cases,
+};
+kunit_test_suite(test_suite);
+
+MODULE_LICENSE("GPL");
+MODULE_IMPORT_NS("EXPORTED_FOR_KUNIT_TESTING");
--
2.48.1.601.g30ceb7b040-goog
next prev parent reply other threads:[~2025-02-24 14:47 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-24 14:47 [PATCH RFC 0/4] mm: KUnit tests for the page allocator Brendan Jackman
2025-02-24 14:47 ` [PATCH RFC 1/4] kunit: Allocate assertion data with GFP_ATOMIC Brendan Jackman
2025-02-24 14:47 ` Brendan Jackman [this message]
2025-02-24 14:47 ` [PATCH RFC 3/4] mm/page_alloc_test: Add logic to isolate a node for testing Brendan Jackman
2025-02-24 18:33 ` Yosry Ahmed
2025-02-25 11:20 ` Brendan Jackman
2025-02-26 10:33 ` Brendan Jackman
2025-02-24 14:47 ` [PATCH RFC 4/4] mm/page_alloc_test: Add smoke-test for page allocation Brendan Jackman
2025-02-24 18:26 ` Yosry Ahmed
2025-02-25 11:14 ` Brendan Jackman
2025-02-26 10:47 ` Brendan Jackman
2025-02-25 10:01 ` [PATCH RFC 0/4] mm: KUnit tests for the page allocator David Hildenbrand
2025-02-25 12:56 ` Brendan Jackman
2025-02-26 11:52 ` David Hildenbrand
2025-02-26 12:21 ` Brendan Jackman
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=20250224-page-alloc-kunit-v1-2-d337bb440889@google.com \
--to=jackmanb@google.com \
--cc=akpm@linux-foundation.org \
--cc=brendan.higgins@linux.dev \
--cc=david@redhat.com \
--cc=davidgow@google.com \
--cc=kunit-dev@googlegroups.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lorenzo.stoakes@oracle.com \
--cc=mhocko@kernel.org \
--cc=osalvador@suse.de \
--cc=rmoar@google.com \
--cc=vbabka@suse.cz \
--cc=yosry.ahmed@linux.dev \
/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