Re: [PATCH] selftests: arm coresight: sysfsmode testing

From: James Clark
Date: Wed Dec 04 2024 - 06:17:48 EST




On 29/11/2024 8:38 am, Linu Cherian wrote:
Add sysfs mode selftest for ARM Coresight hardware tracer.

Signed-off-by: Linu Cherian <lcherian@xxxxxxxxxxx>
---
.../drivers/hwtracing/coresight/Makefile | 5 +
.../hwtracing/coresight/sysfs_test_trace.sh | 144 ++++++++++++++++++
2 files changed, 149 insertions(+)
create mode 100644 tools/testing/selftests/drivers/hwtracing/coresight/Makefile

Hi Linu,

You need to add this path into TARGETS for make install to work:

TARGETS += drivers/dma-buf
+TARGETS += drivers/hwtracing/coresight
TARGETS += drivers/s390x/uvdevice


create mode 100755 tools/testing/selftests/drivers/hwtracing/coresight/sysfs_test_trace.sh

diff --git a/tools/testing/selftests/drivers/hwtracing/coresight/Makefile b/tools/testing/selftests/drivers/hwtracing/coresight/Makefile
new file mode 100644
index 000000000000..7dc68ae1c0a9
--- /dev/null
+++ b/tools/testing/selftests/drivers/hwtracing/coresight/Makefile
@@ -0,0 +1,5 @@
+# SPDX-License-Identifier: GPL-2.0
+
+TEST_PROGS = sysfs_test_trace.sh
+
+include ../../../lib.mk
diff --git a/tools/testing/selftests/drivers/hwtracing/coresight/sysfs_test_trace.sh b/tools/testing/selftests/drivers/hwtracing/coresight/sysfs_test_trace.sh
new file mode 100755
index 000000000000..0d6307fff1d2
--- /dev/null
+++ b/tools/testing/selftests/drivers/hwtracing/coresight/sysfs_test_trace.sh
@@ -0,0 +1,144 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (C) 2024 Marvell.
+
+# Test Arm CoreSight trace capture in sysfs mode
+# Based on tools/perf/tests/shell/test_arm_coresight.sh
+
+glb_err=0
+
+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.
+

Looks like you still need the skip for TPIU here the same as the Perf test. It's an external sink and doesn't have a readable file so the test fails.

With those changes, looks good. Thanks for adding the first sysfs test. Hopefully we can expand them more in the future.

Reviewed-by: James Clark <james.clark@xxxxxxxxxx>