perf tests: Fix "perf stat JSON output linter" test for new output
PATCH 1/2 perf tests: Fix "perf stat JSON output linter" test for new output
Commit c4b41b83c250 ("perf stat: Rename "aggregate-number" to "cpu-count" in JSON") renamed a field, so update the tests to reflect this.
This fixes the following failure:
$ sudo ./perf test "json output" -vvv
96: perf stat JSON output linter :
--- start ---
test child forked, pid 327720
Checking json output: no args [Success]
Checking json output: system wide [Success]
Checking json output: interval [Success]
Checking json output: event [Success]
Checking json output: per thread [Success]
Checking json output: per node Test failed for input:
...
Traceback (most recent call last):
File "./tools/perf/tests/shell/lib/perf_json_output_lint.py", line 93, in <module>
check_json_output(expected_items)
File "./tools/perf/tests/shell/lib/perf_json_output_lint.py", line 78, in check_json_output
raise RuntimeError(f'Unexpected key: key={key} value={value}')
RuntimeError: Unexpected key: key=cpu-count value=16
test child finished with -1
---- end ----
perf stat JSON output linter: FAILED!--- tools/perf/tests/shell/lib/perf_json_output_lint.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/tests/shell/lib/perf_json_output_lint.py +1 -1
@@ -54,7 +54,7 @@ def check_json_output(expected_items): raise RuntimeError(f'wrong number of fields. counted {count} expected {expected_items}' f' in \'{line}\'') checks = { - 'aggregate-number': lambda x: isfloat(x), + 'cpu-count': lambda x: isfloat(x), 'core': lambda x: True, 'counter-value': lambda x: is_counter_value(x), 'cgroup': lambda x: True,
Signature · 1 line
2.25.1
PATCH 2/2 perf stat: Fix invalid output handle
In this context, 'os' is already a pointer so the extra dereference isn't required. This fixes the following test failure on aarch64:
$ ./perf test "json output" -vvv 92: perf stat JSON output linter : --- start --- Checking json output: no args Test failed for input: ... Fatal error: glibc detected an invalid stdio handle ---- end ---- perf stat JSON output linter: FAILED!
--- tools/perf/util/stat-display.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/stat-display.c +1 -1
@@ -741,7 +741,7 @@ static void printout(struct perf_stat_config *config, struct outstate *os,perf_stat__print_shadow_stats (config, counter, uval, map_idx, &out, &config->metric_events, &rt_stat); }else { -pm (config, &os,/*color=*/ NULL ,/*format=*/ NULL ,/*unit=*/ "" ,/*val=*/ 0 ); +pm (config, os,/*color=*/ NULL ,/*format=*/ NULL ,/*unit=*/ "" ,/*val=*/ 0 ); }if (!config->metric_only) {
Signature · 1 line
2.25.1
Re: [PATCH 2/2] perf stat: Fix invalid output handle
Quoted 13 lines · James Clark
In this context, 'os' is already a pointer so the extra dereference isn't required. This fixes the following test failure on aarch64:
$ ./perf test "json output" -vvv 92: perf stat JSON output linter : --- start --- Checking json output: no args Test failed for input: ... Fatal error: glibc detected an invalid stdio handle ---- end ---- perf stat JSON output linter: FAILED!
Quoted 2 lines
Fixes e7f4da312259 ("perf stat: Pass struct outstate to printout()")Signed-off-by James Clark <[email protected]>
Thanks for fixing this. I'm not sure how I missed it.. :(
Thanks,
Namhyung
Quoted 20 lines
--- tools/perf/util/stat-display.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/perf/util/stat-display.c +1
-2@@ -741,7 +741,7 @@ static void printout(struct perf_stat_config *config, struct outstate *os,perf_stat__print_shadow_stats (config, counter, uval, map_idx, &out, &config->metric_events, &rt_stat); }else { -pm (config, &os,/*color=*/ NULL ,/*format=*/ NULL ,/*unit=*/ "" ,/*val=*/ 0 ); +pm (config, os,/*color=*/ NULL ,/*format=*/ NULL ,/*unit=*/ "" ,/*val=*/ 0 ); }if (!config->metric_only) { --2.25.1
Re: [PATCH 2/2] perf stat: Fix invalid output handle
Quoted 14 lines · Namhyung Kim
Quoted 13 lines · James Clark
In this context, 'os' is already a pointer so the extra dereference isn't required. This fixes the following test failure on aarch64:
$ ./perf test "json output" -vvv 92: perf stat JSON output linter : --- start --- Checking json output: no args Test failed for input: ... Fatal error: glibc detected an invalid stdio handle ---- end ---- perf stat JSON output linter: FAILED!
Quoted 5 lines
Quoted 2 lines
Fixes e7f4da312259 ("perf stat: Pass struct outstate to printout()")Signed-off-by James Clark <[email protected]>Thanks for fixing this. I'm not sure how I missed it.. :(
It seems to only go down that path on some configuration. At least on x86 the test was passing fine for me.
Quoted 1 line
Acked-by Namhyung Kim <[email protected]>
Thanks for the review!
Quoted 25 lines
Thanks,
NamhyungQuoted 20 lines
--- tools/perf/util/stat-display.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/perf/util/stat-display.c +1
-2@@ -741,7 +741,7 @@ static void printout(struct perf_stat_config *config, struct outstate *os,perf_stat__print_shadow_stats (config, counter, uval, map_idx, &out, &config->metric_events, &rt_stat); }else { -pm (config, &os,/*color=*/ NULL ,/*format=*/ NULL ,/*unit=*/ "" ,/*val=*/ 0 ); +pm (config, os,/*color=*/ NULL ,/*format=*/ NULL ,/*unit=*/ "" ,/*val=*/ 0 ); }if (!config->metric_only) { --2.25.1
Athira Rajeev
Tested-byRe: [PATCH 2/2] perf stat: Fix invalid output handle
Quoted 27 lines · James Clark
Quoted 14 lines · Namhyung Kim
Quoted 13 lines · James Clark
In this context, 'os' is already a pointer so the extra dereference isn't required. This fixes the following test failure on aarch64:
$ ./perf test "json output" -vvv 92: perf stat JSON output linter : --- start --- Checking json output: no args Test failed for input: ... Fatal error: glibc detected an invalid stdio handle ---- end ---- perf stat JSON output linter: FAILED!Quoted 5 lines
Quoted 2 lines
Fixes e7f4da312259 ("perf stat: Pass struct outstate to printout()")Signed-off-by James Clark <[email protected]>Thanks for fixing this. I'm not sure how I missed it.. :(
Quoted 6 lines
It seems to only go down that path on some configuration. At least on x86 the test was passing fine for me.
Quoted 1 line
Acked-by Namhyung Kim <[email protected]>Thanks for the review!
Faced same issue on powerpc. Tested with this change and it works with this patch.
Thanks
Athira
Quoted 25 lines
Quoted 25 lines
Thanks,
NamhyungQuoted 19 lines
---
tools/perf/util/stat-display.c| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)tools/perf/util/stat-display.c +1
-2@@ -741,7 +741,7 @@ static void printout(struct perf_stat_config *config, struct outstate *os,perf_stat__print_shadow_stats (config, counter, uval, map_idx, &out, &config->metric_events, &rt_stat); }else { -pm (config, &os,/*color=*/ NULL ,/*format=*/ NULL ,/*unit=*/ "" ,/*val=*/ 0 ); +pm (config, os,/*color=*/ NULL ,/*format=*/ NULL ,/*unit=*/ "" ,/*val=*/ 0 ); }if (!config->metric_only) { --2.25.1
Re: [PATCH 2/2] perf stat: Fix invalid output handle
Em Sun, Dec 04, 2022 at 10:38:28PM +0530, Athira Rajeev escreveu:
Quoted 30 lines
Quoted 30 lines · James Clark
Quoted 14 lines · Namhyung Kim
Quoted 13 lines · James Clark
In this context, 'os' is already a pointer so the extra dereference isn't required. This fixes the following test failure on aarch64:
$ ./perf test "json output" -vvv 92: perf stat JSON output linter : --- start --- Checking json output: no args Test failed for input: ... Fatal error: glibc detected an invalid stdio handle ---- end ---- perf stat JSON output linter: FAILED!Quoted 5 lines
Quoted 2 lines
Fixes e7f4da312259 ("perf stat: Pass struct outstate to printout()")Signed-off-by James Clark <[email protected]>Thanks for fixing this. I'm not sure how I missed it.. :(
It seems to only go down that path on some configuration. At least on x86 the test was passing fine for me.
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
Acked-by Namhyung Kim <[email protected]>Thanks for the review!
Faced same issue on powerpc. Tested with this change and it works with this patch.
Tested-by Athira Rajeev <[email protected]>
Thanks, applied.
- Arnaldo
Ian Rogers
reviewerQuoted 28 lines · James Clark
Commit
c4b41b83c250("perf stat: Rename "aggregate-number" to "cpu-count" in JSON") renamed a field, so update the tests to reflect this.This fixes the following failure:
$ sudo ./perf test "json output" -vvv 96: perf stat JSON output linter : --- start --- test child forked, pid 327720 Checking json output: no args [Success] Checking json output: system wide [Success] Checking json output: interval [Success] Checking json output: event [Success] Checking json output: per thread [Success] Checking json output: per node Test failed for input: ... Traceback (most recent call last): File "./tools/perf/tests/shell/lib/perf_json_output_lint.py", line 93, in <module> check_json_output(expected_items) File "./tools/perf/tests/shell/lib/perf_json_output_lint.py", line 78, in check_json_output raise RuntimeError(f'Unexpected key: key={key} value={value}') RuntimeError: Unexpected key: key=cpu-count value=16 test child finished with -1 ---- end ---- perf stat JSON output linter: FAILED!
Quoted 2 lines
Fixes c4b41b83c250 ("perf stat: Rename "aggregate-number" to "cpu-count" in JSON")Signed-off-by James Clark <[email protected]>
Namhyung mentioned reverting change c4b41b83c250, in which case merging this would break the test again. I think the revert is better.
Thanks,
Ian
Quoted 20 lines
--- tools/perf/tests/shell/lib/perf_json_output_lint.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/perf/tests/shell/lib/perf_json_output_lint.py +1
-2@@ -54,7 +54,7 @@ def check_json_output(expected_items): raise RuntimeError(f'wrong number of fields. counted {count} expected {expected_items}' f' in \'{line}\'') checks = { - 'aggregate-number': lambda x: isfloat(x), + 'cpu-count': lambda x: isfloat(x), 'core': lambda x: True, 'counter-value': lambda x: is_counter_value(x), 'cgroup': lambda x: True, --2.25.1
Namhyung Kim
maintainerHi,
Quoted 30 lines · Ian Rogers
Quoted 28 lines · James Clark
Commit
c4b41b83c250("perf stat: Rename "aggregate-number" to "cpu-count" in JSON") renamed a field, so update the tests to reflect this.This fixes the following failure:
$ sudo ./perf test "json output" -vvv 96: perf stat JSON output linter : --- start --- test child forked, pid 327720 Checking json output: no args [Success] Checking json output: system wide [Success] Checking json output: interval [Success] Checking json output: event [Success] Checking json output: per thread [Success] Checking json output: per node Test failed for input: ... Traceback (most recent call last): File "./tools/perf/tests/shell/lib/perf_json_output_lint.py", line 93, in <module> check_json_output(expected_items) File "./tools/perf/tests/shell/lib/perf_json_output_lint.py", line 78, in check_json_output raise RuntimeError(f'Unexpected key: key={key} value={value}') RuntimeError: Unexpected key: key=cpu-count value=16 test child finished with -1 ---- end ---- perf stat JSON output linter: FAILED!
Quoted 5 lines
Quoted 2 lines
Fixes c4b41b83c250 ("perf stat: Rename "aggregate-number" to "cpu-count" in JSON")Signed-off-by James Clark <[email protected]>Namhyung mentioned reverting change
c4b41b83c250, in which case merging this would break the test again. I think the revert is better.
Yep, I will send the revert soon.
Thanks,
Namhyung
Arnaldo Carvalho de Melo
maintainerEm Wed, Nov 30, 2022 at 10:18:49AM -0800, Ian Rogers escreveu:
Quoted 29 lines · James Clark
Quoted 28 lines
Commit
c4b41b83c250("perf stat: Rename "aggregate-number" to "cpu-count" in JSON") renamed a field, so update the tests to reflect this.This fixes the following failure:
$ sudo ./perf test "json output" -vvv 96: perf stat JSON output linter : --- start --- test child forked, pid 327720 Checking json output: no args [Success] Checking json output: system wide [Success] Checking json output: interval [Success] Checking json output: event [Success] Checking json output: per thread [Success] Checking json output: per node Test failed for input: ... Traceback (most recent call last): File "./tools/perf/tests/shell/lib/perf_json_output_lint.py", line 93, in <module> check_json_output(expected_items) File "./tools/perf/tests/shell/lib/perf_json_output_lint.py", line 78, in check_json_output raise RuntimeError(f'Unexpected key: key={key} value={value}') RuntimeError: Unexpected key: key=cpu-count value=16 test child finished with -1 ---- end ---- perf stat JSON output linter: FAILED!
Quoted 5 lines
Quoted 2 lines
Fixes c4b41b83c250 ("perf stat: Rename "aggregate-number" to "cpu-count" in JSON")Signed-off-by James Clark <[email protected]>Namhyung mentioned reverting change
c4b41b83c250, in which case merging this would break the test again. I think the revert is better.
Applied the revert, with an Acked-by: you.
Quoted 23 lines
Thanks,
IanQuoted 20 lines
--- tools/perf/tests/shell/lib/perf_json_output_lint.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/perf/tests/shell/lib/perf_json_output_lint.py +1
-2@@ -54,7 +54,7 @@ def check_json_output(expected_items): raise RuntimeError(f'wrong number of fields. counted {count} expected {expected_items}' f' in \'{line}\'') checks = { - 'aggregate-number': lambda x: isfloat(x), + 'cpu-count': lambda x: isfloat(x), 'core': lambda x: True, 'counter-value': lambda x: is_counter_value(x), 'cgroup': lambda x: True, --2.25.1
Signature · 1 line
- Arnaldo