diff options
| author | Stanislav Fomichev <[email protected]> | 2019-12-02 21:59:31 +0000 |
|---|---|---|
| committer | Alexei Starovoitov <[email protected]> | 2019-12-05 01:57:55 +0000 |
| commit | 6bf6affe18dafea6ef12036001162ac7f2dbf738 (patch) | |
| tree | 409a3af52c0fd0670c0bbae50df63d5ca1f8e577 /tools/testing/selftests/bpf/test_cpp.cpp | |
| parent | selftests/bpf: Don't hard-code root cgroup id (diff) | |
| download | kernel-6bf6affe18dafea6ef12036001162ac7f2dbf738.tar.gz kernel-6bf6affe18dafea6ef12036001162ac7f2dbf738.zip | |
selftests/bpf: Bring back c++ include/link test
Commit 5c26f9a78358 ("libbpf: Don't use cxx to test_libpf target")
converted existing c++ test to c. We still want to include and
link against libbpf from c++ code, so reinstate this test back,
this time in a form of a selftest with a clear comment about
its purpose.
v2:
* -lelf -> $(LDLIBS) (Andrii Nakryiko)
Fixes: 5c26f9a78358 ("libbpf: Don't use cxx to test_libpf target")
Signed-off-by: Stanislav Fomichev <[email protected]>
Signed-off-by: Alexei Starovoitov <[email protected]>
Acked-by: Andrii Nakryiko <[email protected]>
Link: https://lore.kernel.org/bpf/[email protected]
Diffstat (limited to 'tools/testing/selftests/bpf/test_cpp.cpp')
| -rw-r--r-- | tools/testing/selftests/bpf/test_cpp.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tools/testing/selftests/bpf/test_cpp.cpp b/tools/testing/selftests/bpf/test_cpp.cpp new file mode 100644 index 000000000000..f0eb2727b766 --- /dev/null +++ b/tools/testing/selftests/bpf/test_cpp.cpp @@ -0,0 +1,20 @@ +/* SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause) */ +#include "libbpf.h" +#include "bpf.h" +#include "btf.h" + +/* do nothing, just make sure we can link successfully */ + +int main(int argc, char *argv[]) +{ + /* libbpf.h */ + libbpf_set_print(NULL); + + /* bpf.h */ + bpf_prog_get_fd_by_id(0); + + /* btf.h */ + btf__new(NULL, 0); + + return 0; +} |
