public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: tip-bot for Jiri Olsa <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: acme@redhat.com, tmricht@linux.vnet.ibm.com,
	linux-kernel@vger.kernel.org, dsahern@gmail.com,
	namhyung@kernel.org, hpa@zytor.com, a.p.zijlstra@chello.nl,
	jolsa@kernel.org, mingo@kernel.org, tglx@linutronix.de
Subject: [tip:perf/core] perf tests attr: Add optional term
Date: Thu, 20 Jul 2017 01:55:17 -0700	[thread overview]
Message-ID: <tip-1f41873c22826fc92d4bb03c58cf44664fdc3bb8@git.kernel.org> (raw)
In-Reply-To: <20170703145030.12903-15-jolsa@kernel.org>

Commit-ID:  1f41873c22826fc92d4bb03c58cf44664fdc3bb8
Gitweb:     http://git.kernel.org/tip/1f41873c22826fc92d4bb03c58cf44664fdc3bb8
Author:     Jiri Olsa <jolsa@kernel.org>
AuthorDate: Mon, 3 Jul 2017 16:50:29 +0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 18 Jul 2017 23:14:22 -0300

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>
---
 tools/perf/tests/attr.py                   | 14 +++++++++++---
 tools/perf/tests/attr/test-stat-default    |  2 ++
 tools/perf/tests/attr/test-stat-detailed-1 |  2 ++
 tools/perf/tests/attr/test-stat-detailed-2 |  3 +++
 tools/perf/tests/attr/test-stat-detailed-3 |  5 +++++
 5 files changed, 23 insertions(+), 3 deletions(-)

diff --git a/tools/perf/tests/attr.py b/tools/perf/tests/attr.py
index b03261c..6bb50e8 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
 
diff --git a/tools/perf/tests/attr/test-stat-default b/tools/perf/tests/attr/test-stat-default
index 19270f5..e911dbd 100644
--- a/tools/perf/tests/attr/test-stat-default
+++ b/tools/perf/tests/attr/test-stat-default
@@ -38,12 +38,14 @@ config=0
 fd=6
 type=0
 config=7
+optional=1
 
 # PERF_TYPE_HARDWARE / PERF_COUNT_HW_STALLED_CYCLES_BACKEND
 [event7:base-stat]
 fd=7
 type=0
 config=8
+optional=1
 
 # PERF_TYPE_HARDWARE / PERF_COUNT_HW_INSTRUCTIONS
 [event8:base-stat]
diff --git a/tools/perf/tests/attr/test-stat-detailed-1 b/tools/perf/tests/attr/test-stat-detailed-1
index 51426b8..b39270a 100644
--- a/tools/perf/tests/attr/test-stat-detailed-1
+++ b/tools/perf/tests/attr/test-stat-detailed-1
@@ -39,12 +39,14 @@ config=0
 fd=6
 type=0
 config=7
+optional=1
 
 # PERF_TYPE_HARDWARE / PERF_COUNT_HW_STALLED_CYCLES_BACKEND
 [event7:base-stat]
 fd=7
 type=0
 config=8
+optional=1
 
 # PERF_TYPE_HARDWARE / PERF_COUNT_HW_INSTRUCTIONS
 [event8:base-stat]
diff --git a/tools/perf/tests/attr/test-stat-detailed-2 b/tools/perf/tests/attr/test-stat-detailed-2
index 8de5acc..45f8e6e 100644
--- a/tools/perf/tests/attr/test-stat-detailed-2
+++ b/tools/perf/tests/attr/test-stat-detailed-2
@@ -39,12 +39,14 @@ config=0
 fd=6
 type=0
 config=7
+optional=1
 
 # PERF_TYPE_HARDWARE / PERF_COUNT_HW_STALLED_CYCLES_BACKEND
 [event7:base-stat]
 fd=7
 type=0
 config=8
+optional=1
 
 # PERF_TYPE_HARDWARE / PERF_COUNT_HW_INSTRUCTIONS
 [event8:base-stat]
@@ -108,6 +110,7 @@ config=65538
 fd=15
 type=3
 config=1
+optional=1
 
 # PERF_TYPE_HW_CACHE,
 #  PERF_COUNT_HW_CACHE_L1I                <<  0  |
diff --git a/tools/perf/tests/attr/test-stat-detailed-3 b/tools/perf/tests/attr/test-stat-detailed-3
index 0a1f45b..30ae0fb 100644
--- a/tools/perf/tests/attr/test-stat-detailed-3
+++ b/tools/perf/tests/attr/test-stat-detailed-3
@@ -39,12 +39,14 @@ config=0
 fd=6
 type=0
 config=7
+optional=1
 
 # PERF_TYPE_HARDWARE / PERF_COUNT_HW_STALLED_CYCLES_BACKEND
 [event7:base-stat]
 fd=7
 type=0
 config=8
+optional=1
 
 # PERF_TYPE_HARDWARE / PERF_COUNT_HW_INSTRUCTIONS
 [event8:base-stat]
