From 11d45d4fb9239e89751bc79c7029453bee8f498c Mon Sep 17 00:00:00 2001 From: Leo Yan Date: Mon, 15 Feb 2021 19:59:44 +0800 Subject: [PATCH] perf test: Output the sub testing result in cs-etm The CoreSight testing contains sub cases, e.g. every CPU iterates the possible conntected sinks and tests the paths between the associated ETM with the found sink. Besides the per-thread testing, it also contains system wide testing and snapshot testing. To easier observe results for the sub cases, this patch introduces a new function arm_cs_report(), it outputs the result as "PASS" or "FAIL" for every sub case; and it records the error in the variable "glb_err" which is used as the final return value when exits the testing. Before: # perf test 73 -v 73: Check Arm CoreSight trace data recording and synthesized samples: --- start --- test child forked, pid 17423 Recording trace (only user mode) with path: CPU0 => tmc_etf0 Looking at perf.data file for dumping branch samples: Looking at perf.data file for reporting branch samples: Looking at perf.data file for instruction samples: Recording trace (only user mode) with path: CPU0 => tmc_etr0 Looking at perf.data file for dumping branch samples: Looking at perf.data file for reporting branch samples: Looking at perf.data file for instruction samples: [...] After: # perf test 73 -v 73: Check Arm CoreSight trace data recording and synthesized samples: --- start --- test child forked, pid 17423 Recording trace (only user mode) with path: CPU0 => tmc_etf0 Looking at perf.data file for dumping branch samples: Looking at perf.data file for reporting branch samples: Looking at perf.data file for instruction samples: CoreSight path testing (CPU0 -> tmc_etf0): PASS Recording trace (only user mode) with path: CPU0 => tmc_etr0 Looking at perf.data file for dumping branch samples: Looking at perf.data file for reporting branch samples: Looking at perf.data file for instruction samples: CoreSight path testing (CPU0 -> tmc_etr0): PASS [...] Signed-off-by: Leo Yan Cc: Alexander Shishkin Cc: Basil Eljuse Cc: Jiri Olsa Cc: Mark Rutland Cc: Mathieu Poirier Cc: Mike Leach Cc: Namhyung Kim Cc: Naresh Kamboju Cc: Peter Zijlstra Cc: Suzuki Poulouse Cc: Viresh Kumar Link: http://lore.kernel.org/lkml/20210215115944.535986-3-leo.yan@linaro.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/tests/shell/test_arm_coresight.sh | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/tools/perf/tests/shell/test_arm_coresight.sh b/tools/perf/tests/shell/test_arm_coresight.sh index 59b6474..c9eef0b 100755 --- a/tools/perf/tests/shell/test_arm_coresight.sh +++ b/tools/perf/tests/shell/test_arm_coresight.sh @@ -11,6 +11,7 @@ perfdata=$(mktemp /tmp/__perf_test.perf.data.XXXXX) file=$(mktemp /tmp/temporary_file.XXXXX) +glb_err=0 skip_if_no_cs_etm_event() { perf list | grep -q 'cs_etm//' && return 0 @@ -69,6 +70,15 @@ perf_report_instruction_samples() { egrep " +[0-9]+\.[0-9]+% +$1" > /dev/null 2>&1 } +arm_cs_report() { + if [ $2 != 0 ]; then + echo "$1: FAIL" + glb_err=$2 + else + echo "$1: PASS" + fi +} + is_device_sink() { # If the node of "enable_sink" is existed under the device path, this # means the device is a sink device. Need to exclude 'tpiu' since it @@ -113,9 +123,7 @@ arm_cs_iterate_devices() { perf_report_instruction_samples touch err=$? - - # Exit when find failure - [ $err != 0 ] && exit $err + arm_cs_report "CoreSight path testing (CPU$2 -> $device_name)" $err fi arm_cs_iterate_devices $dev $2 @@ -143,9 +151,7 @@ arm_cs_etm_system_wide_test() { perf_report_instruction_samples perf err=$? - - # Exit when find failure - [ $err != 0 ] && exit $err + arm_cs_report "CoreSight system wide testing" $err } arm_cs_etm_snapshot_test() { @@ -169,12 +175,10 @@ arm_cs_etm_snapshot_test() { perf_report_instruction_samples dd err=$? - - # Exit when find failure - [ $err != 0 ] && exit $err + arm_cs_report "CoreSight snapshot testing" $err } arm_cs_etm_traverse_path_test arm_cs_etm_system_wide_test arm_cs_etm_snapshot_test -exit 0 +exit $glb_err -- 2.7.4