diff options
| author | Ian Rogers <irogers@google.com> | 2025-11-12 22:53:08 +0300 |
|---|---|---|
| committer | Namhyung Kim <namhyung@kernel.org> | 2025-11-17 10:24:00 +0300 |
| commit | c335b7a960291d5b35221304a0b5bf8ebafced15 (patch) | |
| tree | ef95f4419889697b4376eb01c709c3fc15439155 /tools/perf/tests/shell | |
| parent | 38367a22abba12b9ecd66536ff62274f0afbcf6f (diff) | |
| download | linux-c335b7a960291d5b35221304a0b5bf8ebafced15.tar.xz | |
perf test: Be tolerant of missing json metric none value
print_metric_only_json and print_metric_end in stat-display.c may
create a metric value of "none" which fails validation as isfloat. Add
a helper to properly validate metric numeric values.
Signed-off-by: Ian Rogers <irogers@google.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Diffstat (limited to 'tools/perf/tests/shell')
| -rw-r--r-- | tools/perf/tests/shell/lib/perf_json_output_lint.py | 5 |
1 files changed, 4 insertions, 1 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 1369baaa0361..dafbde56cc76 100644 --- a/tools/perf/tests/shell/lib/perf_json_output_lint.py +++ b/tools/perf/tests/shell/lib/perf_json_output_lint.py @@ -43,6 +43,9 @@ def isint(num): def is_counter_value(num): return isfloat(num) or num == '<not counted>' or num == '<not supported>' +def is_metric_value(num): + return isfloat(num) or num == 'none' + def check_json_output(expected_items): checks = { 'counters': lambda x: isfloat(x), @@ -57,7 +60,7 @@ def check_json_output(expected_items): 'event-runtime': lambda x: isfloat(x), 'interval': lambda x: isfloat(x), 'metric-unit': lambda x: True, - 'metric-value': lambda x: isfloat(x), + 'metric-value': lambda x: is_metric_value(x), 'metric-threshold': lambda x: x in ['unknown', 'good', 'less good', 'nearly bad', 'bad'], 'metricgroup': lambda x: True, 'node': lambda x: True, |
