summaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/bpf/sdt-config.h
diff options
context:
space:
mode:
authorAndrii Nakryiko <andrii@kernel.org>2022-04-05 01:42:01 +0200
committerAlexei Starovoitov <ast@kernel.org>2022-04-05 22:16:08 +0200
commit630301b0d59dd85e43cca29382c459f9880af5f0 (patch)
tree91ff5442d921edd9026413e555e84f126f1a2373 /tools/testing/selftests/bpf/sdt-config.h
parentlibbpf: Add x86-specific USDT arg spec parsing logic (diff)
downloadlinux-630301b0d59dd85e43cca29382c459f9880af5f0.tar.xz
linux-630301b0d59dd85e43cca29382c459f9880af5f0.zip
selftests/bpf: Add basic USDT selftests
Add semaphore-based USDT to test_progs itself and write basic tests to valicate both auto-attachment and manual attachment logic, as well as BPF-side functionality. Also add subtests to validate that libbpf properly deduplicates USDT specs and handles spec overflow situations correctly, as well as proper "rollback" of partially-attached multi-spec USDT. BPF-side of selftest intentionally consists of two files to validate that usdt.bpf.h header can be included from multiple source code files that are subsequently linked into final BPF object file without causing any symbol duplication or other issues. We are validating that __weak maps and bpf_usdt_xxx() API functions defined in usdt.bpf.h do work as intended. USDT selftests utilize sys/sdt.h header that on Ubuntu systems comes from systemtap-sdt-devel package. But to simplify everyone's life, including CI but especially casual contributors to bpf/bpf-next that are trying to build selftests, I've checked in sys/sdt.h header from [0] directly. This way it will work on all architectures and distros without having to figure it out for every relevant combination and adding any extra implicit package dependencies. [0] https://sourceware.org/git?p=systemtap.git;a=blob_plain;f=includes/sys/sdt.h;h=ca0162b4dc57520b96638c8ae79ad547eb1dd3a1;hb=HEAD Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Reviewed-by: Alan Maguire <alan.maguire@oracle.com> Acked-by: Dave Marchevsky <davemarchevsky@fb.com> Link: https://lore.kernel.org/bpf/20220404234202.331384-7-andrii@kernel.org
Diffstat (limited to 'tools/testing/selftests/bpf/sdt-config.h')
-rw-r--r--tools/testing/selftests/bpf/sdt-config.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/tools/testing/selftests/bpf/sdt-config.h b/tools/testing/selftests/bpf/sdt-config.h
new file mode 100644
index 000000000000..733045a52771
--- /dev/null
+++ b/tools/testing/selftests/bpf/sdt-config.h
@@ -0,0 +1,6 @@
+/* includes/sys/sdt-config.h. Generated from sdt-config.h.in by configure.
+
+ This file just defines _SDT_ASM_SECTION_AUTOGROUP_SUPPORT to 0 or 1 to
+ indicate whether the assembler supports "?" in .pushsection directives. */
+
+#define _SDT_ASM_SECTION_AUTOGROUP_SUPPORT 1