]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
selftests/bpf: Test_progs indicate to shell on non-actions
authorJesper Dangaard Brouer <brouer@redhat.com>
Wed, 1 Jul 2020 21:44:07 +0000 (23:44 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 21 Aug 2020 11:05:31 +0000 (13:05 +0200)
[ Upstream commit 6c92bd5cd4650c39dd929565ee172984c680fead ]

When a user selects a non-existing test the summary is printed with
indication 0 for all info types, and shell "success" (EXIT_SUCCESS) is
indicated. This can be understood by a human end-user, but for shell
scripting is it useful to indicate a shell failure (EXIT_FAILURE).

Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Andrii Nakryiko <andriin@fb.com>
Link: https://lore.kernel.org/bpf/159363984736.930467.17956007131403952343.stgit@firesoul
Signed-off-by: Sasha Levin <sashal@kernel.org>
tools/testing/selftests/bpf/test_progs.c

index 8cb3469dd11f200b8e5d5537156e7f673a536c37..a7d06724c18c2b5d2ebeed0cc36bee1d7d80e670 100644 (file)
@@ -584,5 +584,8 @@ int main(int argc, char **argv)
        free(env.test_selector.num_set);
        free(env.subtest_selector.num_set);
 
+       if (env.succ_cnt + env.fail_cnt + env.skip_cnt == 0)
+               return EXIT_FAILURE;
+
        return env.fail_cnt ? EXIT_FAILURE : EXIT_SUCCESS;
 }