[PATCH RFC 2/4] mm/page_alloc_test: Add empty KUnit boilerplate

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Add the Kbuild plumbing to create a new KUnit suite. Create the suite,
with no tests inside it.

Signed-off-by: Brendan Jackman <jackmanb@xxxxxxxxxx>
---
 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





[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux