Skip to contentSkip to conversation

unicode: implement utf8 unit tests as a KUnit test suite.

PATCH Applied Ricardo Cañuelo 2 participants 2 messages Apr 16, 2020 – Apr 19, 2020

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

PATCH v2 1/1 unicode: implement utf8 unit tests as a KUnit test suite.

This translates the existing utf8 unit test module into a KUnit-compliant test suite. No functionality has been added or removed.

Some names changed to make the file name, the Kconfig option and test suite name less specific, since this source file might hold more utf8 tests in the future.

---
Changes in v2:
- Subject line
- Code style fixes
- Kconfig option description and help text
- All kunit references in documentation and Kconfig properly capitalized
- Unicode version string now generated at compile time

Tested with kunit_tool and at boot time on qemu-system-x86_64

 fs/unicode/Kconfig                          |  19 +-
 fs/unicode/Makefile                         |   2 +-
 fs/unicode/{utf8-selftest.c => utf8-test.c} | 199 +++++++++-----------
 3 files changed, 108 insertions(+), 112 deletions(-)
 rename fs/unicode/{utf8-selftest.c => utf8-test.c} (60%)
fs/unicode/Kconfig +16 -3
index 2c27b9a5cd6c..a8865891c3bd 100644
@@ -8,7 +8,20 @@ config UNICODE
 	  Say Y here to enable UTF-8 NFD normalization and NFD+CF casefolding
 	  support.
 
-config UNICODE_NORMALIZATION_SELFTEST
-	tristate "Test UTF-8 normalization support"
-	depends on UNICODE
+config UNICODE_KUNIT_TESTS
+	bool "KUnit tests for Unicode normalization and casefolding support"
+	depends on UNICODE && KUNIT
 	default n
+	help
+	  This builds the KUnit test suite for Unicode normalization and
+	  casefolding support.
+
+	  KUnit tests run during boot and output the results to the debug log
+	  in TAP format (http://testanything.org/). Only useful for kernel devs
+	  running KUnit test harness and are not for inclusion into a production
+	  build.
+
+	  For more information on KUnit and unit tests in general please refer
+	  to the KUnit documentation in Documentation/dev-tools/kunit/.
+
+	  If unsure, say N.
fs/unicode/Makefile +1 -1
index b88aecc86550..0e8e2192a715 100644
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0
 
 obj-$(CONFIG_UNICODE) += unicode.o
-obj-$(CONFIG_UNICODE_NORMALIZATION_SELFTEST) += utf8-selftest.o
+obj-$(CONFIG_UNICODE_KUNIT_TESTS) += utf8-test.o
 
 unicode-y := utf8-norm.o utf8-core.o
 
fs/unicode/utf8-test.c renamed from fs/unicode/utf8-selftest.c +91 -108

280 lines not on this page · raw message

Signature · 1 line
2.18.0
#1 lore raw
Quoted 8 lines · Ricardo Cañuelo

This translates the existing utf8 unit test module into a KUnit-compliant test suite. No functionality has been added or removed.

Some names changed to make the file name, the Kconfig option and test suite name less specific, since this source file might hold more utf8 tests in the future.

Thanks, applied with a small checkpatch.pl fix.

Signature · 1 line
Gabriel Krisman Bertazi