diff mbox series

[v2,bpf-next,1/5] Skip loading bpf_testmod when using -l to list tests.

Message ID 20210810001625.1140255-2-fallentree@fb.com (mailing list archive)
State Changes Requested
Delegated to: BPF
Headers show
Series Improve the usability of test_progs | expand

Checks

Context Check Description
netdev/cover_letter success Link
netdev/fixes_present success Link
netdev/patch_count success Link
netdev/tree_selection success Clearly marked for bpf-next
netdev/subject_prefix success Link
netdev/cc_maintainers warning 10 maintainers not CCed: daniel@iogearbox.net netdev@vger.kernel.org john.fastabend@gmail.com linux-kselftest@vger.kernel.org shuah@kernel.org songliubraving@fb.com ast@kernel.org yhs@fb.com kpsingh@kernel.org kafai@fb.com
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Link
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success Link
netdev/checkpatch warning WARNING: line length of 111 exceeds 80 columns
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/header_inline success Link

Commit Message

Yucong Sun Aug. 10, 2021, 12:16 a.m. UTC
This patch remove bpf_testmod load test when using "-l", making output
cleaner.

Signed-off-by: Yucong Sun <fallentree@fb.com>
---
 tools/testing/selftests/bpf/test_progs.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

Comments

Andrii Nakryiko Aug. 10, 2021, 4:02 p.m. UTC | #1
On Mon, Aug 9, 2021 at 5:17 PM Yucong Sun <fallentree@fb.com> wrote:
>
> This patch remove bpf_testmod load test when using "-l", making output
> cleaner.
>
> Signed-off-by: Yucong Sun <fallentree@fb.com>
> ---
>  tools/testing/selftests/bpf/test_progs.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/tools/testing/selftests/bpf/test_progs.c b/tools/testing/selftests/bpf/test_progs.c
> index 6f103106a39b..74dde0af1592 100644
> --- a/tools/testing/selftests/bpf/test_progs.c
> +++ b/tools/testing/selftests/bpf/test_progs.c
> @@ -754,10 +754,12 @@ int main(int argc, char **argv)
>
>         save_netns();
>         stdio_hijack();
> -       env.has_testmod = true;
> -       if (load_bpf_testmod()) {

could keep this to minimal changes by just doing

if (!env.list_test_names && load_bpf_testmod()) { ... }

env.has_testmod = true doesn't make difference for listing tests (and
in the future we might want to assume that testmod is available to be
able to list all tests and subtests, including those that depend on
testmod).

> -               fprintf(env.stderr, "WARNING! Selftests relying on bpf_testmod.ko will be skipped.\n");
> -               env.has_testmod = false;
> +       if (!env.list_test_names) {
> +               env.has_testmod = true;
> +               if (load_bpf_testmod()) {
> +                       fprintf(env.stderr, "WARNING! Selftests relying on bpf_testmod.ko will be skipped.\n");
> +                       env.has_testmod = false;
> +               }
>         }
>         for (i = 0; i < prog_test_cnt; i++) {
>                 struct prog_test_def *test = &prog_test_defs[i];
> --
> 2.30.2
>
diff mbox series

Patch

diff --git a/tools/testing/selftests/bpf/test_progs.c b/tools/testing/selftests/bpf/test_progs.c
index 6f103106a39b..74dde0af1592 100644
--- a/tools/testing/selftests/bpf/test_progs.c
+++ b/tools/testing/selftests/bpf/test_progs.c
@@ -754,10 +754,12 @@  int main(int argc, char **argv)
 
 	save_netns();
 	stdio_hijack();
-	env.has_testmod = true;
-	if (load_bpf_testmod()) {
-		fprintf(env.stderr, "WARNING! Selftests relying on bpf_testmod.ko will be skipped.\n");
-		env.has_testmod = false;
+	if (!env.list_test_names) {
+		env.has_testmod = true;
+		if (load_bpf_testmod()) {
+			fprintf(env.stderr, "WARNING! Selftests relying on bpf_testmod.ko will be skipped.\n");
+			env.has_testmod = false;
+		}
 	}
 	for (i = 0; i < prog_test_cnt; i++) {
 		struct prog_test_def *test = &prog_test_defs[i];