selftests/bpf: Teach test_progs to cd into subdir
authorAndrii Nakryiko <andriin@fb.com>
Wed, 16 Oct 2019 06:00:45 +0000 (23:00 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Thu, 17 Oct 2019 19:15:08 +0000 (12:15 -0700)
commit0b6e71c398a947a335622ad52807e500e1b5fefa
tree34889cd896dde85861c8c7dc150a17deb31b6d82
parent8d285a3b2e83796d33ec3674b25fe0bfcc647e92
selftests/bpf: Teach test_progs to cd into subdir

We are building a bunch of "flavors" of test_progs, e.g., w/ alu32 flag
for Clang when building BPF object. test_progs setup is relying on
having all the BPF object files and extra resources to be available in
current working directory, though. But we actually build all these files
into a separate sub-directory. Next set of patches establishes
convention of naming "flavored" test_progs (and test runner binaries in
general) as test_progs-flavor (e.g., test_progs-alu32), for each such
extra flavor. This patch teaches test_progs binary to automatically
detect its own extra flavor based on its argv[0], and if present, to
change current directory to a flavor-specific subdirectory.

Signed-off-by: Andrii Nakryiko <andriin@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20191016060051.2024182-2-andriin@fb.com
tools/testing/selftests/bpf/test_progs.c