History

selftests/bpf: Add btf_dump__new to test_cpp

Adding btf_dump__new call to test_cpp, so we can test C++ compilation with that.

Jiri Olsa committed 4 years ago

Commit ecf45e61 parent 5652b801 file · +8 −1Browse files

Showing the changes to tools/testing/selftests/bpf/test_cpp.cpp (1 of 1 file). Show all

Unified · Split

tools/testing/selftests/bpf/test_cpp.cpp+8−1
@@ -7,9 +7,15 @@ · 6 unmodified lines
77
88 /* do nothing, just make sure we can link successfully */
99
10+static void dump_printf(void *ctx, const char *fmt, va_list args)
11+{
12+}
13+
1014 int main(int argc, char *argv[])
1115 {
16+ struct btf_dump_opts opts = { };
1217 struct test_core_extern *skel;
18+ struct btf *btf;
1319
1420 /* libbpf.h */
1521 libbpf_set_print(NULL);
@@ -18,7 +24,8 @@ int main(int argc, char *argv[]) · 2 unmodified lines
1824 bpf_prog_get_fd_by_id(0);
1925
2026 /* btf.h */
21− btf__new(NULL, 0);
27+ btf = btf__new(NULL, 0);
28+ btf_dump__new(btf, dump_printf, nullptr, &opts);
2229
2330 /* BPF skeleton */
2431 skel = test_core_extern__open_and_load();