In order to build with clang at all, in order to see these symptoms, one
must first apply Valentin Obst's build fix for LLVM [1]. Once that is
done, then when building with clang, via:
make LLVM=1 -C tools/testing/selftests
...clang emits a "format string is empty" warning. (gcc also emits a
similar warning.)
Fix by passing NULL, instead of "", for the msg argument to
ksft_test_result_code(). This removes dozens of warnings and a few
errors (some tests have -Werror set).
[1] https://lore.kernel.org/all/20240329-selftests-libmk-llvm-rfc-v1-1-2f9ed7d1…
Cc: Valentin Obst <kernel(a)valentinobst.de>
Cc: Kees Cook <keescook(a)chromium.org>
Cc: Nick Desaulniers <ndesaulniers(a)google.com>
Cc: Nathan Chancellor <nathan(a)kernel.org>
Cc: Shuah Khan <shuah(a)kernel.org>
Cc: Justin Stitt <justinstitt(a)google.com>
Cc: Bill Wendling <morbo(a)google.com>
Signed-off-by: John Hubbard <jhubbard(a)nvidia.com>
---
tools/testing/selftests/kselftest_harness.h | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/tools/testing/selftests/kselftest_harness.h b/tools/testing/selftests/kselftest_harness.h
index d98702b6955d..456b8694e678 100644
--- a/tools/testing/selftests/kselftest_harness.h
+++ b/tools/testing/selftests/kselftest_harness.h
@@ -1207,8 +1207,10 @@ void __run_test(struct __fixture_metadata *f,
else
diagnostic = "unknown";
- ksft_test_result_code(t->exit_code, test_name,
- diagnostic ? "%s" : NULL, diagnostic);
+ if (diagnostic)
+ ksft_test_result_code(t->exit_code, test_name, "%s", diagnostic);
+ else
+ ksft_test_result_code(t->exit_code, test_name, NULL);
free(test_name);
}
base-commit: 18daea77cca626f590fb140fc11e3a43c5d41354
prerequisite-patch-id: b901ece2a5b78503e2fb5480f20e304d36a0ea27
--
2.45.0
From: Geliang Tang <tanggeliang(a)kylinos.cn>
This patchset adds opts argument for __start_server, and adds setsockopt
pointer together with optval and optlen into struct network_helper_opts
to make start_server_addr helper more flexible. With these modifications,
many duplicate codes can be dropped.
Patch 4 addresses comments of Martin and Eduard in the previous series.
Geliang Tang (6):
selftests/bpf: Add opts argument for __start_server
selftests/bpf: Make start_mptcp_server static
selftests/bpf: Drop start_server_proto helper
selftests/bpf: Add setsockopt for network_helper_opts
selftests/bpf: Use start_server_addr in sockopt_inherit
selftests/bpf: Use start_server_addr in test_tcp_check_syncookie
tools/testing/selftests/bpf/Makefile | 1 +
tools/testing/selftests/bpf/network_helpers.c | 53 ++++++++-------
tools/testing/selftests/bpf/network_helpers.h | 5 +-
.../testing/selftests/bpf/prog_tests/mptcp.c | 16 +++++
.../bpf/prog_tests/sockopt_inherit.c | 34 ++++------
.../bpf/test_tcp_check_syncookie_user.c | 64 ++++++-------------
6 files changed, 78 insertions(+), 95 deletions(-)
--
2.40.1
Fixes clang compiler warnings by adding parentheses:
parse_vdso.c:65:9: warning: using the result of an assignment as a
condition without parentheses [-Wparentheses]
if (g = h & 0xf0000000)
~~^~~~~~~~~~~~~~~~
parse_vdso.c:65:9: note: place parentheses around the assignment to
silence this warning
if (g = h & 0xf0000000)
^
( )
parse_vdso.c:65:9: note: use '==' to turn this assignment into an
equality comparison
if (g = h & 0xf0000000)
^
==
Fixes: 98eedc3a9dbf ("Document the vDSO and add a reference parser")
Reviewed-by: Justin Stitt <justinstitt(a)google.com>
Signed-off-by: Edward Liaw <edliaw(a)google.com>
---
v2: separated assignment from predicate
---
tools/testing/selftests/vDSO/parse_vdso.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tools/testing/selftests/vDSO/parse_vdso.c b/tools/testing/selftests/vDSO/parse_vdso.c
index 413f75620a35..fdd38f7e0e43 100644
--- a/tools/testing/selftests/vDSO/parse_vdso.c
+++ b/tools/testing/selftests/vDSO/parse_vdso.c
@@ -62,7 +62,8 @@ static unsigned long elf_hash(const unsigned char *name)
while (*name)
{
h = (h << 4) + *name++;
- if (g = h & 0xf0000000)
+ g = h & 0xf0000000;
+ if (g)
h ^= g >> 24;
h &= ~g;
}
--
2.45.0.rc0.197.gbae5840b3b-goog