perf test: Use skip in vmlinux kallsyms
authorIan Rogers <irogers@google.com>
Wed, 18 May 2022 04:20:21 +0000 (21:20 -0700)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Mon, 23 May 2022 13:01:15 +0000 (10:01 -0300)
Currently failures in reading vmlinux or kallsyms result in a test
failure. However, the failure is typically permission related. Prefer to
flag these failures as skip.

Committer testing:

Before:

  $ perf test vmlinux
    1: vmlinux symtab matches kallsyms                 : FAILED!
  $

After:

  $ perf test vmlinux
    1: vmlinux symtab matches kallsyms                 : Skip
  $

Signed-off-by: Ian Rogers <irogers@google.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Carsten Haitzler <carsten.haitzler@arm.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: John Garry <john.garry@huawei.com>
Cc: Marco Elver <elver@google.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Michael Petlan <mpetlan@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Riccardo Mancini <rickyman7@gmail.com>
Cc: Sohaib Mohamed <sohaib.amhmd@gmail.com>
Cc: Stephane Eranian <eranian@google.com>
Link: https://lore.kernel.org/r/20220518042027.836799-3-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/tests/vmlinux-kallsyms.c

index 93dee54..4fd8d70 100644 (file)
@@ -114,7 +114,7 @@ static bool is_ignored_symbol(const char *name, char type)
 static int test__vmlinux_matches_kallsyms(struct test_suite *test __maybe_unused,
                                        int subtest __maybe_unused)
 {
-       int err = -1;
+       int err = TEST_FAIL;
        struct rb_node *nd;
        struct symbol *sym;
        struct map *kallsyms_map, *vmlinux_map, *map;
@@ -142,7 +142,8 @@ static int test__vmlinux_matches_kallsyms(struct test_suite *test __maybe_unused
         * and find the .ko files that match them in /lib/modules/`uname -r`/.
         */
        if (machine__create_kernel_maps(&kallsyms) < 0) {
-               pr_debug("machine__create_kernel_maps ");
+               pr_debug("machine__create_kernel_maps failed");
+               err = TEST_SKIP;
                goto out;
        }
 
@@ -158,7 +159,8 @@ static int test__vmlinux_matches_kallsyms(struct test_suite *test __maybe_unused
         * code and with the one got from /proc/modules from the "kallsyms" code.
         */
        if (machine__load_kallsyms(&kallsyms, "/proc/kallsyms") <= 0) {
-               pr_debug("dso__load_kallsyms ");
+               pr_debug("machine__load_kallsyms failed");
+               err = TEST_SKIP;
                goto out;
        }
 
@@ -178,7 +180,7 @@ static int test__vmlinux_matches_kallsyms(struct test_suite *test __maybe_unused
         * Now repeat step 2, this time for the vmlinux file we'll auto-locate.
         */
        if (machine__create_kernel_maps(&vmlinux) < 0) {
-               pr_debug("machine__create_kernel_maps ");
+               pr_info("machine__create_kernel_maps failed");
                goto out;
        }
 
@@ -196,7 +198,7 @@ static int test__vmlinux_matches_kallsyms(struct test_suite *test __maybe_unused
         * to fixup the symbols.
         */
        if (machine__load_vmlinux_path(&vmlinux) <= 0) {
-               pr_debug("Couldn't find a vmlinux that matches the kernel running on this machine, skipping test\n");
+               pr_info("Couldn't find a vmlinux that matches the kernel running on this machine, skipping test\n");
                err = TEST_SKIP;
                goto out;
        }