aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEduard Zingerman <[email protected]>2022-10-01 13:44:25 +0300
committerAndrii Nakryiko <[email protected]>2022-10-05 15:27:08 -0700
commitd503f1176b14f722a40ea5110312614982f9a80b (patch)
treea37a9174f088ce5bcc995aa3d838401b3e96de64
parent44a726c3f23cf762ef4ce3c1709aefbcbe97f62c (diff)
selftests/bpf: Test btf dump for struct with padding only fields
Structures with zero regular fields but some padding constitute a special case in btf_dump.c:btf_dump_emit_struct_def with regards to newline before closing '}'. Signed-off-by: Eduard Zingerman <[email protected]> Signed-off-by: Andrii Nakryiko <[email protected]> Link: https://lore.kernel.org/bpf/[email protected]
-rw-r--r--tools/testing/selftests/bpf/progs/btf_dump_test_case_padding.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/tools/testing/selftests/bpf/progs/btf_dump_test_case_padding.c b/tools/testing/selftests/bpf/progs/btf_dump_test_case_padding.c
index f2661c8d2d90..7cb522d22a66 100644
--- a/tools/testing/selftests/bpf/progs/btf_dump_test_case_padding.c
+++ b/tools/testing/selftests/bpf/progs/btf_dump_test_case_padding.c
@@ -102,12 +102,21 @@ struct zone {
struct zone_padding __pad__;
};
+/* ----- START-EXPECTED-OUTPUT ----- */
+struct padding_wo_named_members {
+ long: 64;
+ long: 64;
+};
+
+/* ------ END-EXPECTED-OUTPUT ------ */
+
int f(struct {
struct padded_implicitly _1;
struct padded_explicitly _2;
struct padded_a_lot _3;
struct padded_cache_line _4;
struct zone _5;
+ struct padding_wo_named_members _6;
} *_)
{
return 0;