[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1570546546-549-3-git-send-email-alan.maguire@oracle.com>
Date: Tue, 8 Oct 2019 15:55:45 +0100
From: Alan Maguire <alan.maguire@...cle.com>
To: linux-kselftest@...r.kernel.org, brendanhiggins@...gle.com,
skhan@...uxfoundation.org
Cc: mcgrof@...nel.org, keescook@...omium.org, yzaikin@...gle.com,
akpm@...ux-foundation.org, yamada.masahiro@...ionext.com,
catalin.marinas@....com, joe.lawrence@...hat.com,
penguin-kernel@...ove.sakura.ne.jp, schowdary@...dia.com,
urezki@...il.com, andriy.shevchenko@...ux.intel.com,
changbin.du@...el.com, kunit-dev@...glegroups.com,
linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org,
Alan Maguire <alan.maguire@...cle.com>,
Knut Omang <knut.omang@...cle.com>
Subject: [PATCH v2 linux-kselftest-test 2/3] kunit: allow kunit to be loaded as a module
Making kunit itself buildable as a module allows for "always-on"
kunit configuration; specifying CONFIG_KUNIT=m means the module
is built but only used when loaded. Kunit test modules will load
kunit.ko as an implicit dependency, so simply running
"modprobe my-kunit-tests" will load the tests along with the kunit
module and run them.
Signed-off-by: Alan Maguire <alan.maguire@...cle.com>
Signed-off-by: Knut Omang <knut.omang@...cle.com>
---
lib/kunit/Kconfig | 2 +-
lib/kunit/Makefile | 4 +++-
lib/kunit/test.c | 4 ++++
3 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/lib/kunit/Kconfig b/lib/kunit/Kconfig
index 9ebd5e6..065aa16 100644
--- a/lib/kunit/Kconfig
+++ b/lib/kunit/Kconfig
@@ -3,7 +3,7 @@
#
menuconfig KUNIT
- bool "KUnit - Enable support for unit tests"
+ tristate "KUnit - Enable support for unit tests"
help
Enables support for kernel unit tests (KUnit), a lightweight unit
testing and mocking framework for the Linux kernel. These tests are
diff --git a/lib/kunit/Makefile b/lib/kunit/Makefile
index 769d940..8e2635a 100644
--- a/lib/kunit/Makefile
+++ b/lib/kunit/Makefile
@@ -1,4 +1,6 @@
-obj-$(CONFIG_KUNIT) += test.o \
+obj-$(CONFIG_KUNIT) += kunit.o
+
+kunit-objs += test.o \
string-stream.o \
assert.o \
try-catch.o
diff --git a/lib/kunit/test.c b/lib/kunit/test.c
index e7896f1..6024627 100644
--- a/lib/kunit/test.c
+++ b/lib/kunit/test.c
@@ -484,3 +484,7 @@ void kunit_cleanup(struct kunit *test)
}
}
EXPORT_SYMBOL_GPL(kunit_cleanup);
+
+#ifdef MODULE
+MODULE_LICENSE("GPL");
+#endif /* MODULE */
--
1.8.3.1
Powered by blists - more mailing lists