Selftests global tags ordering#11484
Closed
eddyz87 wants to merge 5 commits intokernel-patches:bpf-next_basefrom
Closed
Selftests global tags ordering#11484eddyz87 wants to merge 5 commits intokernel-patches:bpf-next_basefrom
eddyz87 wants to merge 5 commits intokernel-patches:bpf-next_basefrom
Conversation
434ad19 to
2c59812
Compare
4e65c57 to
6a47829
Compare
7d66a13 to
5968176
Compare
392934f to
922889c
Compare
5968176 to
11c7d8e
Compare
922889c to
4fc8fc8
Compare
9ebb4fa to
0ba7f87
Compare
9192b33 to
7347239
Compare
Impose global ordering for all decl tags used by test_loader.c based tests: __success, __failure, __msg, etc. The tags are now sorted by testing framework to be processed in the same order they appear in the C source code of the test. The ordering is necessary for gcc-bpf. Neither GCC nor the C standard defines the order in which function attributes are consumed. While Clang tends to preserve tags definition order in the output BTF, GCC does not. This inconsistency causes BPF tests with multiple __msg entries to fail when compiled with GCC. This is based on a patch [1] from Cupertino Miranda (see patch kernel-patches#3) and includes some additional cleanups for test_loader.c decl tags declaration and processing (see patches #1, #2, kernel-patches#4). [1] https://lore.kernel.org/bpf/20260305130035.192080-1-cupertino.miranda@oracle.com/ Changelog: v2: https://lore.kernel.org/bpf/20260330-selftests-global-tags-ordering-v2-0-c0ac61e81098@gmail.com/ v2 -> v3: - fixed free(tmp) call in collect_decl_tags() (Puranjay, bot) - naming nit in compile_regex() (Mykyta) v1: https://lore.kernel.org/bpf/20260326-selftests-global-tags-ordering-v1-0-5dd2ced5d9ad@gmail.com/ v1 -> v2: - refactoring str_has_pfx() usages missing from v1 (Puranjay) - removed realloc_or_free() (Andrii) - fixed qsort(NULL, ...) usage (Puranjay) - skip_decl_tag_pfx() returns NULL if tag does not start from "comment:" (Puranjay) --- b4-submit-tracking --- { "series": { "revision": 2, "change-id": "20260326-selftests-global-tags-ordering-8f324323d9c8", "prefixes": ["bpf-next"] } }
__jited_unpriv was using "test_jited=" as its tag name, same as the priv variant __jited. Fix by using "test_jited_unpriv=". Fixes: 7d743e4 ("selftests/bpf: __jited test tag to check disassembly after jit") Acked-by: Ihor Solodrai <ihor.solodrai@linux.dev> Reviewed-by: Puranjay Mohan <puranjay@kernel.org> Signed-off-by: Eduard Zingerman <eddyz87@gmail.com>
Change str_has_pfx() to return a pointer to the first character after the prefix, thus eliminating the repetitive (s + sizeof(PFX) - 1) patterns. Acked-by: Ihor Solodrai <ihor.solodrai@linux.dev> Acked-by: Mykyta Yatsenko <yatsenko@meta.com> Reviewed-by: Puranjay Mohan <puranjay@kernel.org> Signed-off-by: Eduard Zingerman <eddyz87@gmail.com>
Impose global ordering for all decl tags used by test_loader.c based
tests (__success, __failure, __msg, etc):
- change every tag to expand as
__attribute__((btf_decl_tag("comment:" XSTR(__COUNTER__) ...)))
- change parse_test_spec() to collect all decl tags before
processing and sort them using strverscmp().
The ordering is necessary for gcc-bpf.
Neither GCC nor the C standard defines the order in which function
attributes are consumed. While Clang tends to preserve definition order,
GCC may process them out of sequence. This inconsistency causes BPF
tests with multiple __msg entries to fail when compiled with GCC.
Signed-off-by: Cupertino Miranda <cupertino.miranda@oracle.com>
Reviewed-by: Puranjay Mohan <puranjay@kernel.org>
Signed-off-by: Eduard Zingerman <eddyz87@gmail.com>
After str_has_pfx() refactoring each TEST_TAG_* / TEST_BTF_PATH constant is used exactly once. Since constant definitions are not shared between BPF-side bpf_misc.h and userspace side test_loader.c, there is no need in the additional redirection layer. Acked-by: Ihor Solodrai <ihor.solodrai@linux.dev> Reviewed-by: Puranjay Mohan <puranjay@kernel.org> Signed-off-by: Eduard Zingerman <eddyz87@gmail.com>
b7c00a3 to
04b0fd1
Compare
d7f44a8 to
9604fd1
Compare
|
Automatically cleaning up stale PR; feel free to reopen if needed |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.