From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796213702; b=oQDK5W8HDrl4e7htGFkdejcskMuq3cptp5fdsmv7zjrolG7T3HFvY127/a/KZvY3XlHO 0gHDJVl0OxNWlHop96wK8PoMTSBEYvhz1WXTbqLZ8XmgGe+oMBGfUe0sHbr1SyS3WclnU g79py7tX1zyP/bj3LNOWiwXgnxcCiIMjxqdujoHwLNE6Y1bYpdDGko6tmuzId5Fg9swhL K7G6URE1SGh5QTrMGCkbGh/gJmG3e93unAZR680h73IhlUuXT97ZAAOwNZ5O5qaOee+m4 HeyAArv09koK7hmg5ZkMPedmQoFBvOnx+JM3Hs/ljJr5gBqdYAqNq4/uKZa08bzzjKw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796213702; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:MIME-Version:Content-Transfer-Encoding; bh=WIWqd/BNT2N/v/BMCA6uGhTOMIa8Bc1N4tHAIa/Ml6A=; b=XGPc1fH24U8sLQ1R8kdcHmCvlNzNCT38b1k/ZuVgRNAQOxwbC0U1jL8vAFzRPT/AOkJ4 QNOz4XrFRG6KDxAm2pMx5JufjNc6X7jq1nGHHLTzFhvLqZTSi00SDJ4SjMjdct5MjzWD+ /SdpaG7JLyD6pAAtaHNQa2T81LhOrd9e3fQDyfD3+wU9Xj/LL6uvGHCsqEyOyCl73MkhS 6P6K7y6EqtvbmIsoOd4lyyVnzcMTC2xk0ZSzjRZmRju7z1WZv1jr4CeegCqG1Tr24d6TH ysWvGX019v3zjRZB/NAmNXWiRyllf1UIV5Af6iKLD1lorfnFH7k00sbfh4YrgUZfPrA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=nWS4J0zk; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7693F606A31A for ; Wed, 2 Dec 2026 12:15:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=nWS4J0zk Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3A0321F0089C; Wed, 2 Dec 2026 12:14:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796213701; bh=WIWqd/BNT2N/v/BMCA6uGhTOMIa8Bc1N4tHAIa/Ml6A=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=nWS4J0zkBNmrLmQ5GwSG2yuT0vZCqPaWksW/a86sGOy5xFkerzDDEfISwmIUcNB4C KgqArL2Gzk6JaFZffBO6MMuQS3yGFFlp8JIhxlhuOnd2m0C7IMZyNw/cNenHrCam65 ulZemt3uy0Qb2GKKGON1kzAhiL3mSA3NTB4n+1Rbhka6Az4EhpqnkgYKpzEvD0hE9Q VgFmqd6fUiMbsJ9+/2286OmTutpKSSTylV/lXF7CEOpQlxkstxAqt91UnEzTe1ZqKF UsaReGvwPlNuETNgFh6Q+QAcSreX8px8tBARBup1p5g4nrlsSZ8Tfh5XTmRua19GAf QlYOYMZqtOkkw== From: Arnaldo Carvalho de Melo To: Namhyung Kim Cc: Ingo Molnar , Thomas Gleixner , James Clark , Jiri Olsa , Ian Rogers , Adrian Hunter , Clark Williams , linux-perf-users@vger.kernel.org, Arnaldo Carvalho de Melo , Athira Rajeev Subject: [PATCH v3 04/18] perf tests help: Add a basic perf help test Date: Wed, 2 Dec 2026 09:14:20 -0300 Message-ID: <20261202121434.2224-5-acme@kernel.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20261202121434.2224-1-acme@kernel.org> References: <20261202121434.2224-1-acme@kernel.org> X-Mailing-List: linux-perf-users@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Arnaldo Carvalho de Melo perf help and its -a option were not exercised by the suite. Check the common command list and the command directory listing. Reviewed-by: Athira Rajeev Tested-by: Athira Rajeev Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/tests/shell/help.sh | 80 ++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100755 tools/perf/tests/shell/help.sh diff --git a/tools/perf/tests/shell/help.sh b/tools/perf/tests/shell/help.sh new file mode 100755 index 0000000000000000..b7279a97a5615193 --- /dev/null +++ b/tools/perf/tests/shell/help.sh @@ -0,0 +1,80 @@ +#!/bin/bash +# perf help tests +# SPDX-License-Identifier: GPL-2.0 + +set -e + +err=0 +out=$(mktemp /tmp/__perf_test_help.out.XXXXX) +exec_path= + +cleanup() { + rm -f "${out}" + [ -z "${exec_path}" ] || rm -rf "${exec_path}" + + trap - EXIT TERM INT +} + +trap_cleanup() { + echo "Unexpected signal in ${FUNCNAME[1]}" + cleanup + exit 1 +} +trap trap_cleanup EXIT TERM INT + +test_help_commands() { + echo "perf help commands test" + if ! perf help > "${out}" 2>&1; then + echo "perf help commands test [Failed: perf help failed]" + cat "${out}" + err=1 + return + fi + if ! grep -q "The most commonly used perf commands are" "${out}"; then + echo "perf help commands test [Failed missing command list]" + cat "${out}" + err=1 + return + fi + if ! grep -q "See 'perf help COMMAND'" "${out}"; then + echo "perf help commands test [Failed missing help hint]" + err=1 + return + fi + echo "perf help commands test [Success]" +} + +test_help_all() { + echo "perf help -a test" + # "available perf commands in" is printed only when the exec path holds + # perf-* commands, which a build tree does not have. Give help -a a + # temporary exec path with a dummy command to look for. + exec_path=$(mktemp -d /tmp/__perf_test_help_exec.XXXXXX) + printf '#!/bin/sh\n' > "${exec_path}/perf-dummy" + chmod +x "${exec_path}/perf-dummy" + if ! PERF_EXEC_PATH="${exec_path}" perf help -a > "${out}" 2>&1; then + echo "perf help -a test [Failed: perf help -a failed]" + cat "${out}" + err=1 + return + fi + if ! grep -q "available perf commands in" "${out}"; then + echo "perf help -a test [Failed missing command directory]" + cat "${out}" + err=1 + return + fi + if ! grep -q " dummy" "${out}"; then + echo "perf help -a test [Failed missing command from exec path]" + cat "${out}" + err=1 + return + fi + echo "perf help -a test [Success]" +} + +test_help_commands +test_help_all + +cleanup +exit $err -- 2.56.0