Re: [PATCH] kunit: Print test statistics on failure

From: kernel test robot
Date: Fri Dec 11 2020 - 15:25:52 EST


Hi David,

I love your patch! Yet something to improve:

[auto build test ERROR on 5f6b99d0287de2c2d0b5e7abcb0092d553ad804a]

url: https://github.com/0day-ci/linux/commits/David-Gow/kunit-Print-test-statistics-on-failure/20201211-153009
base: 5f6b99d0287de2c2d0b5e7abcb0092d553ad804a
config: c6x-randconfig-r004-20201210 (attached as .config)
compiler: c6x-elf-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
# https://github.com/0day-ci/linux/commit/2bdf1b55a1b3673a1a02f71457fc52b497fc7223
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review David-Gow/kunit-Print-test-statistics-on-failure/20201211-153009
git checkout 2bdf1b55a1b3673a1a02f71457fc52b497fc7223
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=c6x

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All errors (new ones prefixed by >>):

>> lib/kunit/test.c:27:53: error: expected ')' before 'int'
27 | core_param(kunit_stats_enabled, kunit_stats_enabled, int, 0644);
| ^~~~
| )
In file included from lib/kunit/test.c:9:
lib/kunit/test.c: In function 'kunit_print_test_stats':
include/linux/kern_levels.h:5:18: warning: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'size_t' {aka 'unsigned int'} [-Wformat=]
5 | #define KERN_SOH "\001" /* ASCII Start Of Header */
| ^~~~~~
include/kunit/test.h:621:10: note: in definition of macro 'kunit_log'
621 | printk(lvl fmt, ##__VA_ARGS__); \
| ^~~
include/linux/kern_levels.h:14:19: note: in expansion of macro 'KERN_SOH'
14 | #define KERN_INFO KERN_SOH "6" /* informational */
| ^~~~~~~~
lib/kunit/test.c:46:12: note: in expansion of macro 'KERN_INFO'
46 | kunit_log(KERN_INFO, test,
| ^~~~~~~~~
lib/kunit/test.c:48:14: note: format string is defined here
48 | "# %s: %lu / %lu test parameters failed",
| ~~^
| |
| long unsigned int
| %u
In file included from lib/kunit/test.c:9:
include/linux/kern_levels.h:5:18: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'size_t' {aka 'unsigned int'} [-Wformat=]
5 | #define KERN_SOH "\001" /* ASCII Start Of Header */
| ^~~~~~
include/kunit/test.h:621:10: note: in definition of macro 'kunit_log'
621 | printk(lvl fmt, ##__VA_ARGS__); \
| ^~~
include/linux/kern_levels.h:14:19: note: in expansion of macro 'KERN_SOH'
14 | #define KERN_INFO KERN_SOH "6" /* informational */
| ^~~~~~~~
lib/kunit/test.c:46:12: note: in expansion of macro 'KERN_INFO'
46 | kunit_log(KERN_INFO, test,
| ^~~~~~~~~
lib/kunit/test.c:48:20: note: format string is defined here
48 | "# %s: %lu / %lu test parameters failed",
| ~~^
| |
| long unsigned int
| %u
lib/kunit/test.c: In function 'kunit_log_append':
lib/kunit/test.c:72:2: warning: function 'kunit_log_append' might be a candidate for 'gnu_printf' format attribute [-Wsuggest-attribute=format]
72 | vsnprintf(line, sizeof(line), fmt, args);
| ^~~~~~~~~
In file included from lib/kunit/test.c:9:
lib/kunit/test.c: In function 'kunit_print_suite_stats':
include/linux/kern_levels.h:5:18: warning: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'size_t' {aka 'unsigned int'} [-Wformat=]
5 | #define KERN_SOH "\001" /* ASCII Start Of Header */
| ^~~~~~
include/kunit/test.h:621:10: note: in definition of macro 'kunit_log'
621 | printk(lvl fmt, ##__VA_ARGS__); \
| ^~~
include/linux/kern_levels.h:14:19: note: in expansion of macro 'KERN_SOH'
14 | #define KERN_INFO KERN_SOH "6" /* informational */
| ^~~~~~~~
lib/kunit/test.c:394:12: note: in expansion of macro 'KERN_INFO'
394 | kunit_log(KERN_INFO, suite,
| ^~~~~~~~~
lib/kunit/test.c:395:15: note: format string is defined here
395 | "# %s: (%lu / %lu) tests failed (%lu / %lu test parameters)",
| ~~^
| |
| long unsigned int
| %u
In file included from lib/kunit/test.c:9:
include/linux/kern_levels.h:5:18: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'size_t' {aka 'unsigned int'} [-Wformat=]
5 | #define KERN_SOH "\001" /* ASCII Start Of Header */
| ^~~~~~
include/kunit/test.h:621:10: note: in definition of macro 'kunit_log'
621 | printk(lvl fmt, ##__VA_ARGS__); \
| ^~~
include/linux/kern_levels.h:14:19: note: in expansion of macro 'KERN_SOH'
14 | #define KERN_INFO KERN_SOH "6" /* informational */
| ^~~~~~~~
lib/kunit/test.c:394:12: note: in expansion of macro 'KERN_INFO'
394 | kunit_log(KERN_INFO, suite,
| ^~~~~~~~~
lib/kunit/test.c:395:21: note: format string is defined here
395 | "# %s: (%lu / %lu) tests failed (%lu / %lu test parameters)",
| ~~^
| |
| long unsigned int
| %u
In file included from lib/kunit/test.c:9:
include/linux/kern_levels.h:5:18: warning: format '%lu' expects argument of type 'long unsigned int', but argument 5 has type 'size_t' {aka 'unsigned int'} [-Wformat=]
5 | #define KERN_SOH "\001" /* ASCII Start Of Header */
| ^~~~~~
include/kunit/test.h:621:10: note: in definition of macro 'kunit_log'
621 | printk(lvl fmt, ##__VA_ARGS__); \
| ^~~
include/linux/kern_levels.h:14:19: note: in expansion of macro 'KERN_SOH'
14 | #define KERN_INFO KERN_SOH "6" /* informational */
| ^~~~~~~~
lib/kunit/test.c:394:12: note: in expansion of macro 'KERN_INFO'
394 | kunit_log(KERN_INFO, suite,
| ^~~~~~~~~
lib/kunit/test.c:395:40: note: format string is defined here
395 | "# %s: (%lu / %lu) tests failed (%lu / %lu test parameters)",

vim +27 lib/kunit/test.c

19
20 /*
21 * KUnit statistic mode:
22 * 0 - disabled
23 * 1 - only when there is at least one failure, and more than one subtest
24 * 2 - enabled
25 */
26 static int kunit_stats_enabled = 1;
> 27 core_param(kunit_stats_enabled, kunit_stats_enabled, int, 0644);
28

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip