All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] perf test: make --skip work on shell tests
@ 2021-08-11 18:06 Riccardo Mancini
  2021-08-11 18:40 ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 3+ messages in thread
From: Riccardo Mancini @ 2021-08-11 18:06 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Ian Rogers, Namhyung Kim, Peter Zijlstra, Ingo Molnar,
	Mark Rutland, Jiri Olsa, linux-kernel, linux-perf-users,
	Riccardo Mancini

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.

Signed-off-by: Riccardo Mancini <rickyman7@gmail.com>
---
 tools/perf/tests/builtin-test.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/tools/perf/tests/builtin-test.c b/tools/perf/tests/builtin-test.c
index 5e6242576236325c..fb4a75cc8fa9530e 100644
--- a/tools/perf/tests/builtin-test.c
+++ b/tools/perf/tests/builtin-test.c
@@ -594,7 +594,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;
@@ -628,6 +629,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);
 	}
 
@@ -727,7 +734,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)
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] perf test: make --skip work on shell tests
  2021-08-11 18:06 [PATCH] perf test: make --skip work on shell tests Riccardo Mancini
@ 2021-08-11 18:40 ` Arnaldo Carvalho de Melo
  2021-08-11 19:02   ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 3+ messages in thread
From: Arnaldo Carvalho de Melo @ 2021-08-11 18:40 UTC (permalink / raw)
  To: Riccardo Mancini
  Cc: Ian Rogers, Namhyung Kim, Peter Zijlstra, Ingo Molnar,
	Mark Rutland, Jiri Olsa, linux-kernel, linux-perf-users

Em Wed, Aug 11, 2021 at 08:06:26PM +0200, Riccardo Mancini escreveu:
> 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.

In such cases please provide an example of the usage you're fixing, what
was it that you tried that didn't work and that now works?

Its obviously a fix, so I'm applying it.

- Arnaldo
 
> Signed-off-by: Riccardo Mancini <rickyman7@gmail.com>
> ---
>  tools/perf/tests/builtin-test.c | 11 +++++++++--
>  1 file changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/perf/tests/builtin-test.c b/tools/perf/tests/builtin-test.c
> index 5e6242576236325c..fb4a75cc8fa9530e 100644
> --- a/tools/perf/tests/builtin-test.c
> +++ b/tools/perf/tests/builtin-test.c
> @@ -594,7 +594,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;
> @@ -628,6 +629,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);
>  	}
>  
> @@ -727,7 +734,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)
> -- 
> 2.31.1
> 

-- 

- Arnaldo

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] perf test: make --skip work on shell tests
  2021-08-11 18:40 ` Arnaldo Carvalho de Melo
@ 2021-08-11 19:02   ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 3+ messages in thread
From: Arnaldo Carvalho de Melo @ 2021-08-11 19:02 UTC (permalink / raw)
  To: Riccardo Mancini
  Cc: Ian Rogers, Namhyung Kim, Peter Zijlstra, Ingo Molnar,
	Mark Rutland, Jiri Olsa, linux-kernel, linux-perf-users

Em Wed, Aug 11, 2021 at 03:40:40PM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Wed, Aug 11, 2021 at 08:06:26PM +0200, Riccardo Mancini escreveu:
> > 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.
> 
> In such cases please provide an example of the usage you're fixing, what
> was it that you tried that didn't work and that now works?
> 
> Its obviously a fix, so I'm applying it.

So I added this to the commit log:

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>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-08-11 19:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-11 18:06 [PATCH] perf test: make --skip work on shell tests Riccardo Mancini
2021-08-11 18:40 ` Arnaldo Carvalho de Melo
2021-08-11 19:02   ` Arnaldo Carvalho de Melo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.