Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <leo.yan@linaro.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Basil Eljuse <basil.eljuse@arm.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Cc: Mike Leach <mike.leach@linaro.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Naresh Kamboju <naresh.kamboju@linaro.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
Cc: Viresh Kumar <viresh.kumar@linaro.org>
Link: http://lore.kernel.org/lkml/20210215115944.535986-3-leo.yan@linaro.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Leo Yan and committed by
Arnaldo Carvalho de Melo
11d45d4f 46355e3d

+14 -10
+14 -10
tools/perf/tests/shell/test_arm_coresight.sh
··· 11 11 12 12 perfdata=$(mktemp /tmp/__perf_test.perf.data.XXXXX) 13 13 file=$(mktemp /tmp/temporary_file.XXXXX) 14 + glb_err=0 14 15 15 16 skip_if_no_cs_etm_event() { 16 17 perf list | grep -q 'cs_etm//' && return 0 ··· 70 69 egrep " +[0-9]+\.[0-9]+% +$1" > /dev/null 2>&1 71 70 } 72 71 72 + arm_cs_report() { 73 + if [ $2 != 0 ]; then 74 + echo "$1: FAIL" 75 + glb_err=$2 76 + else 77 + echo "$1: PASS" 78 + fi 79 + } 80 + 73 81 is_device_sink() { 74 82 # If the node of "enable_sink" is existed under the device path, this 75 83 # means the device is a sink device. Need to exclude 'tpiu' since it ··· 123 113 perf_report_instruction_samples touch 124 114 125 115 err=$? 126 - 127 - # Exit when find failure 128 - [ $err != 0 ] && exit $err 116 + arm_cs_report "CoreSight path testing (CPU$2 -> $device_name)" $err 129 117 fi 130 118 131 119 arm_cs_iterate_devices $dev $2 ··· 151 143 perf_report_instruction_samples perf 152 144 153 145 err=$? 154 - 155 - # Exit when find failure 156 - [ $err != 0 ] && exit $err 146 + arm_cs_report "CoreSight system wide testing" $err 157 147 } 158 148 159 149 arm_cs_etm_snapshot_test() { ··· 175 169 perf_report_instruction_samples dd 176 170 177 171 err=$? 178 - 179 - # Exit when find failure 180 - [ $err != 0 ] && exit $err 172 + arm_cs_report "CoreSight snapshot testing" $err 181 173 } 182 174 183 175 arm_cs_etm_traverse_path_test 184 176 arm_cs_etm_system_wide_test 185 177 arm_cs_etm_snapshot_test 186 - exit 0 178 + exit $glb_err