Skip to contentSkip to conversation

lib: make a test module with get_count_order/long

PATCH In review Wei Yang 4 participants 6 messages May 30, 2020 – Jun 2, 2020

Subsystems (2)
lore
Share & tools
lore

Wei Yang

author
#0 lore raw

PATCH 1/1 lib: make a test module with get_count_order/long

A test module to make sure get_count_order/long returns the correct result.

---
 lib/Kconfig.debug                  | 13 ++++++
 lib/Makefile                       |  2 +
 lib/test_getorder.c                | 64 ++++++++++++++++++++++++++++++
 tools/testing/selftests/lib/config |  1 +
 4 files changed, 80 insertions(+)
 create mode 100644 lib/test_getorder.c
lib/Kconfig.debug +13 -0
index c0ef216bb803..01e671151f42 100644
@@ -1999,6 +1999,19 @@ config TEST_BITOPS
 
 	  If unsure, say N.
 
+config TEST_GETORDER
+	tristate "Test module for compilation of get_count_order operations"
+	depends on m
+	help
+	  This builds the "test_getorder" module that is much like the
+	  TEST_LKM module except that it does a basic exercise of the
+	  get_count_order and get_count_order_long to make sure there are no
+	  compiler warnings from C=1 sparse checker or -Wextra compilations.
+	  It has no dependencies and doesn't run or load unless explicitly
+	  requested by name. For example: modprobe test_getorder.
+
+	  If unsure, say N.
+
 config TEST_VMALLOC
 	tristate "Test module for stress/performance analysis of vmalloc allocator"
 	default n
lib/Makefile +2 -0
index 0d942f7c7478..806d4df8f7c7 100644
@@ -81,6 +81,8 @@ obj-$(CONFIG_TEST_STATIC_KEYS) += test_static_keys.o
 obj-$(CONFIG_TEST_STATIC_KEYS) += test_static_key_base.o
 obj-$(CONFIG_TEST_BITOPS) += test_bitops.o
 CFLAGS_test_bitops.o += -Werror
+obj-$(CONFIG_TEST_GETORDER) += test_getorder.o
+CFLAGS_test_getorder.o += -Werror
 obj-$(CONFIG_TEST_PRINTF) += test_printf.o
 obj-$(CONFIG_TEST_BITMAP) += test_bitmap.o
 obj-$(CONFIG_TEST_STRSCPY) += test_strscpy.o
lib/test_getorder.c new file +64 -0

64 lines not on this page · raw message

tools/testing/selftests/lib/config +1 -0
index b80ee3f6e265..2ad467d34648 100644
@@ -3,3 +3,4 @@ CONFIG_TEST_BITMAP=m
 CONFIG_PRIME_NUMBERS=m
 CONFIG_TEST_STRSCPY=m
 CONFIG_TEST_BITOPS=m
+CONFIG_TEST_GETORDER=m
Signature · 1 line
2.23.0
#1 lore raw
Quoted 5 lines · Wei Yang

A test module to make sure get_count_order/long returns the correct result.

 lib/Kconfig.debug                  | 13 ++++++
 lib/Makefile                       |  2 +
 lib/test_getorder.c                | 64 ++++++++++++++++++++++++++++++

I didn't get why it's not a part of test_bitops?

Signature · 2 lines
With Best Regards,
Andy Shevchenko
author
#2 lore raw
Quoted 9 lines · Andy Shevchenko
Quoted 5 lines · Wei Yang

A test module to make sure get_count_order/long returns the correct result.

 lib/Kconfig.debug                  | 13 ++++++
 lib/Makefile                       |  2 +
 lib/test_getorder.c                | 64 ++++++++++++++++++++++++++++++

I didn't get why it's not a part of test_bitops?

I see the document of test_bitops says it does exercise on clear_bit and set_bit. So not sure it is proper to put them together.

Quoted 4 lines
Signature · 2 lines
With Best Regards,
Andy Shevchenko
Signature · 2 lines
Wei Yang
Help you, Help me
#3 lore raw
Quoted 8 lines · Wei Yang
Quoted 7 lines · Andy Shevchenko
Quoted 5 lines · Wei Yang

A test module to make sure get_count_order/long returns the correct result.

 lib/Kconfig.debug                  | 13 ++++++
 lib/Makefile                       |  2 +
 lib/test_getorder.c                | 64 ++++++++++++++++++++++++++++++
Quoted 5 lines
Quoted 2 lines

I didn't get why it's not a part of test_bitops?

I see the document of test_bitops says it does exercise on clear_bit and set_bit. So not sure it is proper to put them together.

It's not a problem to amend a documentation as well :-)

Signature · 2 lines
With Best Regards,
Andy Shevchenko
author
#4 lore raw
Quoted 9 lines · Andy Shevchenko
Quoted 8 lines · Wei Yang
Quoted 7 lines · Andy Shevchenko
Quoted 5 lines · Wei Yang

A test module to make sure get_count_order/long returns the correct result.

 lib/Kconfig.debug                  | 13 ++++++
 lib/Makefile                       |  2 +
 lib/test_getorder.c                | 64 ++++++++++++++++++++++++++++++
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

I didn't get why it's not a part of test_bitops?

I see the document of test_bitops says it does exercise on clear_bit and set_bit. So not sure it is proper to put them together.

It's not a problem to amend a documentation as well :-)

Sure. I am fine with this.

Andrew, do you expect me to merge it into test_bitops.c?

Quoted 3 lines
Signature · 2 lines
With Best Regards,
Andy Shevchenko
Signature · 2 lines
Wei Yang
Help you, Help me
maintainer
#5 lore raw
Quoted 16 lines · On Sun, 31 May 2020 12:47:09 +0000 Wei Yang <[email protected]> wrote:
Quoted 15 lines · Andy Shevchenko
Quoted 13 lines · Wei Yang
Quoted 9 lines · Andy Shevchenko
Quoted 5 lines · Wei Yang

A test module to make sure get_count_order/long returns the correct result.

 lib/Kconfig.debug                  | 13 ++++++
 lib/Makefile                       |  2 +
 lib/test_getorder.c                | 64 ++++++++++++++++++++++++++++++

I didn't get why it's not a part of test_bitops?

I see the document of test_bitops says it does exercise on clear_bit and set_bit. So not sure it is proper to put them together.

Quoted 7 lines
Quoted 2 lines

It's not a problem to amend a documentation as well :-)

Sure. I am fine with this.

Andrew, do you expect me to merge it into test_bitops.c?

Yes please.