selftests/bpf: Add Skeleton templated wrapper as an example
authorAndrii Nakryiko <andrii@kernel.org>
Sat, 12 Feb 2022 05:57:33 +0000 (21:57 -0800)
committerAlexei Starovoitov <ast@kernel.org>
Tue, 15 Feb 2022 17:59:01 +0000 (09:59 -0800)
commit189e0ecabc1717db62deab751afa755f07bdbcf8
treee0c190cad0dc273b1d371bf8b8d567a9ee657b5e
parentbb8ffe61ea454a565e4fb1f450ef71237c9f032c
selftests/bpf: Add Skeleton templated wrapper as an example

Add an example of how to build C++ template-based BPF skeleton wrapper.
It's an actually runnable valid use of skeleton through more C++-like
interface. Note that skeleton destuction happens implicitly through
Skeleton<T>'s destructor.

Also make test_cpp runnable as it would have crashed on invalid btf
passed into btf_dump__new().

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20220212055733.539056-3-andrii@kernel.org
tools/testing/selftests/bpf/test_cpp.cpp