brintos

brintos / linux-shallow public Read only

0
0
Text · 3.1 KiB · cba1b33 Raw
106 lines · bash
1# SPDX-License-Identifier: GPL-2.02#3#	settings.sh4#	Author: Michael Petlan <mpetlan@redhat.com>5#6#	Description:7#8#		This file contains global settings for the whole testsuite.9#	Its purpose is to make it easier when it is necessary i.e. to10#	change the usual sample command which is used in all of the tests11#	in many files.12#13#		This file is intended to be sourced in the tests.14#15 16#### which perf to use in the testing17export CMD_PERF=${CMD_PERF:-`which perf`}18 19#### basic programs examinated by perf20export CMD_BASIC_SLEEP="sleep 0.1"21export CMD_QUICK_SLEEP="sleep 0.01"22export CMD_LONGER_SLEEP="sleep 2"23export CMD_DOUBLE_LONGER_SLEEP="sleep 4"24export CMD_VERY_LONG_SLEEP="sleep 30"25export CMD_SIMPLE="true"26 27#### testsuite run mode28# define constants:29export RUNMODE_BASIC=030export RUNMODE_STANDARD=131export RUNMODE_EXPERIMENTAL=232# default runmode is STANDARD33export PERFTOOL_TESTSUITE_RUNMODE=${PERFTOOL_TESTSUITE_RUNMODE:-$RUNMODE_STANDARD}34 35#### common settings36export TESTLOG_VERBOSITY=${TESTLOG_VERBOSITY:-2}37export TESTLOG_FORCE_COLOR=${TESTLOG_FORCE_COLOR:-n}38export TESTLOG_ERR_MSG_MAX_LINES=${TESTLOG_ERR_MSG_MAX_LINES:-20}39export TESTLOG_CLEAN=${TESTLOG_CLEAN:-y}40 41#### other environment-related settings42export TEST_IGNORE_MISSING_PMU=${TEST_IGNORE_MISSING_PMU:-n}43 44#### clear locale45export LC_ALL=C46 47#### colors48if [ -t 1 ] || [ "$TESTLOG_FORCE_COLOR" = "yes" ]; then49	export MPASS="\e[32m"50	export MALLPASS="\e[1;32m"51	export MFAIL="\e[31m"52	export MALLFAIL="\e[1;31m"53	export MWARN="\e[1;35m"54	export MSKIP="\e[33m"55	export MHIGH="\e[1;33m"56	export MEND="\e[m"57else58	export MPASS=""59	export MALLPASS=""60	export MFAIL=""61	export MALLFAIL=""62	export MWARN=""63	export MSKIP=""64	export MHIGH=""65	export MEND=""66fi67 68### general info69DIR_PATH=`dirname "$(readlink -e "$0")"`70 71TEST_NAME=`basename $DIR_PATH | sed 's/base/perf/'`; export TEST_NAME72MY_ARCH=`arch`; export MY_ARCH73 74# storing logs and temporary files variables75if [ -n "$PERFSUITE_RUN_DIR" ]; then76	# when $PERFSUITE_RUN_DIR is set to something, all the logs and temp files will be placed there77	# --> the $PERFSUITE_RUN_DIR/perf_something/examples and $PERFSUITE_RUN_DIR/perf_something/logs78	#     dirs will be used for that79	PERFSUITE_RUN_DIR=`readlink -f $PERFSUITE_RUN_DIR`; export PERFSUITE_RUN_DIR80	export CURRENT_TEST_DIR="$PERFSUITE_RUN_DIR/$TEST_NAME"81	export MAKE_TARGET_DIR="$CURRENT_TEST_DIR/examples"82	export LOGS_DIR="$CURRENT_TEST_DIR/logs"83	export HEADER_TAR_DIR="$CURRENT_TEST_DIR/header_tar"84	test -d "$CURRENT_TEST_DIR" || mkdir -p "$CURRENT_TEST_DIR"85	test -d "$LOGS_DIR" || mkdir -p "$LOGS_DIR"86else87	# when $PERFSUITE_RUN_DIR is not set, logs will be placed here88	export CURRENT_TEST_DIR="."89	export LOGS_DIR="."90	export HEADER_TAR_DIR="./header_tar"91fi92 93 94#### test parametrization95if [ ! -d ./common ]; then96	# set parameters based on runmode97	if [ -f ../common/parametrization.$PERFTOOL_TESTSUITE_RUNMODE.sh ]; then98		# shellcheck source=/dev/null99		. ../common/parametrization.$PERFTOOL_TESTSUITE_RUNMODE.sh100	fi101	# if some parameters haven't been set until now, set them to default102	if [ -f ../common/parametrization.sh ]; then103		. ../common/parametrization.sh104	fi105fi106