From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C74C1C3DA45 for ; Thu, 11 Jul 2024 18:08:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Vdr/SJZOUZkhjaTuPLkpV51YaMf3JU4AcchBkrFS4to=; b=B7UFmJ67hez4XOICht+GpBLSjM QdGqQ+SUoB78jgxUsa6InrcecQCLkJL/BQCizXBw9bEsSlqgAA231IOT+o2yY25SK/vX047trDx4D c102XppP1W7bETXLjvfGlXLTRaO56Ma/cF56Vlo1KMtra9V42vVTu5+34l+voJEmNBnN6DNy+Hcs5 NV+R4NQWPw86HTUxsgO+eGqfOb2n97tfGFCL3XbkOvqBRMU2tPVUGd7a7P38mJwjSPaJQlyz6G+gh LepLcq4sE+3UX2V45z44PHOiE5Gnx2XCqGh8BhInmoNhfwlO6yL5N3aiUFDH7CGRBd5a0pNvWGZiZ R73XGNYg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sRyDa-0000000Ezu4-1SCL; Thu, 11 Jul 2024 18:08:34 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sRy8Z-0000000ExXQ-2EhZ for linux-arm-kernel@lists.infradead.org; Thu, 11 Jul 2024 18:03:25 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id B058461B18; Thu, 11 Jul 2024 18:03:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1CA92C116B1; Thu, 11 Jul 2024 18:03:20 +0000 (UTC) Date: Thu, 11 Jul 2024 19:03:18 +0100 From: Catalin Marinas To: Jeremy Szu Cc: will@kernel.org, linux-arm-kernel@lists.infradead.org, james.clark@arm.com, bwicaksono@nvidia.com, Suzuki K Poulose Subject: Re: [PATCH] kselftest/arm64: Add coresight test Message-ID: References: <20240710062732.18999-1-jszu@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240710062732.18999-1-jszu@nvidia.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240711_110323_754102_51FEF41C X-CRM114-Status: GOOD ( 22.28 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Jul 10, 2024 at 02:27:32PM +0800, Jeremy Szu wrote: > Add a script to test the coresight functionalities by performing the > perf test 'coresight'. > > The script checks the prerequisites and launches a bundle of > Coresight-related tests with a 180-second timeout. > > Signed-off-by: Jeremy Szu I have not idea how to test coresight, so adding Suzuki as well. > --- > tools/testing/selftests/arm64/Makefile | 2 +- > .../selftests/arm64/coresight/Makefile | 5 +++ > .../selftests/arm64/coresight/coresight.sh | 40 +++++++++++++++++++ > .../selftests/arm64/coresight/settings | 1 + > 4 files changed, 47 insertions(+), 1 deletion(-) > create mode 100644 tools/testing/selftests/arm64/coresight/Makefile > create mode 100755 tools/testing/selftests/arm64/coresight/coresight.sh > create mode 100644 tools/testing/selftests/arm64/coresight/settings > > diff --git a/tools/testing/selftests/arm64/Makefile b/tools/testing/selftests/arm64/Makefile > index 28b93cab8c0dd..2b788d7bab22d 100644 > --- a/tools/testing/selftests/arm64/Makefile > +++ b/tools/testing/selftests/arm64/Makefile > @@ -4,7 +4,7 @@ > ARCH ?= $(shell uname -m 2>/dev/null || echo not) > > ifneq (,$(filter $(ARCH),aarch64 arm64)) > -ARM64_SUBTARGETS ?= tags signal pauth fp mte bti abi > +ARM64_SUBTARGETS ?= tags signal pauth fp mte bti abi coresight > else > ARM64_SUBTARGETS := > endif > diff --git a/tools/testing/selftests/arm64/coresight/Makefile b/tools/testing/selftests/arm64/coresight/Makefile > new file mode 100644 > index 0000000000000..1cc8c1f2a997e > --- /dev/null > +++ b/tools/testing/selftests/arm64/coresight/Makefile > @@ -0,0 +1,5 @@ > +# SPDX-License-Identifier: GPL-2.0 > + > +TEST_PROGS := coresight.sh > + > +include ../../lib.mk > diff --git a/tools/testing/selftests/arm64/coresight/coresight.sh b/tools/testing/selftests/arm64/coresight/coresight.sh > new file mode 100755 > index 0000000000000..e550957cf593b > --- /dev/null > +++ b/tools/testing/selftests/arm64/coresight/coresight.sh > @@ -0,0 +1,40 @@ > +#!/bin/bash > +# SPDX-License-Identifier: GPL-2.0 > + > +skip() { > + echo "SKIP: $1" > + exit 4 > +} > + > +fail() { > + echo "FAIL: $1" > + exit 255 > +} > + > +is_coresight_supported() { > + if [ -d "/sys/bus/coresight/devices" ]; then > + return 0 > + fi > + return 255 > +} > + > +if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then > + [ "$(id -u)" -ne 0 ] && \ > + skip "this test must be run as root." > + which perf >/dev/null 2>&1 || \ > + skip "perf is not installed." > + perf test list 2>&1 | grep -qi 'coresight' || \ > + skip "perf doesn't support testing coresight." > + is_coresight_supported || \ > + skip "coresight is not supported." > + > + cmd_output=$(perf test -vv 'coresight' 2>&1) > + perf_ret=$? > + > + if [ $perf_ret -ne 0 ]; then > + fail "perf command returns non-zero." > + elif [[ $cmd_output == *"FAILED!"* ]]; then > + echo $cmd_output > + fail "perf test 'arm coresight' test failed!" > + fi > +fi > diff --git a/tools/testing/selftests/arm64/coresight/settings b/tools/testing/selftests/arm64/coresight/settings > new file mode 100644 > index 0000000000000..a953c96aa16e1 > --- /dev/null > +++ b/tools/testing/selftests/arm64/coresight/settings > @@ -0,0 +1 @@ > +timeout=180 > -- > 2.34.1 -- Catalin