Thread (22 messages) 22 messages, 3 authors, 2021-02-26

RE: [PATCH v6 bpf-next 7/9] selftest/bpf: Add BTF_KIND_FLOAT tests

From: John Fastabend <john.fastabend@gmail.com>
Date: 2021-02-26 02:02:11
Subsystem: bpf [general] (safe dynamic programs and tools), bpf [selftests] (test runners & infrastructure), kernel selftest framework, the rest · Maintainers: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko, Eduard Zingerman, Kumar Kartikeya Dwivedi, Shuah Khan, Linus Torvalds

Ilya Leoshkevich wrote:
Test the good variants as well as the potential malformed ones.

Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
Acked-by: Yonghong Song <redacted>
---
 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;
 }
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help