diff options
author | Ilya Leoshkevich <iii@linux.ibm.com> | 2019-08-19 14:38:47 +0200 |
---|---|---|
committer | Daniel Borkmann <daniel@iogearbox.net> | 2019-08-21 17:00:59 +0200 |
commit | e91dcb536ae263ecff07118e36bf820c229a6ecd (patch) | |
tree | 9e396c3c951cf8ef49f26bfefe4af2f67ee7ed91 /tools/testing/selftests/bpf/test_btf_dump.c | |
parent | selftests/bpf: fix test_cgroup_storage on s390 (diff) | |
download | linux-dev-e91dcb536ae263ecff07118e36bf820c229a6ecd.tar.xz linux-dev-e91dcb536ae263ecff07118e36bf820c229a6ecd.zip |
selftests/bpf: fix test_btf_dump with O=
test_btf_dump fails when run with O=, because it needs to access source
files and assumes they live in ./progs/, which is not the case in this
scenario.
Fix by instructing kselftest to copy btf_dump_test_case_*.c files to the
test directory. Since kselftest does not preserve directory structure,
adjust the test to look in ./progs/ and then in ./.
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Diffstat (limited to '')
-rw-r--r-- | tools/testing/selftests/bpf/test_btf_dump.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/tools/testing/selftests/bpf/test_btf_dump.c b/tools/testing/selftests/bpf/test_btf_dump.c index 8f850823d35f..6e75dd3cb14f 100644 --- a/tools/testing/selftests/bpf/test_btf_dump.c +++ b/tools/testing/selftests/bpf/test_btf_dump.c @@ -97,6 +97,13 @@ int test_btf_dump_case(int n, struct btf_dump_test_case *test_case) } snprintf(test_file, sizeof(test_file), "progs/%s.c", test_case->name); + if (access(test_file, R_OK) == -1) + /* + * When the test is run with O=, kselftest copies TEST_FILES + * without preserving the directory structure. + */ + snprintf(test_file, sizeof(test_file), "%s.c", + test_case->name); /* * Diff test output and expected test output, contained between * START-EXPECTED-OUTPUT and END-EXPECTED-OUTPUT lines in test case. |