selftests/bpf: Mix legacy (maps) and modern (vars) BPF in one test
authorAndrii Nakryiko <andrii@kernel.org>
Tue, 23 Nov 2021 20:01:05 +0000 (12:01 -0800)
committerDaniel Borkmann <daniel@iogearbox.net>
Thu, 25 Nov 2021 22:05:23 +0000 (23:05 +0100)
commite4f7ac90c2b09766e4acf771908987391c836413
tree06c24222569e75dd661c2f65edb9447ec13681ed
parent16e0c35c6f7a2e90d52f3035ecf942af21417b7b
selftests/bpf: Mix legacy (maps) and modern (vars) BPF in one test

Add selftest that combines two BPF programs within single BPF object
file such that one of the programs is using global variables, but can be
skipped at runtime on old kernels that don't support global data.
Another BPF program is written with the goal to be runnable on very old
kernels and only relies on explicitly accessed BPF maps.

Such test, run against old kernels (e.g., libbpf CI will run it against 4.9
kernel that doesn't support global data), allows to test the approach
and ensure that libbpf doesn't make unnecessary assumption about
necessary kernel features.

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Song Liu <songliubraving@fb.com>
Link: https://lore.kernel.org/bpf/20211123200105.387855-2-andrii@kernel.org
tools/testing/selftests/bpf/prog_tests/legacy_printk.c [new file with mode: 0644]
tools/testing/selftests/bpf/progs/test_legacy_printk.c [new file with mode: 0644]