Skip to contentSkip to conversation

lib: Convert test_uuid.c to KUnit

PATCH In review Arpitha Raghunandan 2 participants 2 messages Aug 3, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 lib: Convert test_uuid.c to KUnit

Converts test lib/test_uuid.c to KUnit.
More information about KUnit can be found at
https://www.kernel.org/doc/html/latest/dev-tools/kunit/index.html.
This change is beneficial as KUnit provides a common framework for unit tests in the kernel. KUnit is fast as well.

---
Changes v1->v2:
- Add a more detailed commit message

 lib/Kconfig.debug                 |  7 +--
 lib/Makefile                      |  2 +-
 lib/{test_uuid.c => uuid_kunit.c} | 84 +++++++++----------------------
 3 files changed, 28 insertions(+), 65 deletions(-)
 rename lib/{test_uuid.c => uuid_kunit.c} (48%)
lib/Kconfig.debug +4 -3
index f174f8887ae7..330c0d1de50b 100644
@@ -2070,9 +2070,6 @@ config TEST_BITFIELD
 
 	  If unsure, say N.
 
-config TEST_UUID
-	tristate "Test functions located in the uuid module at runtime"
-
 config TEST_XARRAY
 	tristate "Test the XArray code at runtime"
 
@@ -2273,6 +2270,10 @@ config BITS_TEST
 
 	  If unsure, say N.
 
+config UUID_KUNIT_TEST
+	tristate "KUnit test for functions located in the uuid module at runtime"
+	depends on KUNIT
+
 config TEST_UDELAY
 	tristate "udelay test driver"
 	help
lib/Makefile +1 -1
index 032cc6c71a3a..62ef383c7563 100644
@@ -81,7 +81,6 @@ obj-$(CONFIG_TEST_PRINTF) += test_printf.o
 obj-$(CONFIG_TEST_BITMAP) += test_bitmap.o
 obj-$(CONFIG_TEST_STRSCPY) += test_strscpy.o
 obj-$(CONFIG_TEST_BITFIELD) += test_bitfield.o
-obj-$(CONFIG_TEST_UUID) += test_uuid.o
 obj-$(CONFIG_TEST_XARRAY) += test_xarray.o
 obj-$(CONFIG_TEST_PARMAN) += test_parman.o
 obj-$(CONFIG_TEST_KMOD) += test_kmod.o
@@ -342,5 +341,6 @@ obj-$(CONFIG_PLDMFW) += pldmfw/
 obj-$(CONFIG_LIST_KUNIT_TEST) += list-test.o
 obj-$(CONFIG_LINEAR_RANGES_TEST) += test_linear_ranges.o
 obj-$(CONFIG_BITS_TEST) += test_bits.o
+obj-$(CONFIG_UUID_KUNIT_TEST) += uuid_kunit.o
 
 obj-$(CONFIG_GENERIC_LIB_DEVMEM_IS_ALLOWED) += devmem_is_allowed.o
lib/uuid_kunit.c renamed from lib/test_uuid.c +23 -61

124 lines not on this page · raw message

Signature · 1 line
2.25.1
Reviewed-by on v2 1/1
#1 lore raw
Quoted 8 lines · Arpitha Raghunandan

Converts test lib/test_uuid.c to KUnit.
More information about KUnit can be found at
https://www.kernel.org/doc/html/latest/dev-tools/kunit/index.html.
This change is beneficial as KUnit provides a common framework for unit tests in the kernel. KUnit is fast as well.

Thanks!
_______________________________________________
Linux-kernel-mentees mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees