aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2013-01-24 14:22:55 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2013-01-24 14:40:53 -0500
commit2ae828786c65ab8f587647bd0f22f8fe00f1f238 (patch)
tree130c1b4464f1eb685e56ff2ce122e3e36bb52e88 /tools
parentffe0fb769a6db3b6027d9228b6fecb6b352e4834 (diff)
perf test: Allow skipping tests
Sometimes a test is problematic for some reason and one wants to skip it, for instance: [root@sandy ~]# perf test 1: vmlinux symtab matches kallsyms : Ok 2: detect open syscall event : Ok 3: detect open syscall event on all cpus : Ok 4: read samples using the mmap interface : Ok 5: parse events tests : Warning: bad op token { Warning: bad op token { Warning: bad op token { Warning: bad op token { Warning: bad op token { Warning: function is_writable_pte not defined Segmentation fault (core dumped) So now we can use -s/--skip while the problematic tests are being fixed, allowing us to test all the other entries: [root@sandy ~]# perf test -s 5 1: vmlinux symtab matches kallsyms : Ok 2: detect open syscall event : Ok 3: detect open syscall event on all cpus : Ok 4: read samples using the mmap interface : Ok 5: parse events tests : Skip (user override) 6: x86 rdpmc test : Ok 7: Validate PERF_RECORD_* events & perf_sample fields : Ok 8: Test perf pmu format parsing : Ok 9: Test dso data interface : Ok 10: roundtrip evsel->name check : Ok 11: Check parsing of sched tracepoints fields : Ok 12: Generate and check syscalls:sys_enter_open event fields: Ok 13: struct perf_event_attr setup : Ok 14: Test matching and linking mutliple hists : Ok 15: Try 'use perf' in python, checking link problems : Ok [root@sandy ~]# Cc: David Ahern <dsahern@gmail.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Namhyung Kim <namhyung@gmail.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Link: http://lkml.kernel.org/n/tip-klzd8p57jzdryafqkmlppcb1@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/Documentation/perf-test.txt4
-rw-r--r--tools/perf/tests/builtin-test.c17
2 files changed, 19 insertions, 2 deletions
diff --git a/tools/perf/Documentation/perf-test.txt b/tools/perf/Documentation/perf-test.txt
index b24ac40fcd58..d1d3e5121f89 100644
--- a/tools/perf/Documentation/perf-test.txt
+++ b/tools/perf/Documentation/perf-test.txt
@@ -23,6 +23,10 @@ from 'perf test list'.
23 23
24OPTIONS 24OPTIONS
25------- 25-------
26-s::
27--skip::
28 Tests to skip (comma separater numeric list).
29
26-v:: 30-v::
27--verbose:: 31--verbose::
28 Be more verbose. 32 Be more verbose.
diff --git a/tools/perf/tests/builtin-test.c b/tools/perf/tests/builtin-test.c
index 6a5dee2377b0..acb98e0e39f2 100644
--- a/tools/perf/tests/builtin-test.c
+++ b/tools/perf/tests/builtin-test.c
@@ -4,6 +4,7 @@
4 * Builtin regression testing command: ever growing number of sanity tests 4 * Builtin regression testing command: ever growing number of sanity tests
5 */ 5 */
6#include "builtin.h" 6#include "builtin.h"
7#include "intlist.h"
7#include "tests.h" 8#include "tests.h"
8#include "debug.h" 9#include "debug.h"
9#include "color.h" 10#include "color.h"
@@ -105,7 +106,7 @@ static bool perf_test__matches(int curr, int argc, const char *argv[])
105 return false; 106 return false;
106} 107}
107 108
108static int __cmd_test(int argc, const char *argv[]) 109static int __cmd_test(int argc, const char *argv[], struct intlist *skiplist)
109{ 110{
110 int i = 0; 111 int i = 0;
111 int width = 0; 112 int width = 0;
@@ -126,6 +127,12 @@ static int __cmd_test(int argc, const char *argv[])
126 continue; 127 continue;
127 128
128 pr_info("%2d: %-*s:", i, width, tests[curr].desc); 129 pr_info("%2d: %-*s:", i, width, tests[curr].desc);
130
131 if (intlist__find(skiplist, i)) {
132 color_fprintf(stderr, PERF_COLOR_YELLOW, " Skip (user override)\n");
133 continue;
134 }
135
129 pr_debug("\n--- start ---\n"); 136 pr_debug("\n--- start ---\n");
130 err = tests[curr].func(); 137 err = tests[curr].func();
131 pr_debug("---- end ----\n%s:", tests[curr].desc); 138 pr_debug("---- end ----\n%s:", tests[curr].desc);
@@ -169,11 +176,14 @@ int cmd_test(int argc, const char **argv, const char *prefix __maybe_unused)
169 "perf test [<options>] [{list <test-name-fragment>|[<test-name-fragments>|<test-numbers>]}]", 176 "perf test [<options>] [{list <test-name-fragment>|[<test-name-fragments>|<test-numbers>]}]",
170 NULL, 177 NULL,
171 }; 178 };
179 const char *skip = NULL;
172 const struct option test_options[] = { 180 const struct option test_options[] = {
181 OPT_STRING('s', "skip", &skip, "tests", "tests to skip"),
173 OPT_INCR('v', "verbose", &verbose, 182 OPT_INCR('v', "verbose", &verbose,
174 "be more verbose (show symbol address, etc)"), 183 "be more verbose (show symbol address, etc)"),
175 OPT_END() 184 OPT_END()
176 }; 185 };
186 struct intlist *skiplist = NULL;
177 187
178 argc = parse_options(argc, argv, test_options, test_usage, 0); 188 argc = parse_options(argc, argv, test_options, test_usage, 0);
179 if (argc >= 1 && !strcmp(argv[0], "list")) 189 if (argc >= 1 && !strcmp(argv[0], "list"))
@@ -186,5 +196,8 @@ int cmd_test(int argc, const char **argv, const char *prefix __maybe_unused)
186 if (symbol__init() < 0) 196 if (symbol__init() < 0)
187 return -1; 197 return -1;
188 198
189 return __cmd_test(argc, argv); 199 if (skip != NULL)
200 skiplist = intlist__new(skip);
201
202 return __cmd_test(argc, argv, skiplist);
190} 203}