aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf')
-rw-r--r--tools/perf/tests/attr.c2
-rw-r--r--tools/perf/tests/attr.py29
-rw-r--r--tools/perf/tests/attr/base-record1
-rw-r--r--tools/perf/tests/attr/base-stat1
4 files changed, 18 insertions, 15 deletions
diff --git a/tools/perf/tests/attr.c b/tools/perf/tests/attr.c
index 6fa84b7065cd..6e2feee8db2a 100644
--- a/tools/perf/tests/attr.c
+++ b/tools/perf/tests/attr.c
@@ -126,8 +126,6 @@ static int store_event(struct perf_event_attr *attr, pid_t pid, int cpu,
126 WRITE_ASS(sample_regs_user, "llu"); 126 WRITE_ASS(sample_regs_user, "llu");
127 WRITE_ASS(sample_stack_user, PRIu32); 127 WRITE_ASS(sample_stack_user, PRIu32);
128 128
129 __WRITE_ASS(optional, "d", 0);
130
131 fclose(file); 129 fclose(file);
132 return 0; 130 return 0;
133} 131}
diff --git a/tools/perf/tests/attr.py b/tools/perf/tests/attr.py
index 28c0481bc984..9b25b33cf3e9 100644
--- a/tools/perf/tests/attr.py
+++ b/tools/perf/tests/attr.py
@@ -75,6 +75,7 @@ class Event(dict):
75 self.add(data) 75 self.add(data)
76 76
77 def compare_data(self, a, b): 77 def compare_data(self, a, b):
78 # Allow multiple values in assignment separated by '|'
78 a_list = a.split('|') 79 a_list = a.split('|')
79 b_list = b.split('|') 80 b_list = b.split('|')
80 81
@@ -96,12 +97,17 @@ class Event(dict):
96 return False 97 return False
97 return True 98 return True
98 99
99 def is_optional(self): 100# Test file description needs to have following sections:
100 if self['optional'] == '1': 101# [config]
101 return True 102# - just single instance in file
102 else: 103# - needs to specify:
103 return False 104# 'command' - perf command name
104 105# 'args' - special command arguments
106# 'ret' - expected command return value (0 by default)
107#
108# [eventX:base]
109# - one or multiple instances in file
110# - expected values assignments
105class Test(object): 111class Test(object):
106 def __init__(self, path, options): 112 def __init__(self, path, options):
107 parser = ConfigParser.SafeConfigParser() 113 parser = ConfigParser.SafeConfigParser()
@@ -135,11 +141,15 @@ class Test(object):
135 parser_event = ConfigParser.SafeConfigParser() 141 parser_event = ConfigParser.SafeConfigParser()
136 parser_event.read(path) 142 parser_event.read(path)
137 143
144 # The event record section header contains 'event' word,
145 # optionaly followed by ':' allowing to load 'parent
146 # event' first as a base
138 for section in filter(self.is_event, parser_event.sections()): 147 for section in filter(self.is_event, parser_event.sections()):
139 148
140 parser_items = parser_event.items(section); 149 parser_items = parser_event.items(section);
141 base_items = {} 150 base_items = {}
142 151
152 # Read parent event if there's any
143 if (':' in section): 153 if (':' in section):
144 base = section[section.index(':') + 1:] 154 base = section[section.index(':') + 1:]
145 parser_base = ConfigParser.SafeConfigParser() 155 parser_base = ConfigParser.SafeConfigParser()
@@ -177,11 +187,10 @@ class Test(object):
177 else: 187 else:
178 log.debug(" ->FAIL"); 188 log.debug(" ->FAIL");
179 189
180 log.info(" match: [%s] optional(%d) matches %s" % 190 log.info(" match: [%s] matches %s" % (exp_name, str(exp_list)))
181 (exp_name, exp_event.is_optional(), str(exp_list)))
182 191
183 # we did not any matching event - fail 192 # we did not any matching event - fail
184 if (not exp_list) and (not exp_event.is_optional()): 193 if (not exp_list):
185 raise Fail(self, 'match failure'); 194 raise Fail(self, 'match failure');
186 195
187 match[exp_name] = exp_list 196 match[exp_name] = exp_list
@@ -194,8 +203,6 @@ class Test(object):
194 if (group == ''): 203 if (group == ''):
195 continue 204 continue
196 205
197 # XXX group matching does not account for
198 # optional events as above matching does
199 for res_name in match[exp_name]: 206 for res_name in match[exp_name]:
200 res_group = result[res_name].group 207 res_group = result[res_name].group
201 if res_group not in match[group]: 208 if res_group not in match[group]:
diff --git a/tools/perf/tests/attr/base-record b/tools/perf/tests/attr/base-record
index 8262794734e0..f1485d8e6a0b 100644
--- a/tools/perf/tests/attr/base-record
+++ b/tools/perf/tests/attr/base-record
@@ -37,4 +37,3 @@ config2=0
37branch_sample_type=0 37branch_sample_type=0
38sample_regs_user=0 38sample_regs_user=0
39sample_stack_user=0 39sample_stack_user=0
40optional=0
diff --git a/tools/perf/tests/attr/base-stat b/tools/perf/tests/attr/base-stat
index 46f8851eaf4e..4bd79a82784f 100644
--- a/tools/perf/tests/attr/base-stat
+++ b/tools/perf/tests/attr/base-stat
@@ -37,4 +37,3 @@ config2=0
37branch_sample_type=0 37branch_sample_type=0
38sample_regs_user=0 38sample_regs_user=0
39sample_stack_user=0 39sample_stack_user=0
40optional=0