./../kselftest_harness.h:1152:30: error: format string is empty

From: kernel test robot
Date: Tue Apr 16 2024 - 23:12:27 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 96fca68c4fbf77a8185eb10f7557e23352732ea2
commit: 378193eff3399acb8529d0b553709e8f91d34fe3 selftests: kselftest_harness: let PASS / FAIL provide diagnostic
compiler: clang version 17.0.6 (https://github.com/llvm/llvm-project 6009708b4367171ccdbf4b5905cb6a803753fe18)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240417/202404170611.Kkkdkvdy-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/202404170611.Kkkdkvdy-lkp@xxxxxxxxx/

All errors (new ones prefixed by >>):

In file included from hid_bpf.c:5:
>> ./../kselftest_harness.h:1152:30: error: format string is empty [-Werror,-Wformat-zero-length]
1152 | diagnostic ? "%s" : "", diagnostic);
| ^~
1 error generated.


vim +1152 tools/testing/selftests/hid/./../kselftest_harness.h

65177e47d3035c tools/testing/selftests/kselftest_harness.h Jakub Kicinski 2023-01-25 1108
142aca6b388c8a tools/testing/selftests/kselftest_harness.h Jakub Kicinski 2020-04-27 1109 void __run_test(struct __fixture_metadata *f,
74bc7c97fa88ae tools/testing/selftests/kselftest_harness.h Jakub Kicinski 2020-04-27 1110 struct __fixture_variant_metadata *variant,
142aca6b388c8a tools/testing/selftests/kselftest_harness.h Jakub Kicinski 2020-04-27 1111 struct __test_metadata *t)
f46f576280595f tools/testing/selftests/kselftest_harness.h Kees Cook 2020-03-13 1112 {
38c957f0703827 tools/testing/selftests/kselftest_harness.h Jakub Kicinski 2024-02-28 1113 char test_name[LINE_MAX];
fa1a53d83674b3 tools/testing/selftests/kselftest_harness.h Jakub Kicinski 2024-02-28 1114 const char *diagnostic;
38c957f0703827 tools/testing/selftests/kselftest_harness.h Jakub Kicinski 2024-02-28 1115
74bc7c97fa88ae tools/testing/selftests/kselftest_harness.h Jakub Kicinski 2020-04-27 1116 /* reset test struct */
69fe8ec4f673b5 tools/testing/selftests/kselftest_harness.h Jakub Kicinski 2024-02-28 1117 t->exit_code = KSFT_PASS;
f46f576280595f tools/testing/selftests/kselftest_harness.h Kees Cook 2020-03-13 1118 t->trigger = 0;
0ef67a888375b0 tools/testing/selftests/kselftest_harness.h Kees Cook 2020-06-22 1119 memset(t->results->reason, 0, sizeof(t->results->reason));
74bc7c97fa88ae tools/testing/selftests/kselftest_harness.h Jakub Kicinski 2020-04-27 1120
38c957f0703827 tools/testing/selftests/kselftest_harness.h Jakub Kicinski 2024-02-28 1121 snprintf(test_name, sizeof(test_name), "%s%s%s.%s",
74bc7c97fa88ae tools/testing/selftests/kselftest_harness.h Jakub Kicinski 2020-04-27 1122 f->name, variant->name[0] ? "." : "", variant->name, t->name);
c8bd596f9388bc tools/testing/selftests/kselftest_harness.h Michael Ellerman 2020-09-17 1123
38c957f0703827 tools/testing/selftests/kselftest_harness.h Jakub Kicinski 2024-02-28 1124 ksft_print_msg(" RUN %s ...\n", test_name);
38c957f0703827 tools/testing/selftests/kselftest_harness.h Jakub Kicinski 2024-02-28 1125
c8bd596f9388bc tools/testing/selftests/kselftest_harness.h Michael Ellerman 2020-09-17 1126 /* Make sure output buffers are flushed before fork */
c8bd596f9388bc tools/testing/selftests/kselftest_harness.h Michael Ellerman 2020-09-17 1127 fflush(stdout);
c8bd596f9388bc tools/testing/selftests/kselftest_harness.h Michael Ellerman 2020-09-17 1128 fflush(stderr);
c8bd596f9388bc tools/testing/selftests/kselftest_harness.h Michael Ellerman 2020-09-17 1129
f46f576280595f tools/testing/selftests/kselftest_harness.h Kees Cook 2020-03-13 1130 t->pid = fork();
f46f576280595f tools/testing/selftests/kselftest_harness.h Kees Cook 2020-03-13 1131 if (t->pid < 0) {
e80068be21824e tools/testing/selftests/kselftest_harness.h Kees Cook 2020-06-22 1132 ksft_print_msg("ERROR SPAWNING TEST CHILD\n");
69fe8ec4f673b5 tools/testing/selftests/kselftest_harness.h Jakub Kicinski 2024-02-28 1133 t->exit_code = KSFT_FAIL;
f46f576280595f tools/testing/selftests/kselftest_harness.h Kees Cook 2020-03-13 1134 } else if (t->pid == 0) {
92d25637a3a459 tools/testing/selftests/kselftest_harness.h Li Zhijian 2021-12-17 1135 setpgrp();
74bc7c97fa88ae tools/testing/selftests/kselftest_harness.h Jakub Kicinski 2020-04-27 1136 t->fn(t, variant);
796a344fa4315f tools/testing/selftests/kselftest_harness.h Jakub Kicinski 2024-02-28 1137 _exit(t->exit_code);
f46f576280595f tools/testing/selftests/kselftest_harness.h Kees Cook 2020-03-13 1138 } else {
f46f576280595f tools/testing/selftests/kselftest_harness.h Kees Cook 2020-03-13 1139 __wait_for_test(t);
f46f576280595f tools/testing/selftests/kselftest_harness.h Kees Cook 2020-03-13 1140 }
38c957f0703827 tools/testing/selftests/kselftest_harness.h Jakub Kicinski 2024-02-28 1141 ksft_print_msg(" %4s %s\n",
69fe8ec4f673b5 tools/testing/selftests/kselftest_harness.h Jakub Kicinski 2024-02-28 1142 __test_passed(t) ? "OK" : "FAIL", test_name);
9847d24af95c7f tools/testing/selftests/kselftest_harness.h Kees Cook 2020-06-22 1143
fa1a53d83674b3 tools/testing/selftests/kselftest_harness.h Jakub Kicinski 2024-02-28 1144 if (t->results->reason[0])
fa1a53d83674b3 tools/testing/selftests/kselftest_harness.h Jakub Kicinski 2024-02-28 1145 diagnostic = t->results->reason;
378193eff3399a tools/testing/selftests/kselftest_harness.h Jakub Kicinski 2024-02-28 1146 else if (t->exit_code == KSFT_PASS || t->exit_code == KSFT_FAIL)
378193eff3399a tools/testing/selftests/kselftest_harness.h Jakub Kicinski 2024-02-28 1147 diagnostic = NULL;
fa1a53d83674b3 tools/testing/selftests/kselftest_harness.h Jakub Kicinski 2024-02-28 1148 else
fa1a53d83674b3 tools/testing/selftests/kselftest_harness.h Jakub Kicinski 2024-02-28 1149 diagnostic = "unknown";
fa1a53d83674b3 tools/testing/selftests/kselftest_harness.h Jakub Kicinski 2024-02-28 1150
732e2035280bf4 tools/testing/selftests/kselftest_harness.h Jakub Kicinski 2024-02-28 1151 ksft_test_result_code(t->exit_code, test_name,
378193eff3399a tools/testing/selftests/kselftest_harness.h Jakub Kicinski 2024-02-28 @1152 diagnostic ? "%s" : "", diagnostic);
c99ee51a9d9716 tools/testing/selftests/seccomp/test_harness.h Kees Cook 2015-06-16 1153 }
c99ee51a9d9716 tools/testing/selftests/seccomp/test_harness.h Kees Cook 2015-06-16 1154

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