summaryrefslogtreecommitdiff
path: root/tools/perf/tests/shell/lib
diff options
context:
space:
mode:
authorIan Rogers <irogers@google.com>2025-11-11 13:21:59 -0800
committerNamhyung Kim <namhyung@kernel.org>2025-11-11 16:48:35 -0800
commit2c240484cf52da3c2ca14cfb70e8cf9179197ced (patch)
tree0f15d56bc5eb9a0506d4243f99a38b1b2709c869 /tools/perf/tests/shell/lib
parent1bcd6271651e55329664e38446ab0288b64fb326 (diff)
perf test stat+json: Improve metric-only testing
When testing metric-only, pass a metric to perf rather than expecting a hard coded metric value to be generated. Remove keys that were really metric-only units and instead don't expect metric only to have a matching json key as it encodes metrics as {"metric_name", "metric_value"}. Signed-off-by: Ian Rogers <irogers@google.com> Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Diffstat (limited to 'tools/perf/tests/shell/lib')
-rw-r--r--tools/perf/tests/shell/lib/perf_json_output_lint.py4
1 files changed, 2 insertions, 2 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 c6750ef06c0f..1369baaa0361 100644
--- a/tools/perf/tests/shell/lib/perf_json_output_lint.py
+++ b/tools/perf/tests/shell/lib/perf_json_output_lint.py
@@ -65,8 +65,6 @@ def check_json_output(expected_items):
'socket': lambda x: True,
'thread': lambda x: True,
'unit': lambda x: True,
- 'insn per cycle': lambda x: isfloat(x),
- 'GHz': lambda x: True, # FIXME: it seems unintended for --metric-only
}
input = '[\n' + ','.join(Lines) + '\n]'
for item in json.loads(input):
@@ -88,6 +86,8 @@ def check_json_output(expected_items):
f' in \'{item}\'')
for key, value in item.items():
if key not in checks:
+ if args.metric_only:
+ continue
raise RuntimeError(f'Unexpected key: key={key} value={value}')
if not checks[key](value):
raise RuntimeError(f'Check failed for: key={key} value={value}')