Skip to content

Commit

Permalink
selftests/bpf: Count tests skipped by unpriv
Browse files Browse the repository at this point in the history
When priviliged tests are skipped due to user rights, count the number of
skipped tests so it's more obvious that the test did not check everything.

Signed-off-by: Joe Stringer <joe@wand.net.nz>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
  • Loading branch information
Joe Stringer authored and Daniel Borkmann committed Feb 15, 2018
1 parent 95f87a9 commit d0a0e49
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions tools/testing/selftests/bpf/test_verifier.c
Original file line number Diff line number Diff line change
Expand Up @@ -11378,7 +11378,7 @@ static int set_admin(bool admin)

static int do_test(bool unpriv, unsigned int from, unsigned int to)
{
int i, passes = 0, errors = 0;
int i, passes = 0, errors = 0, skips = 0;

for (i = from; i < to; i++) {
struct bpf_test *test = &tests[i];
Expand All @@ -11395,13 +11395,17 @@ static int do_test(bool unpriv, unsigned int from, unsigned int to)
set_admin(true);
}

if (!unpriv) {
if (unpriv) {
printf("#%d/p %s SKIP\n", i, test->descr);
skips++;
} else {
printf("#%d/p %s ", i, test->descr);
do_test_single(test, false, &passes, &errors);
}
}

printf("Summary: %d PASSED, %d FAILED\n", passes, errors);
printf("Summary: %d PASSED, %d SKIPPED, %d FAILED\n", passes,
skips, errors);
return errors ? EXIT_FAILURE : EXIT_SUCCESS;
}

Expand Down

0 comments on commit d0a0e49

Please sign in to comment.