[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tip-04c31bcf86c4fa51022ec254827f1c7c41306167@git.kernel.org>
Date: Thu, 20 Jul 2017 01:51:53 -0700
From: tip-bot for Jiri Olsa <tipbot@...or.com>
To: linux-tip-commits@...r.kernel.org
Cc: jolsa@...nel.org, dsahern@...il.com, hpa@...or.com,
tglx@...utronix.de, a.p.zijlstra@...llo.nl,
tmricht@...ux.vnet.ibm.com, namhyung@...nel.org, mingo@...nel.org,
linux-kernel@...r.kernel.org, acme@...hat.com
Subject: [tip:perf/core] perf tests attr: Make compare_data global
Commit-ID: 04c31bcf86c4fa51022ec254827f1c7c41306167
Gitweb: http://git.kernel.org/tip/04c31bcf86c4fa51022ec254827f1c7c41306167
Author: Jiri Olsa <jolsa@...nel.org>
AuthorDate: Mon, 3 Jul 2017 16:50:19 +0200
Committer: Arnaldo Carvalho de Melo <acme@...hat.com>
CommitDate: Tue, 18 Jul 2017 23:14:16 -0300
perf tests attr: Make compare_data global
Making compare_data global, so it could be used outside
the Test class scope to compare command results.
Signed-off-by: Jiri Olsa <jolsa@...nel.org>
Cc: David Ahern <dsahern@...il.com>
Cc: Namhyung Kim <namhyung@...nel.org>
Cc: Peter Zijlstra <a.p.zijlstra@...llo.nl>
Cc: Thomas Richter <tmricht@...ux.vnet.ibm.com>
Link: http://lkml.kernel.org/r/20170703145030.12903-5-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@...hat.com>
---
tools/perf/tests/attr.py | 36 ++++++++++++++++++------------------
1 file changed, 18 insertions(+), 18 deletions(-)
diff --git a/tools/perf/tests/attr.py b/tools/perf/tests/attr.py
index cdf21a9..bb671cd 100644
--- a/tools/perf/tests/attr.py
+++ b/tools/perf/tests/attr.py
@@ -9,6 +9,20 @@ import logging
import shutil
import ConfigParser
+def compare_data(a, b):
+ # Allow multiple values in assignment separated by '|'
+ a_list = a.split('|')
+ b_list = b.split('|')
+
+ for a_item in a_list:
+ for b_item in b_list:
+ if (a_item == b_item):
+ return True
+ elif (a_item == '*') or (b_item == '*'):
+ return True
+
+ return False
+
class Fail(Exception):
def __init__(self, test, msg):
self.msg = msg
@@ -82,26 +96,12 @@ class Event(dict):
self.add(base)
self.add(data)
- def compare_data(self, a, b):
- # Allow multiple values in assignment separated by '|'
- a_list = a.split('|')
- b_list = b.split('|')
-
- for a_item in a_list:
- for b_item in b_list:
- if (a_item == b_item):
- return True
- elif (a_item == '*') or (b_item == '*'):
- return True
-
- return False
-
def equal(self, other):
for t in Event.terms:
log.debug(" [%s] %s %s" % (t, self[t], other[t]));
if not self.has_key(t) or not other.has_key(t):
return False
- if not self.compare_data(self[t], other[t]):
+ if not compare_data(self[t], other[t]):
return False
return True
@@ -109,7 +109,7 @@ class Event(dict):
for t in Event.terms:
if not self.has_key(t) or not other.has_key(t):
continue
- if not self.compare_data(self[t], other[t]):
+ if not compare_data(self[t], other[t]):
log.warning("expected %s=%s, got %s" % (t, self[t], other[t]))
# Test file description needs to have following sections:
@@ -218,9 +218,9 @@ class Test(object):
self.perf, self.command, tempdir, self.args)
ret = os.WEXITSTATUS(os.system(cmd))
- log.info(" '%s' ret %d " % (cmd, ret))
+ log.info(" '%s' ret '%s', expected '%s'" % (cmd, str(ret), str(self.ret)))
- if ret != int(self.ret):
+ if not compare_data(str(ret), str(self.ret)):
raise Unsup(self)
def compare(self, expect, result):
Powered by blists - more mailing lists