diff options
author | Jiri Olsa <jolsa@kernel.org> | 2017-07-03 16:50:29 +0200 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2017-07-19 04:14:22 +0200 |
commit | 1f41873c22826fc92d4bb03c58cf44664fdc3bb8 (patch) | |
tree | 5f1ee697b04e989d1c154380c49b182b57aeab01 /tools/perf/tests/attr.py | |
parent | perf tests attr: Fix stat sample_type setup (diff) | |
download | linux-1f41873c22826fc92d4bb03c58cf44664fdc3bb8.tar.xz linux-1f41873c22826fc92d4bb03c58cf44664fdc3bb8.zip |
perf tests attr: Add optional term
Some of the stat events are quite rare to find on common machines (like
front end cycles).
Adding an 'optional' term to mark such events in attr tests. Event
marked as optional will not fail the test case if it's not found in
results.
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Thomas Richter <tmricht@linux.vnet.ibm.com>
Link: http://lkml.kernel.org/r/20170703145030.12903-15-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/tests/attr.py')
-rw-r--r-- | tools/perf/tests/attr.py | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/tools/perf/tests/attr.py b/tools/perf/tests/attr.py index b03261c6b1ed..6bb50e82a3e3 100644 --- a/tools/perf/tests/attr.py +++ b/tools/perf/tests/attr.py @@ -105,6 +105,11 @@ class Event(dict): return False return True + def optional(self): + if self.has_key('optional') and self['optional'] == '1': + return True + return False + def diff(self, other): for t in Event.terms: if not self.has_key(t) or not other.has_key(t): @@ -244,9 +249,12 @@ class Test(object): log.debug(" match: [%s] matches %s" % (exp_name, str(exp_list))) # we did not any matching event - fail - if (not exp_list): - exp_event.diff(res_event) - raise Fail(self, 'match failure'); + if not exp_list: + if exp_event.optional(): + log.debug(" %s does not match, but is optional" % exp_name) + else: + exp_event.diff(res_event) + raise Fail(self, 'match failure'); match[exp_name] = exp_list |