On Mon, Jul 6, 2020 at 10:00 AM Jesper Dangaard Brouer
<bro...@redhat.com> wrote:
>
> There are a number of places in test_progs that use minus-1 as the argument
> to exit(). This improper use as a process exit status is masked to be a
> number between 0 and 255 as defined in man exit(3).

nit: I wouldn't call it improper use, as it's a well defined behavior
(lower byte of returned integer).

>
> This patch use two different positive exit codes instead, to allow a shell

typo: uses

> script to tell the two error cases apart.
>
> Fixes: fd27b1835e70 ("selftests/bpf: Reset process and thread affinity after 
> each test/sub-test")
> Fixes: 811d7e375d08 ("bpf: selftests: Restore netns after each test")
> Signed-off-by: Jesper Dangaard Brouer <bro...@redhat.com>
> ---
>  tools/testing/selftests/bpf/test_progs.c |   12 +++++++-----
>  1 file changed, 7 insertions(+), 5 deletions(-)
>
> diff --git a/tools/testing/selftests/bpf/test_progs.c 
> b/tools/testing/selftests/bpf/test_progs.c
> index e8f7cd5dbae4..50803b080593 100644
> --- a/tools/testing/selftests/bpf/test_progs.c
> +++ b/tools/testing/selftests/bpf/test_progs.c
> @@ -12,7 +12,9 @@
>  #include <string.h>
>  #include <execinfo.h> /* backtrace */
>
> -#define EXIT_NO_TEST 2
> +#define EXIT_NO_TEST           2
> +#define EXIT_ERR_NETNS         3
> +#define EXIT_ERR_RESET_AFFINITY        4

Let's not overdo this with too granular error codes? All of those seem
to be just a failure, is there any practical need to differentiate
between NETNS vs RESET_AFFINITY failure?

I'd go with 3 values:

1 - at least one test failed
2 - no tests were selected
3 - "infra" (not a test-specific failure) error (like netns or affinity failed).

Thoughts?


[...]

Reply via email to