Message ID | 159363984736.930467.17956007131403952343.stgit@firesoul |
---|---|
State | Accepted |
Delegated to: | BPF Maintainers |
Headers | show |
Series | BPF selftests test runner test_progs improvement for scripting | expand |
On Wed, Jul 1, 2020 at 2:44 PM Jesper Dangaard Brouer <brouer@redhat.com> wrote: > > 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> > --- Acked-by: Andrii Nakryiko <andriin@fb.com> > tools/testing/selftests/bpf/test_progs.c | 3 +++ > 1 file changed, 3 insertions(+) > [...]
On Wed, 01 Jul 2020 23:44:07 +0200 Jesper Dangaard Brouer <brouer@redhat.com> wrote: > 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> > --- > tools/testing/selftests/bpf/test_progs.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/tools/testing/selftests/bpf/test_progs.c b/tools/testing/selftests/bpf/test_progs.c > index 54fa5fa688ce..da70a4f72f54 100644 > --- a/tools/testing/selftests/bpf/test_progs.c > +++ b/tools/testing/selftests/bpf/test_progs.c > @@ -687,5 +687,8 @@ int main(int argc, char **argv) > free_str_set(&env.subtest_selector.whitelist); > free(env.subtest_selector.num_set); > > + if (env.succ_cnt + env.fail_cnt + env.skip_cnt == 0) > + return EXIT_FAILURE; We should use another return code as indication, else the shell script cannot tell the difference between no-test-selected and failed-test. Normally I would request a V4 (from myself I guess), but this have already been merged, so I'll send a followup patch. > + > return env.fail_cnt ? EXIT_FAILURE : EXIT_SUCCESS; > } >
diff --git a/tools/testing/selftests/bpf/test_progs.c b/tools/testing/selftests/bpf/test_progs.c index 54fa5fa688ce..da70a4f72f54 100644 --- a/tools/testing/selftests/bpf/test_progs.c +++ b/tools/testing/selftests/bpf/test_progs.c @@ -687,5 +687,8 @@ int main(int argc, char **argv) free_str_set(&env.subtest_selector.whitelist); 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; }
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> --- tools/testing/selftests/bpf/test_progs.c | 3 +++ 1 file changed, 3 insertions(+)