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, acme@redhat.com
Cc: peterz@infradead.org, mingo@redhat.com, acme@kernel.org,
	namhyung@kernel.org, mark.rutland@arm.com,
	alexander.shishkin@linux.intel.com, jolsa@kernel.org,
	irogers@google.com, adrian.hunter@intel.com,
	atrajeev@linux.vnet.ibm.com, kjain@linux.ibm.com
Subject: [PATCH v2 2/7] perf testsuite: Add common setting for shell tests
Date: Thu, 15 Feb 2024 12:02:26 +0100	[thread overview]
Message-ID: <20240215110231.15385-3-mpetlan@redhat.com> (raw)
In-Reply-To: <20240215110231.15385-1-mpetlan@redhat.com>

From: Veronika Molnarova <vmolnaro@redhat.com>

Add settings defining sample commands later shared by shell tests. This
adds the possibility to globally adjust the default values for the whole
testsuite.

Signed-off-by: Veronika Molnarova <vmolnaro@redhat.com>
Signed-off-by: Michael Petlan <mpetlan@redhat.com>
---
 tools/perf/tests/shell/common/settings.sh | 79 +++++++++++++++++++++++
 1 file changed, 79 insertions(+)
 create mode 100644 tools/perf/tests/shell/common/settings.sh

diff --git a/tools/perf/tests/shell/common/settings.sh b/tools/perf/tests/shell/common/settings.sh
new file mode 100644
index 000000000000..361641dbaaad
--- /dev/null
+++ b/tools/perf/tests/shell/common/settings.sh
@@ -0,0 +1,79 @@
+# SPDX-License-Identifier: GPL-2.0
+#
+#	settings.sh
+#	Author: Michael Petlan <mpetlan@redhat.com>
+#
+#	Description:
+#
+#		This file contains global settings for the whole testsuite.
+#	Its purpose is to make it easier when it is necessary i.e. to
+#	change the usual sample command which is used in all of the tests
+#	in many files.
+#
+#		This file is intended to be sourced in the tests.
+#
+
+#### which perf to use in the testing
+export CMD_PERF=${CMD_PERF:-`which perf`}
+
+#### basic programs examinated by perf
+export CMD_BASIC_SLEEP="sleep 0.1"
+export CMD_QUICK_SLEEP="sleep 0.01"
+export CMD_LONGER_SLEEP="sleep 2"
+export CMD_DOUBLE_LONGER_SLEEP="sleep 4"
+export CMD_VERY_LONG_SLEEP="sleep 30"
+export CMD_SIMPLE="true"
+
+#### testsuite run mode
+# define constants:
+export RUNMODE_BASIC=0
+export RUNMODE_STANDARD=1
+export RUNMODE_EXPERIMENTAL=2
+# default runmode is STANDARD
+export PERFTOOL_TESTSUITE_RUNMODE=${PERFTOOL_TESTSUITE_RUNMODE:-$RUNMODE_STANDARD}
+
+#### common settings
+export TESTLOG_VERBOSITY=${TESTLOG_VERBOSITY:-2}
+export TESTLOG_FORCE_COLOR=${TESTLOG_FORCE_COLOR:-n}
+export TESTLOG_ERR_MSG_MAX_LINES=${TESTLOG_ERR_MSG_MAX_LINES:-20}
+export TESTLOG_CLEAN=${TESTLOG_CLEAN:-y}
+
+#### other environment-related settings
+export TEST_IGNORE_MISSING_PMU=${TEST_IGNORE_MISSING_PMU:-n}
+
+#### clear locale
+export LC_ALL=C
+
+#### colors
+if [ -t 1 -o "$TESTLOG_FORCE_COLOR" = "yes" ]; then
+	export MPASS="\e[32m"
+	export MALLPASS="\e[1;32m"
+	export MFAIL="\e[31m"
+	export MALLFAIL="\e[1;31m"
+	export MWARN="\e[1;35m"
+	export MSKIP="\e[33m"
+	export MHIGH="\e[1;33m"
+	export MEND="\e[m"
+else
+	export MPASS=""
+	export MALLPASS=""
+	export MFAIL=""
+	export MALLFAIL=""
+	export MWARN=""
+	export MSKIP=""
+	export MHIGH=""
+	export MEND=""
+fi
+
+
+#### test parametrization
+if [ ! -d ./common ]; then
+	# set parameters based on runmode
+	if [ -f ../common/parametrization.$PERFTOOL_TESTSUITE_RUNMODE.sh ]; then
+		. ../common/parametrization.$PERFTOOL_TESTSUITE_RUNMODE.sh
+	fi
+	# if some parameters haven't been set until now, set them to default
+	if [ -f ../common/parametrization.sh ]; then
+		. ../common/parametrization.sh
+	fi
+fi
-- 
2.43.0


  parent reply	other threads:[~2024-02-15 11:02 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-31 11:39 [PATCH 1/7] perf testsuite: Add common regex patters Michael Petlan
2024-01-31 11:39 ` [PATCH 2/7] perf testsuite: Add common setting for shell tests Michael Petlan
2024-01-31 11:39 ` [PATCH 3/7] perf testsuite: Add initialization script " Michael Petlan
2024-01-31 11:39 ` [PATCH 4/7] perf testsuite: Add test case for perf probe Michael Petlan
2024-01-31 11:39 ` [PATCH 5/7] perf testsuite: Add common output checking helpers Michael Petlan
2024-01-31 11:39 ` [PATCH 6/7] perf testsuite: Add test for kprobe handling Michael Petlan
2024-01-31 11:39 ` [PATCH 7/7] perf testsuite: Install kprobe tests and common files Michael Petlan
2024-01-31 13:47 ` [PATCH 1/7] perf testsuite: Add common regex patters Arnaldo Carvalho de Melo
2024-01-31 13:53   ` Arnaldo Carvalho de Melo
2024-02-01 23:59   ` Namhyung Kim
2024-02-02  0:05 ` Namhyung Kim
2024-02-08 16:49   ` Michael Petlan
2024-02-09  7:13     ` Namhyung Kim
2024-02-09 22:56       ` Namhyung Kim
2024-02-15 11:02 ` [PATCH v2 0/7] Add perf testsuite into perf-test Michael Petlan
2024-02-15 11:02   ` [PATCH v2 1/7] perf testsuite: Add common regex patters Michael Petlan
2024-02-15 11:02   ` Michael Petlan [this message]
2024-02-15 11:02   ` [PATCH v2 3/7] perf testsuite: Add initialization script for shell tests Michael Petlan
2024-02-15 11:02   ` [PATCH v2 4/7] perf testsuite: Add test case for perf probe Michael Petlan
2024-02-15 11:02   ` [PATCH v2 5/7] perf testsuite: Add common output checking helpers Michael Petlan
2024-02-15 11:02   ` [PATCH v2 6/7] perf testsuite: Add test for kprobe handling Michael Petlan
2024-02-15 11:02   ` [PATCH v2 7/7] perf testsuite: Install kprobe tests and common files Michael Petlan
2024-02-21  1:58   ` [PATCH v2 0/7] Add perf testsuite into perf-test 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=20240215110231.15385-3-mpetlan@redhat.com \
    --to=mpetlan@redhat.com \
    --cc=acme@kernel.org \
    --cc=acme@redhat.com \
    --cc=adrian.hunter@intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=atrajeev@linux.vnet.ibm.com \
    --cc=irogers@google.com \
    --cc=jolsa@kernel.org \
    --cc=kjain@linux.ibm.com \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    /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).