Ilya Leoshkevich wrote: > Test the good variants as well as the potential malformed ones. > > Signed-off-by: Ilya Leoshkevich <iii@xxxxxxxxxxxxx> > Acked-by: Yonghong Song <yhs@xxxxxx> > --- > tools/testing/selftests/bpf/btf_helpers.c | 4 + > tools/testing/selftests/bpf/prog_tests/btf.c | 131 +++++++++++++++++++ > tools/testing/selftests/bpf/test_btf.h | 3 + > 3 files changed, 138 insertions(+) > Should we also add a test in reloc_size.c to verify bpf_core_field_size() is working correctly with floats. Seems like a useful test to me. diff --git a/tools/testing/selftests/bpf/progs/test_core_reloc_size.c b/tools/testing/selftests/bpf/progs/test_core_reloc_size.c index d7fb6cfc7891..c75d135009ab 100644 --- a/tools/testing/selftests/bpf/progs/test_core_reloc_size.c +++ b/tools/testing/selftests/bpf/progs/test_core_reloc_size.c @@ -30,6 +30,7 @@ struct core_reloc_size { int arr_field[4]; void *ptr_field; enum { VALUE = 123 } enum_field; + float floating; }; SEC("raw_tracepoint/sys_enter") @@ -45,6 +46,7 @@ int test_core_size(void *ctx) out->arr_elem_sz = bpf_core_field_size(in->arr_field[0]); out->ptr_sz = bpf_core_field_size(in->ptr_field); out->enum_sz = bpf_core_field_size(in->enum_field); + out->floating_sz = bpf_core_field_size(in->floating); return 0; }