Skip to contentSkip to conversation

lib: add CONFIG_TEST_SORT to enable self-test of sort()

PATCH New [email protected] 1 participant 1 message Feb 24, 2017 Library code

lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

PATCH 112/124 lib: add CONFIG_TEST_SORT to enable self-test of sort()

From: Kostenzer Felix <[email protected]>
Subject: lib: add CONFIG_TEST_SORT to enable self-test of sort()

Along with the addition made to Kconfig.debug, the prior existing but permanently disabled test function has been slightly refactored.

Patch has been tested using QEMU 2.1.2 with a .config obtained through 'make defconfig' (x86_64) and manually enabling the option.

---

 lib/Kconfig.debug |    8 ++++++++
 lib/Makefile      |    1 +
 lib/sort.c        |   41 ++---------------------------------------
 lib/test_sort.c   |   43 +++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 54 insertions(+), 39 deletions(-)
lib/Kconfig.debug renamed from lib/Kconfig.debug~lib-add-config_test_sort-to-enable-self-test-of-sort +8 -0
diff -puN lib/Kconfig.debug~lib-add-config_test_sort-to-enable-self-test-of-sort lib/Kconfig.debug
@@ -1739,6 +1739,14 @@ config TEST_LIST_SORT
 
 	  If unsure, say N.
 
+config TEST_SORT
+	bool "Array-based sort test"
+	depends on DEBUG_KERNEL
+	help
+	  This option enables the self-test function of 'sort()' at boot.
+
+	  If unsure, say N.
+
 config KPROBES_SANITY_TEST
 	bool "Kprobes sanity tests"
 	depends on DEBUG_KERNEL
lib/Makefile renamed from lib/Makefile~lib-add-config_test_sort-to-enable-self-test-of-sort +1 -0
diff -puN lib/Makefile~lib-add-config_test_sort-to-enable-self-test-of-sort lib/Makefile
@@ -50,6 +50,7 @@ obj-$(CONFIG_TEST_KASAN) += test_kasan.o
 obj-$(CONFIG_TEST_KSTRTOX) += test-kstrtox.o
 obj-$(CONFIG_TEST_LKM) += test_module.o
 obj-$(CONFIG_TEST_RHASHTABLE) += test_rhashtable.o
+obj-$(CONFIG_TEST_SORT) += test_sort.o
 obj-$(CONFIG_TEST_USER_COPY) += test_user_copy.o
 obj-$(CONFIG_TEST_STATIC_KEYS) += test_static_keys.o
 obj-$(CONFIG_TEST_STATIC_KEYS) += test_static_key_base.o
lib/sort.c renamed from lib/sort.c~lib-add-config_test_sort-to-enable-self-test-of-sort +2 -39

50 lines not on this page · raw message

lib/test_sort.c new file +43 -0

43 lines not on this page · raw message

_