lib: Convert test_hexdump.c to KUnit
Subsystems (2)
PATCH v2 1/1 lib: Convert test_hexdump.c to KUnit
Converts test lib/test_hexdump.c to KUnit.
More information about KUnit can be found at
https://www.kernel.org/doc/html/latest/dev-tools/kunit/index.html.
KUnit provides a common framework for unit tests in the kernel.
---
Changes v1->v2:
- Replace KUNIT_EXPECT_EQ() with KUNIT_EXPECT_EQ_MSG()
- Replace KUNIT_EXPECT_NE() with KUNIT_EXPECT_NE_MSG()
- Prints expected and real buffer values in case of test failure
lib/Kconfig.debug | 7 +-
lib/Makefile | 2 +-
lib/{test_hexdump.c => hexdump_kunit.c} | 85 ++++++++++---------------
3 files changed, 40 insertions(+), 54 deletions(-)
rename lib/{test_hexdump.c => hexdump_kunit.c} (74%)lib/Kconfig.debug +4 -3
@@ -2003,9 +2003,6 @@ config ASYNC_RAID6_TEST If unsure, say N. -config TEST_HEXDUMP - tristate "Test functions located in the hexdump module at runtime" - config TEST_STRING_HELPERS tristate "Test functions located in the string_helpers module at runtime"
@@ -2224,6 +2221,10 @@ config LINEAR_RANGES_TEST If unsure, say N. +config HEXDUMP_KUNIT_TEST + tristate "KUnit test for functions located in the hexdump module at runtime" + depends on KUNIT + config TEST_UDELAY tristate "udelay test driver" help
lib/Makefile +1 -1
@@ -53,7 +53,6 @@ obj-$(CONFIG_STRING_SELFTEST) += test_string.o obj-y += string_helpers.o obj-$(CONFIG_TEST_STRING_HELPERS) += test-string_helpers.o obj-y += hexdump.o -obj-$(CONFIG_TEST_HEXDUMP) += test_hexdump.o obj-y += kstrtox.o obj-$(CONFIG_FIND_BIT_BENCHMARK) += find_bit_benchmark.o obj-$(CONFIG_TEST_BPF) += test_bpf.o
@@ -345,3 +344,4 @@ obj-$(CONFIG_PLDMFW) += pldmfw/ # KUnit tests obj-$(CONFIG_LIST_KUNIT_TEST) += list-test.o obj-$(CONFIG_LINEAR_RANGES_TEST) += test_linear_ranges.o +obj-$(CONFIG_HEXDUMP_KUNIT_TEST) += hexdump_kunit.o
lib/hexdump_kunit.c renamed from lib/test_hexdump.c +35 -50
160 lines not on this page · raw message
Signature · 6 lines
2.25.1 _______________________________________________ Linux-kernel-mentees mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees
kernel test robot
build botThank you for the patch! Perhaps something to improve:
Hi Arpitha,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on linus/master]
[also build test WARNING on v5.8]
[cannot apply to next-20200807]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Arpitha-Raghunandan/lib-Convert-test_hexdump-c-to-KUnit/20200809-224612 base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 06a81c1c7db9bd5de0bd38cd5acc44bb22b99150 config: xtensa-allmodconfig (attached as .config) compiler: xtensa-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=xtensa
If you fix the issue, kindly add following tag as appropriate
All warnings (new ones prefixed by >>, old ones prefixed by <<):
>> WARNING: modpost: lib/hexdump_kunit.o(.text+0xc): Section mismatch in reference from the (unknown reference) (unknown) to the variable .init.rodata:test_data_8_be
The function (unknown)() references
the variable __initconst test_data_8_be.
This is often because (unknown) lacks a __initconst annotation or the annotation of test_data_8_be is wrong.
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org