selftests/bpf: Count tests skipped by unpriv
authorJoe Stringer <joe@wand.net.nz>
Wed, 14 Feb 2018 21:50:35 +0000 (13:50 -0800)
committerDaniel Borkmann <daniel@iogearbox.net>
Thu, 15 Feb 2018 09:22:55 +0000 (10:22 +0100)
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>
tools/testing/selftests/bpf/test_verifier.c

index 6cf9bd6..7ab0252 100644 (file)
@@ -11378,7 +11378,7 @@ out:
 
 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];
@@ -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;
 }