@@ -108,6 +110,7 @@ config=65538
 fd=15
 type=3
 config=1
+optional=1
 
 # PERF_TYPE_HW_CACHE,
 #  PERF_COUNT_HW_CACHE_L1I                <<  0  |
@@ -162,6 +165,7 @@ config=65540
 fd=21
 type=3
 config=512
+optional=1
 
 # PERF_TYPE_HW_CACHE,
 #  PERF_COUNT_HW_CACHE_L1D                <<  0  |
@@ -171,3 +175,4 @@ config=512
 fd=22
 type=3
 config=66048
+optional=1

  reply	other threads:[~2017-07-20  8:57 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-03 14:50 [PATCH 00/15] perf tools: Fix attr tests Jiri Olsa
2017-07-03 14:50 ` [PATCH 01/15] perf tools: Fix -n option Jiri Olsa
2017-07-03 14:57   ` Arnaldo Carvalho de Melo
2017-07-03 15:16     ` [PATCHv2 " Jiri Olsa
2017-07-03 16:10       ` Arnaldo Carvalho de Melo
2017-07-03 16:22         ` Jiri Olsa
2017-07-03 16:40           ` Arnaldo Carvalho de Melo
2017-07-03 16:58             ` Jiri Olsa
2017-07-03 17:44               ` Arnaldo Carvalho de Melo
2017-07-03 14:50 ` [PATCH 02/15] perf tests attr: Do not store failed events Jiri Olsa
2017-07-20  8:51   ` [tip:perf/core] " tip-bot for Jiri Olsa
2017-07-03 14:50 ` [PATCH 03/15] perf tests attr: Add test_attr__ready function Jiri Olsa
2017-07-20  8:51   ` [tip:perf/core] " tip-bot for Jiri Olsa
2017-07-03 14:50 ` [PATCH 04/15] perf tests attr: Make compare_data global Jiri Olsa
2017-07-20  8:51   ` [tip:perf/core] " tip-bot for Jiri Olsa
2017-07-03 14:50 ` [PATCH 05/15] perf tests attr: Rename compare_data to data_equal Jiri Olsa
2017-07-20  8:52   ` [tip:perf/core] " tip-bot for Jiri Olsa
2017-07-03 14:50 ` [PATCH 06/15] perf tests attr: Add 1s for exclude_kernel and task base bits Jiri Olsa
2017-07-20  8:52   ` [tip:perf/core] " tip-bot for Jiri Olsa
2017-07-03 14:50 ` [PATCH 07/15] perf tests attr: Fix record dwarf test Jiri Olsa
2017-07-20  8:52   ` [tip:perf/core] " tip-bot for Jiri Olsa
2017-07-03 14:50 ` [PATCH 08/15] perf tests attr: Fix no-delay test Jiri Olsa
2017-07-20  8:53   ` [tip:perf/core] " tip-bot for Jiri Olsa
2017-07-03 14:50 ` [PATCH 09/15] perf tests attr: Add proper return values Jiri Olsa
2017-07-20  8:53   ` [tip:perf/core] " tip-bot for Jiri Olsa
2017-07-03 14:50 ` [PATCH 10/15] perf tests attr: Fix cpu test disabled term setup Jiri Olsa
2017-07-20  8:53   ` [tip:perf/core] " tip-bot for Jiri Olsa
2017-07-03 14:50 ` [PATCH 11/15] perf tests attr: Fix sample_period setup Jiri Olsa
2017-07-20  8:54   ` [tip:perf/core] " tip-bot for Jiri Olsa
2017-07-03 14:50 ` [PATCH 12/15] perf tests attr: Fix precise_ip setup Jiri Olsa
2017-07-20  8:54   ` [tip:perf/core] " tip-bot for Jiri Olsa
2017-07-03 14:50 ` [PATCH 13/15] perf tests attr: Fix stat sample_type setup Jiri Olsa
2017-07-20  8:54   ` [tip:perf/core] " tip-bot for Jiri Olsa
2017-07-03 14:50 ` [PATCH 14/15] perf tests attr: Add optional term Jiri Olsa
2017-07-20  8:55   ` tip-bot for Jiri Olsa [this message]
2017-07-03 14:50 ` [PATCH 15/15] perf tests attr: Fix task term values Jiri Olsa
2017-08-09 15:00   ` Jiri Olsa
2017-08-10  7:07     ` Thomas Richter
2017-10-03 16:43   ` [tip:perf/core] " tip-bot for Jiri Olsa
2017-07-17 12:18 ` [PATCH 00/15] perf tools: Fix attr tests Jiri Olsa
2017-07-17 12:51   ` Arnaldo Carvalho de Melo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=tip-1f41873c22826fc92d4bb03c58cf44664fdc3bb8@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@redhat.com \
    --cc=dsahern@gmail.com \
    --cc=hpa@zytor.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    --cc=tglx@linutronix.de \
    --cc=tmricht@linux.vnet.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox