[linux-next:master 5507/6266] ../kselftest_harness.h:1167:9: warning: ignoring return value of 'asprintf' declared with attribute 'warn_unused_result'

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

 



tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   6bd343537461b57f3efe5dfc5fc193a232dfef1e
commit: c19377e23d4cb45f69c5d226ae3436f7fa818c8f [5507/6266] selftests/harness: remove use of LINE_MAX
compiler: gcc-13 (Ubuntu 13.2.0-4ubuntu3) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240416/202404161023.K0EsnDmF-lkp@xxxxxxxxx/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <yujie.liu@xxxxxxxxx>
| Closes: https://lore.kernel.org/r/202404161023.K0EsnDmF-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

   In file included from tls.c:24:
   ../kselftest_harness.h: In function '__run_test':
>> ../kselftest_harness.h:1167:9: warning: ignoring return value of 'asprintf' declared with attribute 'warn_unused_result' [-Wunused-result]
    1167 |         asprintf(&test_name, "%s%s%s.%s", f->name,
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    1168 |                  variant->name[0] ? "." : "", variant->name, t->name);
         |                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
--
   In file included from include/kvm_test_harness.h:11,
                    from x86_64/fix_hypercall_test.c:12:
   ../kselftest_harness.h: In function '__run_test':
>> ../kselftest_harness.h:1167:9: warning: ignoring return value of 'asprintf' declared with attribute 'warn_unused_result' [-Wunused-result]
    1167 |         asprintf(&test_name, "%s%s%s.%s", f->name,
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    1168 |                  variant->name[0] ? "." : "", variant->name, t->name);
         |                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


vim +1167 tools/testing/selftests/net/../kselftest_harness.h

65177e47d3035c tools/testing/selftests/kselftest_harness.h    Jakub Kicinski   2023-01-25  1153  
142aca6b388c8a tools/testing/selftests/kselftest_harness.h    Jakub Kicinski   2020-04-27  1154  void __run_test(struct __fixture_metadata *f,
74bc7c97fa88ae tools/testing/selftests/kselftest_harness.h    Jakub Kicinski   2020-04-27  1155  		struct __fixture_variant_metadata *variant,
142aca6b388c8a tools/testing/selftests/kselftest_harness.h    Jakub Kicinski   2020-04-27  1156  		struct __test_metadata *t)
f46f576280595f tools/testing/selftests/kselftest_harness.h    Kees Cook        2020-03-13  1157  {
2709473c938602 tools/testing/selftests/kselftest_harness.h    Jakub Kicinski   2024-02-28  1158  	struct __test_xfail *xfail;
c19377e23d4cb4 tools/testing/selftests/kselftest_harness.h    Edward Liaw      2024-04-11  1159  	char *test_name;
fa1a53d83674b3 tools/testing/selftests/kselftest_harness.h    Jakub Kicinski   2024-02-28  1160  	const char *diagnostic;
38c957f0703827 tools/testing/selftests/kselftest_harness.h    Jakub Kicinski   2024-02-28  1161  
74bc7c97fa88ae tools/testing/selftests/kselftest_harness.h    Jakub Kicinski   2020-04-27  1162  	/* reset test struct */
69fe8ec4f673b5 tools/testing/selftests/kselftest_harness.h    Jakub Kicinski   2024-02-28  1163  	t->exit_code = KSFT_PASS;
f46f576280595f tools/testing/selftests/kselftest_harness.h    Kees Cook        2020-03-13  1164  	t->trigger = 0;
0ef67a888375b0 tools/testing/selftests/kselftest_harness.h    Kees Cook        2020-06-22  1165  	memset(t->results->reason, 0, sizeof(t->results->reason));
74bc7c97fa88ae tools/testing/selftests/kselftest_harness.h    Jakub Kicinski   2020-04-27  1166  
c19377e23d4cb4 tools/testing/selftests/kselftest_harness.h    Edward Liaw      2024-04-11 @1167  	asprintf(&test_name, "%s%s%s.%s", f->name,
c19377e23d4cb4 tools/testing/selftests/kselftest_harness.h    Edward Liaw      2024-04-11  1168  	         variant->name[0] ? "." : "", variant->name, t->name);
c8bd596f9388bc tools/testing/selftests/kselftest_harness.h    Michael Ellerman 2020-09-17  1169  
38c957f0703827 tools/testing/selftests/kselftest_harness.h    Jakub Kicinski   2024-02-28  1170  	ksft_print_msg(" RUN           %s ...\n", test_name);
38c957f0703827 tools/testing/selftests/kselftest_harness.h    Jakub Kicinski   2024-02-28  1171  
c8bd596f9388bc tools/testing/selftests/kselftest_harness.h    Michael Ellerman 2020-09-17  1172  	/* Make sure output buffers are flushed before fork */
c8bd596f9388bc tools/testing/selftests/kselftest_harness.h    Michael Ellerman 2020-09-17  1173  	fflush(stdout);
c8bd596f9388bc tools/testing/selftests/kselftest_harness.h    Michael Ellerman 2020-09-17  1174  	fflush(stderr);
c8bd596f9388bc tools/testing/selftests/kselftest_harness.h    Michael Ellerman 2020-09-17  1175  
f46f576280595f tools/testing/selftests/kselftest_harness.h    Kees Cook        2020-03-13  1176  	t->pid = fork();
f46f576280595f tools/testing/selftests/kselftest_harness.h    Kees Cook        2020-03-13  1177  	if (t->pid < 0) {
e80068be21824e tools/testing/selftests/kselftest_harness.h    Kees Cook        2020-06-22  1178  		ksft_print_msg("ERROR SPAWNING TEST CHILD\n");
69fe8ec4f673b5 tools/testing/selftests/kselftest_harness.h    Jakub Kicinski   2024-02-28  1179  		t->exit_code = KSFT_FAIL;
f46f576280595f tools/testing/selftests/kselftest_harness.h    Kees Cook        2020-03-13  1180  	} else if (t->pid == 0) {
92d25637a3a459 tools/testing/selftests/kselftest_harness.h    Li Zhijian       2021-12-17  1181  		setpgrp();
74bc7c97fa88ae tools/testing/selftests/kselftest_harness.h    Jakub Kicinski   2020-04-27  1182  		t->fn(t, variant);
796a344fa4315f tools/testing/selftests/kselftest_harness.h    Jakub Kicinski   2024-02-28  1183  		_exit(t->exit_code);
f46f576280595f tools/testing/selftests/kselftest_harness.h    Kees Cook        2020-03-13  1184  	} else {
f46f576280595f tools/testing/selftests/kselftest_harness.h    Kees Cook        2020-03-13  1185  		__wait_for_test(t);
f46f576280595f tools/testing/selftests/kselftest_harness.h    Kees Cook        2020-03-13  1186  	}
38c957f0703827 tools/testing/selftests/kselftest_harness.h    Jakub Kicinski   2024-02-28  1187  	ksft_print_msg("         %4s  %s\n",
69fe8ec4f673b5 tools/testing/selftests/kselftest_harness.h    Jakub Kicinski   2024-02-28  1188  		       __test_passed(t) ? "OK" : "FAIL", test_name);
9847d24af95c7f tools/testing/selftests/kselftest_harness.h    Kees Cook        2020-06-22  1189  
2709473c938602 tools/testing/selftests/kselftest_harness.h    Jakub Kicinski   2024-02-28  1190  	/* Check if we're expecting this test to fail */
2709473c938602 tools/testing/selftests/kselftest_harness.h    Jakub Kicinski   2024-02-28  1191  	for (xfail = variant->xfails; xfail; xfail = xfail->next)
2709473c938602 tools/testing/selftests/kselftest_harness.h    Jakub Kicinski   2024-02-28  1192  		if (xfail->test == t)
2709473c938602 tools/testing/selftests/kselftest_harness.h    Jakub Kicinski   2024-02-28  1193  			break;
2709473c938602 tools/testing/selftests/kselftest_harness.h    Jakub Kicinski   2024-02-28  1194  	if (xfail)
2709473c938602 tools/testing/selftests/kselftest_harness.h    Jakub Kicinski   2024-02-28  1195  		t->exit_code = __test_passed(t) ? KSFT_XPASS : KSFT_XFAIL;
2709473c938602 tools/testing/selftests/kselftest_harness.h    Jakub Kicinski   2024-02-28  1196  
fa1a53d83674b3 tools/testing/selftests/kselftest_harness.h    Jakub Kicinski   2024-02-28  1197  	if (t->results->reason[0])
fa1a53d83674b3 tools/testing/selftests/kselftest_harness.h    Jakub Kicinski   2024-02-28  1198  		diagnostic = t->results->reason;
378193eff3399a tools/testing/selftests/kselftest_harness.h    Jakub Kicinski   2024-02-28  1199  	else if (t->exit_code == KSFT_PASS || t->exit_code == KSFT_FAIL)
378193eff3399a tools/testing/selftests/kselftest_harness.h    Jakub Kicinski   2024-02-28  1200  		diagnostic = NULL;
fa1a53d83674b3 tools/testing/selftests/kselftest_harness.h    Jakub Kicinski   2024-02-28  1201  	else
fa1a53d83674b3 tools/testing/selftests/kselftest_harness.h    Jakub Kicinski   2024-02-28  1202  		diagnostic = "unknown";
fa1a53d83674b3 tools/testing/selftests/kselftest_harness.h    Jakub Kicinski   2024-02-28  1203  
732e2035280bf4 tools/testing/selftests/kselftest_harness.h    Jakub Kicinski   2024-02-28  1204  	ksft_test_result_code(t->exit_code, test_name,
378193eff3399a tools/testing/selftests/kselftest_harness.h    Jakub Kicinski   2024-02-28  1205  			      diagnostic ? "%s" : "", diagnostic);
c19377e23d4cb4 tools/testing/selftests/kselftest_harness.h    Edward Liaw      2024-04-11  1206  	free(test_name);
c99ee51a9d9716 tools/testing/selftests/seccomp/test_harness.h Kees Cook        2015-06-16  1207  }
c99ee51a9d9716 tools/testing/selftests/seccomp/test_harness.h Kees Cook        2015-06-16  1208  

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





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux