Re: [PATCH v3 1/4] kunit: Always run cleanup from a test kthread

From: kernel test robot
Date: Fri Apr 21 2023 - 03:07:17 EST


Hi David,

kernel test robot noticed the following build warnings:

[auto build test WARNING on linus/master]
[also build test WARNING on v6.3-rc7 next-20230420]
[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#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/David-Gow/Documentation-kunit-Note-that-assertions-should-not-be-used-in-cleanup/20230421-120437
patch link: https://lore.kernel.org/r/20230421040218.2156548-1-davidgow%40google.com
patch subject: [PATCH v3 1/4] kunit: Always run cleanup from a test kthread
config: x86_64-allyesconfig (https://download.01.org/0day-ci/archive/20230421/202304211445.r8UQGW3F-lkp@xxxxxxxxx/config)
compiler: gcc-11 (Debian 11.3.0-8) 11.3.0
reproduce (this is a W=1 build):
# https://github.com/intel-lab-lkp/linux/commit/e6f2b343739c4656e2090449ad7eac10db57dde9
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review David-Gow/Documentation-kunit-Note-that-assertions-should-not-be-used-in-cleanup/20230421-120437
git checkout e6f2b343739c4656e2090449ad7eac10db57dde9
# save the config file
mkdir build_dir && cp config build_dir/.config
make W=1 O=build_dir ARCH=x86_64 olddefconfig
make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash lib/kunit/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Link: https://lore.kernel.org/oe-kbuild-all/202304211445.r8UQGW3F-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

lib/kunit/test.c: In function 'kunit_catch_run_case':
>> lib/kunit/test.c:440:29: warning: unused variable 'suite' [-Wunused-variable]
440 | struct kunit_suite *suite = ctx->suite;
| ^~~~~


vim +/suite +440 lib/kunit/test.c

e6f2b343739c46 David Gow 2023-04-21 434
e6f2b343739c46 David Gow 2023-04-21 435
5f3e06208920ee Brendan Higgins 2019-09-23 436 static void kunit_catch_run_case(void *data)
5f3e06208920ee Brendan Higgins 2019-09-23 437 {
5f3e06208920ee Brendan Higgins 2019-09-23 438 struct kunit_try_catch_context *ctx = data;
5f3e06208920ee Brendan Higgins 2019-09-23 439 struct kunit *test = ctx->test;
5f3e06208920ee Brendan Higgins 2019-09-23 @440 struct kunit_suite *suite = ctx->suite;
5f3e06208920ee Brendan Higgins 2019-09-23 441 int try_exit_code = kunit_try_catch_get_result(&test->try_catch);
5f3e06208920ee Brendan Higgins 2019-09-23 442
5f3e06208920ee Brendan Higgins 2019-09-23 443 if (try_exit_code) {
5f3e06208920ee Brendan Higgins 2019-09-23 444 kunit_set_failure(test);
5f3e06208920ee Brendan Higgins 2019-09-23 445 /*
5f3e06208920ee Brendan Higgins 2019-09-23 446 * Test case could not finish, we have no idea what state it is
5f3e06208920ee Brendan Higgins 2019-09-23 447 * in, so don't do clean up.
5f3e06208920ee Brendan Higgins 2019-09-23 448 */
5f3e06208920ee Brendan Higgins 2019-09-23 449 if (try_exit_code == -ETIMEDOUT) {
5f3e06208920ee Brendan Higgins 2019-09-23 450 kunit_err(test, "test case timed out\n");
5f3e06208920ee Brendan Higgins 2019-09-23 451 /*
5f3e06208920ee Brendan Higgins 2019-09-23 452 * Unknown internal error occurred preventing test case from
5f3e06208920ee Brendan Higgins 2019-09-23 453 * running, so there is nothing to clean up.
5f3e06208920ee Brendan Higgins 2019-09-23 454 */
5f3e06208920ee Brendan Higgins 2019-09-23 455 } else {
5f3e06208920ee Brendan Higgins 2019-09-23 456 kunit_err(test, "internal error occurred preventing test case from running: %d\n",
5f3e06208920ee Brendan Higgins 2019-09-23 457 try_exit_code);
5f3e06208920ee Brendan Higgins 2019-09-23 458 }
5f3e06208920ee Brendan Higgins 2019-09-23 459 return;
5f3e06208920ee Brendan Higgins 2019-09-23 460 }
5f3e06208920ee Brendan Higgins 2019-09-23 461 }
5f3e06208920ee Brendan Higgins 2019-09-23 462

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests