linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michael Petlan <mpetlan@redhat.com>
To: linux-perf-users@vger.kernel.org, vmolnaro@redhat.com,
	acme@redhat.com, namhyung@kernel.org
Cc: acme@kernel.org, irogers@google.com, atrajeev@linux.vnet.ibm.com,
	masami.hiramatsu.pt@hitachi.com
Subject: [PATCH 02/11] perf testsuite: Merge settings files for shell tests
Date: Mon, 24 Jun 2024 15:08:00 +0200	[thread overview]
Message-ID: <20240624130809.1612-3-mpetlan@redhat.com> (raw)
In-Reply-To: <20240624130809.1612-1-mpetlan@redhat.com>

From: Veronika Molnarova <vmolnaro@redhat.com>

Merge perf testsuite setting files into common settings to reduce
duplicates and prevent errors.

Signed-off-by: Veronika Molnarova <vmolnaro@redhat.com>
Signed-off-by: Michael Petlan <mpetlan@redhat.com>
---
 tools/perf/tests/shell/base_probe/settings.sh | 48 -------------------
 .../shell/base_probe/test_adding_kernel.sh    |  3 --
 tools/perf/tests/shell/common/init.sh         | 23 +++++++++
 tools/perf/tests/shell/common/settings.sh     | 23 +++++++++
 4 files changed, 46 insertions(+), 51 deletions(-)
 delete mode 100644 tools/perf/tests/shell/base_probe/settings.sh

diff --git a/tools/perf/tests/shell/base_probe/settings.sh b/tools/perf/tests/shell/base_probe/settings.sh
deleted file mode 100644
index 123621c7f95e..000000000000
--- a/tools/perf/tests/shell/base_probe/settings.sh
+++ /dev/null
@@ -1,48 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0
-#
-#	settings.sh of perf_probe test
-#	Author: Michael Petlan <mpetlan@redhat.com>
-#	Author: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
-#
-
-export TEST_NAME="perf_probe"
-
-export MY_ARCH=`arch`
-
-if [ -n "$PERFSUITE_RUN_DIR" ]; then
-	# when $PERFSUITE_RUN_DIR is set to something, all the logs and temp files will be placed there
-	# --> the $PERFSUITE_RUN_DIR/perf_something/examples and $PERFSUITE_RUN_DIR/perf_something/logs
-	#     dirs will be used for that
-	export PERFSUITE_RUN_DIR=`readlink -f $PERFSUITE_RUN_DIR`
-	export CURRENT_TEST_DIR="$PERFSUITE_RUN_DIR/$TEST_NAME"
-	export MAKE_TARGET_DIR="$CURRENT_TEST_DIR/examples"
-	test -d "$MAKE_TARGET_DIR" || mkdir -p "$MAKE_TARGET_DIR"
-	export LOGS_DIR="$PERFSUITE_RUN_DIR/$TEST_NAME/logs"
-	test -d "$LOGS_DIR" || mkdir -p "$LOGS_DIR"
-else
-	# when $PERFSUITE_RUN_DIR is not set, logs will be placed here
-	export CURRENT_TEST_DIR="."
-	export LOGS_DIR="."
-fi
-
-check_kprobes_available()
-{
-	test -e /sys/kernel/debug/tracing/kprobe_events
-}
-
-check_uprobes_available()
-{
-	test -e /sys/kernel/debug/tracing/uprobe_events
-}
-
-clear_all_probes()
-{
-	echo 0 > /sys/kernel/debug/tracing/events/enable
-	check_kprobes_available && echo > /sys/kernel/debug/tracing/kprobe_events
-	check_uprobes_available && echo > /sys/kernel/debug/tracing/uprobe_events
-}
-
-check_sdt_support()
-{
-	$CMD_PERF list sdt | grep sdt > /dev/null 2> /dev/null
-}
diff --git a/tools/perf/tests/shell/base_probe/test_adding_kernel.sh b/tools/perf/tests/shell/base_probe/test_adding_kernel.sh
index 63bb8974b38e..3363f8c57e46 100755
--- a/tools/perf/tests/shell/base_probe/test_adding_kernel.sh
+++ b/tools/perf/tests/shell/base_probe/test_adding_kernel.sh
@@ -15,10 +15,7 @@
 
 # include working environment
 . ../common/init.sh
-. ./settings.sh
 
-# shellcheck disable=SC2034 # the variable is later used after the working environment is included
-THIS_TEST_NAME=`basename $0 .sh`
 TEST_RESULT=0
 
 TEST_PROBE=${TEST_PROBE:-"inode_permission"}
diff --git a/tools/perf/tests/shell/common/init.sh b/tools/perf/tests/shell/common/init.sh
index aadeaf782e03..b99fba50ba94 100644
--- a/tools/perf/tests/shell/common/init.sh
+++ b/tools/perf/tests/shell/common/init.sh
@@ -115,3 +115,26 @@ detect_amd()
 	# 1 = is not AMD or unknown
 	grep "vendor_id" < /proc/cpuinfo | grep -q "AMD"
 }
+
+# base probe utility
+check_kprobes_available()
+{
+	test -e /sys/kernel/debug/tracing/kprobe_events
+}
+
+check_uprobes_available()
+{
+	test -e /sys/kernel/debug/tracing/uprobe_events
+}
+
+clear_all_probes()
+{
+	echo 0 > /sys/kernel/debug/tracing/events/enable
+	check_kprobes_available && echo > /sys/kernel/debug/tracing/kprobe_events
+	check_uprobes_available && echo > /sys/kernel/debug/tracing/uprobe_events
+}
+
+check_sdt_support()
+{
+	$CMD_PERF list sdt | grep sdt > /dev/null 2> /dev/null
+}
diff --git a/tools/perf/tests/shell/common/settings.sh b/tools/perf/tests/shell/common/settings.sh
index 361641dbaaad..dcdb7d49ac00 100644
--- a/tools/perf/tests/shell/common/settings.sh
+++ b/tools/perf/tests/shell/common/settings.sh
@@ -65,6 +65,29 @@ else
 	export MEND=""
 fi
 
+### general info
+DIR_PATH=`dirname "$(readlink -e "$0")"`
+
+export TEST_NAME=`basename $DIR_PATH | sed 's/base/perf/'`
+export MY_ARCH=`arch`
+
+# storing logs and temporary files variables
+if [ -n "$PERFSUITE_RUN_DIR" ]; then
+	# when $PERFSUITE_RUN_DIR is set to something, all the logs and temp files will be placed there
+	# --> the $PERFSUITE_RUN_DIR/perf_something/examples and $PERFSUITE_RUN_DIR/perf_something/logs
+	#     dirs will be used for that
+	export PERFSUITE_RUN_DIR=`readlink -f $PERFSUITE_RUN_DIR`
+	export CURRENT_TEST_DIR="$PERFSUITE_RUN_DIR/$TEST_NAME"
+	export MAKE_TARGET_DIR="$CURRENT_TEST_DIR/examples"
+	export LOGS_DIR="$CURRENT_TEST_DIR/logs"
+	test -d "$CURRENT_TEST_DIR" || mkdir -p "$CURRENT_TEST_DIR"
+	test -d "$LOGS_DIR" || mkdir -p "$LOGS_DIR"
+else
+	# when $PERFSUITE_RUN_DIR is not set, logs will be placed here
+	export CURRENT_TEST_DIR="."
+	export LOGS_DIR="."
+fi
+
 
 #### test parametrization
 if [ ! -d ./common ]; then
-- 
2.43.0


  parent reply	other threads:[~2024-06-24 13:08 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-24 13:07 [PATCH 00/11] perftool-testsuite 2nd batch Michael Petlan
2024-06-24 13:07 ` [PATCH 01/11] perf tests shell: Skip base_* dirs in test script search Michael Petlan
2024-06-24 13:08 ` Michael Petlan [this message]
2024-06-24 13:08 ` [PATCH 03/11] perf testsuite: Fix shellcheck warnings Michael Petlan
2024-06-24 13:08 ` [PATCH 04/11] perf testsuite probe: Add test for blacklisted kprobes handling Michael Petlan
2024-06-24 13:08 ` [PATCH 05/11] perf testsuite probe: Add test for basic perf-probe options Michael Petlan
2024-06-24 13:08 ` [PATCH 06/11] perf testsuite probe: Add test for invalid options Michael Petlan
2024-06-24 13:08 ` [PATCH 07/11] perf testsuite probe: Add test for line semantics Michael Petlan
2024-06-24 13:08 ` [PATCH 08/11] perf testsuite: Add common output checking helper Michael Petlan
2024-06-24 13:08 ` [PATCH 09/11] perf testsuite report: Add test for perf-report basic functionality Michael Petlan
2024-06-24 13:08 ` [PATCH 10/11] perf testsuite report: Add test case for perf report Michael Petlan
2024-06-24 13:08 ` [PATCH 11/11] perf testsuite: Install perf-report tests Michael Petlan
2024-06-27 22:29 ` [PATCH 00/11] perftool-testsuite 2nd batch Namhyung Kim
2024-07-02 11:08   ` [PATCH v2 " vmolnaro
2024-07-02 11:08     ` [PATCH v2 01/11] perf tests shell: Skip base_* dirs in test script search vmolnaro
2024-07-02 11:08     ` [PATCH v2 02/11] perf testsuite: Merge settings files for shell tests vmolnaro
2024-07-02 11:08     ` [PATCH v2 03/11] perf testsuite: Fix shellcheck warnings vmolnaro
2024-07-02 11:08     ` [PATCH v2 04/11] perf testsuite probe: Add test for blacklisted kprobes handling vmolnaro
2024-07-02 11:08     ` [PATCH v2 05/11] perf testsuite probe: Add test for basic perf-probe options vmolnaro
2024-07-02 11:08     ` [PATCH v2 06/11] perf testsuite probe: Add test for invalid options vmolnaro
2024-07-02 11:08     ` [PATCH v2 07/11] perf testsuite probe: Add test for line semantics vmolnaro
2024-07-02 11:08     ` [PATCH v2 08/11] perf testsuite: Add common output checking helper vmolnaro
2024-07-02 11:08     ` [PATCH v2 09/11] perf testsuite report: Add test for perf-report basic functionality vmolnaro
2024-07-02 11:08     ` [PATCH v2 10/11] perf testsuite report: Add test case for perf report vmolnaro
2024-07-02 11:08     ` [PATCH v2 11/11] perf testsuite: Install perf-report tests vmolnaro
2024-08-28 14:10     ` [PATCH v2 00/11] perftool-testsuite 2nd batch Veronika Molnarova
2024-08-28 20:39       ` Arnaldo Carvalho de Melo
2024-08-29 11:29         ` [PATCH v2 01/11] perf tests shell: Skip base_* dirs in test script search vmolnaro
2024-08-29 11:29         ` [PATCH v2 11/11] perf testsuite: Install perf-report tests vmolnaro
2024-08-30 15:27         ` [PATCH v2 00/11] perftool-testsuite 2nd batch Arnaldo Carvalho de Melo
2024-09-02 14:05           ` Veronika Molnarova
2024-09-02 14:31             ` Arnaldo Carvalho de Melo
2024-09-02 14:41               ` Arnaldo Carvalho de Melo
2024-09-02 14:42                 ` Arnaldo Carvalho de Melo
2024-09-02 15:10                 ` Veronika Molnarova
2024-09-02 18:46                   ` Arnaldo Carvalho de Melo
2024-09-02 21:00                     ` Arnaldo Carvalho de Melo
2024-09-05 15:11                     ` Masami Hiramatsu
2024-09-05 19:04                       ` Arnaldo Carvalho de Melo
2024-09-05 19:15                         ` Arnaldo Carvalho de Melo
2024-09-12 13:07                           ` Arnaldo Carvalho de Melo
2024-09-19 13:14                             ` Veronika Molnarova
2024-09-26 22:33                               ` Namhyung Kim

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240624130809.1612-3-mpetlan@redhat.com \
    --to=mpetlan@redhat.com \
    --cc=acme@kernel.org \
    --cc=acme@redhat.com \
    --cc=atrajeev@linux.vnet.ibm.com \
    --cc=irogers@google.com \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=masami.hiramatsu.pt@hitachi.com \
    --cc=namhyung@kernel.org \
    --cc=vmolnaro@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).