]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
selftests/bpf: test_progs use another shell exit on non-actions
authorJesper Dangaard Brouer <brouer@redhat.com>
Tue, 7 Jul 2020 07:12:19 +0000 (09:12 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 21 Aug 2020 11:07:33 +0000 (13:07 +0200)
[ Upstream commit 3220fb667842a9725cbb71656f406eadb03c094b ]

This is a follow up adjustment to commit 6c92bd5cd465 ("selftests/bpf:
Test_progs indicate to shell on non-actions"), that returns shell exit
indication EXIT_FAILURE (value 1) when user selects a non-existing test.

The problem with using EXIT_FAILURE is that a shell script cannot tell
the difference between a non-existing test and the test failing.

This patch uses value 2 as shell exit indication.
(Aside note unrecognized option parameters use value 64).

Fixes: 6c92bd5cd465 ("selftests/bpf: Test_progs indicate to shell on non-actions")
Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Andrii Nakryiko <andriin@fb.com>
Link: https://lore.kernel.org/bpf/159410593992.1093222.90072558386094370.stgit@firesoul
Signed-off-by: Sasha Levin <sashal@kernel.org>
tools/testing/selftests/bpf/test_progs.c

index 64bb5728040f4688a3c23144af20e7463aa90196..a75a83155f6d001108d1d5a3d95af83ae032034c 100644 (file)
@@ -12,6 +12,8 @@
 #include <string.h>
 #include <execinfo.h> /* backtrace */
 
+#define EXIT_NO_TEST           2
+
 /* defined in test_progs.h */
 struct test_env env = {};
 
@@ -796,7 +798,7 @@ int main(int argc, char **argv)
        close(env.saved_netns_fd);
 
        if (env.succ_cnt + env.fail_cnt + env.skip_cnt == 0)
-               return EXIT_FAILURE;
+               return EXIT_NO_TEST;
 
        return env.fail_cnt ? EXIT_FAILURE : EXIT_SUCCESS;
 }