Re: [PATCH] lib: add basic KUnit test for lib/math

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Daniel,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on 7cf726a59435301046250c42131554d9ccc566b8]

url:    https://github.com/0day-ci/linux/commits/Daniel-Latypov/lib-add-basic-KUnit-test-for-lib-math/20201020-064737
base:    7cf726a59435301046250c42131554d9ccc566b8
config: nds32-allyesconfig (attached as .config)
compiler: nds32le-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
        # https://github.com/0day-ci/linux/commit/e268c8ae297dc311e5deb6b25daad9a2f88309ba
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Daniel-Latypov/lib-add-basic-KUnit-test-for-lib-math/20201020-064737
        git checkout e268c8ae297dc311e5deb6b25daad9a2f88309ba
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=nds32 

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

All warnings (new ones prefixed by >>):

   lib/math/math_test.c: In function 'int_sqrt_test':
>> lib/math/math_test.c:137:13: warning: right shift count >= width of type [-Wshift-count-overflow]
     137 |    .a = 1UL >> 32,
         |             ^~

vim +137 lib/math/math_test.c

   109	
   110	static void int_sqrt_test(struct kunit *test)
   111	{
   112		const char *message_fmt = "sqrt(%lu)";
   113		int i;
   114	
   115		struct test_case test_cases[] = {
   116			{
   117				.a = 0,
   118				.result = 0,
   119			},
   120			{
   121				.a = 1,
   122				.result = 1,
   123			},
   124			{
   125				.a = 4,
   126				.result = 2,
   127			},
   128			{
   129				.a = 5,
   130				.result = 2,
   131			},
   132			{
   133				.a = 8,
   134				.result = 2,
   135			},
   136			{
 > 137				.a = 1UL >> 32,
   138				.result = 1UL >> 16,
   139			},
   140		};
   141	
   142		for (i = 0; i < ARRAY_SIZE(test_cases); ++i) {
   143			KUNIT_EXPECT_EQ_MSG(test, int_sqrt(test_cases[i].a),
   144					    test_cases[i].result, message_fmt,
   145					    test_cases[i].a);
   146		}
   147	}
   148	

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

Attachment: .config.gz
Description: application/gzip


[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux