perf test: Make --skip work on shell tests
authorRiccardo Mancini <rickyman7@gmail.com>
Wed, 11 Aug 2021 18:06:26 +0000 (20:06 +0200)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Wed, 11 Aug 2021 18:45:08 +0000 (15:45 -0300)
perf-test has the option --skip to provide a list of tests to skip.
However, this option does not work with shell scripts.

This patch passes the skiplist to run_shell_tests, so that also shell
scripts could be skipped using --skip.

Committer tests:

Tests 79 onwards are shell tests:

Before:

  # perf test --skip 1,2,81,82,84,88,90
   1: vmlinux symtab matches kallsyms                                 : Skip (user override)
   2: Detect openat syscall event                                     : Skip (user override)
   3: Detect openat syscall event on all cpus                         : Ok
   4: Read samples using the mmap interface                           : Ok
   5: Test data source output                                         : Ok
  <SNIP>
  78: x86 Sample parsing                                              : Ok
  79: build id cache operations                                       : Ok
  80: daemon operations                                               : Ok
  81: perf pipe recording and injection test                          : Ok
  82: Add vfs_getname probe to get syscall args filenames             : FAILED!
  83: probe libc's inet_pton & backtrace it with ping                 : Ok
  84: Use vfs_getname probe to get syscall args filenames             : FAILED!
  85: Zstd perf.data compression/decompression                        : Ok
  86: perf stat csv summary test                                      : Ok
  87: perf stat metrics (shadow stat) test                            : Ok
  88: perf stat --bpf-counters test                                   : Ok
  89: Check Arm CoreSight trace data recording and synthesized samples: Skip
  90: Check open filename arg using perf trace + vfs_getname          : FAILED!
  #

After:

  # perf test --skip 1,2,81,82,84,88,90
   1: vmlinux symtab matches kallsyms                                 : Skip (user override)
   2: Detect openat syscall event                                     : Skip (user override)
   3: Detect openat syscall event on all cpus                         : Ok
   4: Read samples using the mmap interface                           : Ok
   5: Test data source output                                         : Ok
  <SNIP>
  78: x86 Sample parsing                                              : Ok
  79: build id cache operations                                       : Ok
  80: daemon operations                                               : Ok
  81: perf pipe recording and injection test                          : Skip (user override)
  82: Add vfs_getname probe to get syscall args filenames             : Skip (user override)
  83: probe libc's inet_pton & backtrace it with ping                 : Ok
  84: Use vfs_getname probe to get syscall args filenames             : Skip (user override)
  85: Zstd perf.data compression/decompression                        : Ok
  86: perf stat csv summary test                                      : Ok
  87: perf stat metrics (shadow stat) test                            : Ok
  88: perf stat --bpf-counters test                                   : Skip (user override)
  89: Check Arm CoreSight trace data recording and synthesized samples: Skip
  90: Check open filename arg using perf trace + vfs_getname          : Skip (user override)
  #

Signed-off-by: Riccardo Mancini <rickyman7@gmail.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lore.kernel.org/lkml/20210811180625.160944-1-rickyman7@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/tests/builtin-test.c

index fb5846d..da7dc5e 100644 (file)
@@ -598,7 +598,8 @@ static int shell_test__run(struct test *test, int subdir __maybe_unused)
        return WEXITSTATUS(err) == 2 ? TEST_SKIP : TEST_FAIL;
 }
 
-static int run_shell_tests(int argc, const char *argv[], int i, int width)
+static int run_shell_tests(int argc, const char *argv[], int i, int width,
+                               struct intlist *skiplist)
 {
        struct dirent **entlist;
        struct dirent *ent;
@@ -632,6 +633,12 @@ static int run_shell_tests(int argc, const char *argv[], int i, int width)
 
                st.file = ent->d_name;
                pr_info("%2d: %-*s:", i, width, test.desc);
+
+               if (intlist__find(skiplist, i)) {
+                       color_fprintf(stderr, PERF_COLOR_YELLOW, " Skip (user override)\n");
+                       continue;
+               }
+
                test_and_print(&test, false, -1);
        }
 
@@ -731,7 +738,7 @@ static int __cmd_test(int argc, const char *argv[], struct intlist *skiplist)
                }
        }
 
-       return run_shell_tests(argc, argv, i, width);
+       return run_shell_tests(argc, argv, i, width, skiplist);
 }
 
 static int perf_test__list_shell(int argc, const char **argv, int i)