summaryrefslogtreecommitdiffstats
path: root/tools/perf/tests/shell/lib/perf_json_output_lint.py
diff options
context:
space:
mode:
authorMark Brown <broonie@kernel.org>2023-03-13 13:20:45 +0000
committerMark Brown <broonie@kernel.org>2023-03-13 13:20:45 +0000
commitb9d0bb8f1c2e5dce9b8a54fb77d1af4aa64a4c01 (patch)
tree1e8f106c57c2934eee422f8ee5e59e73015e2dc4 /tools/perf/tests/shell/lib/perf_json_output_lint.py
parent5bd73a162bc881dbb98ff9909dd865286852ee2b (diff)
parenteeac8ede17557680855031c6f305ece2378af326 (diff)
downloadlinux-stable-b9d0bb8f1c2e5dce9b8a54fb77d1af4aa64a4c01.tar.gz
linux-stable-b9d0bb8f1c2e5dce9b8a54fb77d1af4aa64a4c01.tar.bz2
linux-stable-b9d0bb8f1c2e5dce9b8a54fb77d1af4aa64a4c01.zip
Merge tag 'v6.3-rc2' into regulator-6.4 to fix clock related boot issues
Linux 6.3-rc2
Diffstat (limited to 'tools/perf/tests/shell/lib/perf_json_output_lint.py')
-rw-r--r--tools/perf/tests/shell/lib/perf_json_output_lint.py29
1 files changed, 13 insertions, 16 deletions
diff --git a/tools/perf/tests/shell/lib/perf_json_output_lint.py b/tools/perf/tests/shell/lib/perf_json_output_lint.py
index d90f8d102eb9..97598d14e532 100644
--- a/tools/perf/tests/shell/lib/perf_json_output_lint.py
+++ b/tools/perf/tests/shell/lib/perf_json_output_lint.py
@@ -40,19 +40,6 @@ def is_counter_value(num):
return isfloat(num) or num == '<not counted>' or num == '<not supported>'
def check_json_output(expected_items):
- if expected_items != -1:
- for line in Lines:
- if 'failed' not in line:
- count = 0
- count = line.count(',')
- if count != expected_items and count >= 1 and count <= 3 and 'metric-value' in line:
- # Events that generate >1 metric may have isolated metric
- # values and possibly other prefixes like interval, core and
- # aggregate-number.
- continue
- if count != expected_items:
- raise RuntimeError(f'wrong number of fields. counted {count} expected {expected_items}'
- f' in \'{line}\'')
checks = {
'aggregate-number': lambda x: isfloat(x),
'core': lambda x: True,
@@ -73,6 +60,16 @@ def check_json_output(expected_items):
}
input = '[\n' + ','.join(Lines) + '\n]'
for item in json.loads(input):
+ if expected_items != -1:
+ count = len(item)
+ if count != expected_items and count >= 1 and count <= 4 and 'metric-value' in item:
+ # Events that generate >1 metric may have isolated metric
+ # values and possibly other prefixes like interval, core and
+ # aggregate-number.
+ pass
+ elif count != expected_items:
+ raise RuntimeError(f'wrong number of fields. counted {count} expected {expected_items}'
+ f' in \'{item}\'')
for key, value in item.items():
if key not in checks:
raise RuntimeError(f'Unexpected key: key={key} value={value}')
@@ -82,11 +79,11 @@ def check_json_output(expected_items):
try:
if args.no_args or args.system_wide or args.event:
- expected_items = 6
- elif args.interval or args.per_thread or args.system_wide_no_aggr:
expected_items = 7
- elif args.per_core or args.per_socket or args.per_node or args.per_die:
+ elif args.interval or args.per_thread or args.system_wide_no_aggr:
expected_items = 8
+ elif args.per_core or args.per_socket or args.per_node or args.per_die:
+ expected_items = 9
else:
# If no option is specified, don't check the number of items.
expected_items = -1