summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorYucong Sun <fallentree@fb.com>2021-08-16 21:47:29 -0700
committerAndrii Nakryiko <andrii@kernel.org>2021-08-17 11:16:27 -0700
commit26d82640d5ba2c3b32d79597be2dcf820ed78b16 (patch)
tree1ffa79571054c11b54194d146b818278fcbad04a /tools
parent857f75ea845706a0ec65ce2239da519214a4451a (diff)
downloadlinux-26d82640d5ba2c3b32d79597be2dcf820ed78b16.tar.bz2
selftests/bpf: Skip loading bpf_testmod when using -l to list tests.
When using "-l", test_progs often is executed as non-root user, load_bpf_testmod() will fail and output errors. This patch skips loading bpf testmod when "-l" is specified, making output cleaner. Signed-off-by: Yucong Sun <fallentree@fb.com> Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Link: https://lore.kernel.org/bpf/20210817044732.3263066-2-fallentree@fb.com
Diffstat (limited to 'tools')
-rw-r--r--tools/testing/selftests/bpf/test_progs.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/testing/selftests/bpf/test_progs.c b/tools/testing/selftests/bpf/test_progs.c
index 6f103106a39b..532af3353edf 100644
--- a/tools/testing/selftests/bpf/test_progs.c
+++ b/tools/testing/selftests/bpf/test_progs.c
@@ -755,7 +755,7 @@ int main(int argc, char **argv)
save_netns();
stdio_hijack();
env.has_testmod = true;
- if (load_bpf_testmod()) {
+ if (!env.list_test_names && load_bpf_testmod()) {
fprintf(env.stderr, "WARNING! Selftests relying on bpf_testmod.ko will be skipped.\n");
env.has_testmod = false;
}
@@ -803,7 +803,7 @@ int main(int argc, char **argv)
if (test->need_cgroup_cleanup)
cleanup_cgroup_environment();
}
- if (env.has_testmod)
+ if (!env.list_test_names && env.has_testmod)
unload_bpf_testmod();
stdio_restore();