Adding btf_dump__new call to test_cpp, so we can test C++ compilation with that.
Showing the changes to tools/testing/selftests/bpf/test_cpp.cpp (1 of 1 file). Show all
Unified · Split
| @@ -7,9 +7,15 @@ · 6 unmodified lines | |||
| 7 | 7 | ||
| 8 | /* do nothing, just make sure we can link successfully */ | 8 | /* do nothing, just make sure we can link successfully */ |
| 9 | 9 | ||
| 10 | static void dump_printf(void *ctx, const char *fmt, va_list args) | ||
| 11 | { | ||
| 12 | } | ||
| 13 | |||
| 10 | int main(int argc, char *argv[]) | 14 | int main(int argc, char *argv[]) |
| 11 | { | 15 | { |
| 16 | struct btf_dump_opts opts = { }; | ||
| 12 | struct test_core_extern *skel; | 17 | struct test_core_extern *skel; |
| 18 | struct btf *btf; | ||
| 13 | 19 | ||
| 14 | /* libbpf.h */ | 20 | /* libbpf.h */ |
| 15 | libbpf_set_print(NULL); | 21 | libbpf_set_print(NULL); |
| @@ -18,7 +24,8 @@ int main(int argc, char *argv[]) · 2 unmodified lines | |||
| 18 | bpf_prog_get_fd_by_id(0); | 24 | bpf_prog_get_fd_by_id(0); |
| 19 | 25 | ||
| 20 | /* btf.h */ | 26 | /* btf.h */ |
| 21 | btf__new(NULL, 0); | 27 | btf = btf__new(NULL, 0); |
| 28 | btf_dump__new(btf, dump_printf, nullptr, &opts); | ||
| 22 | 29 | ||
| 23 | /* BPF skeleton */ | 30 | /* BPF skeleton */ |
| 24 | skel = test_core_extern__open_and_load(); | 31 | skel = test_core_extern__open_and_load(); |