Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf testsuite: Merge settings files for shell tests

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

Signed-off-by: Michael Petlan <mpetlan@redhat.com>
Signed-off-by: Veronika Molnarova <vmolnaro@redhat.com>
Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: https://lore.kernel.org/r/20240702110849.31904-4-vmolnaro@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Veronika Molnarova and committed by
Arnaldo Carvalho de Melo
a3a02a52 5a02447c

+46 -51
-48
tools/perf/tests/shell/base_probe/settings.sh
··· 1 - # SPDX-License-Identifier: GPL-2.0 2 - # 3 - # settings.sh of perf_probe test 4 - # Author: Michael Petlan <mpetlan@redhat.com> 5 - # Author: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> 6 - # 7 - 8 - export TEST_NAME="perf_probe" 9 - 10 - export MY_ARCH=`arch` 11 - 12 - if [ -n "$PERFSUITE_RUN_DIR" ]; then 13 - # when $PERFSUITE_RUN_DIR is set to something, all the logs and temp files will be placed there 14 - # --> the $PERFSUITE_RUN_DIR/perf_something/examples and $PERFSUITE_RUN_DIR/perf_something/logs 15 - # dirs will be used for that 16 - export PERFSUITE_RUN_DIR=`readlink -f $PERFSUITE_RUN_DIR` 17 - export CURRENT_TEST_DIR="$PERFSUITE_RUN_DIR/$TEST_NAME" 18 - export MAKE_TARGET_DIR="$CURRENT_TEST_DIR/examples" 19 - test -d "$MAKE_TARGET_DIR" || mkdir -p "$MAKE_TARGET_DIR" 20 - export LOGS_DIR="$PERFSUITE_RUN_DIR/$TEST_NAME/logs" 21 - test -d "$LOGS_DIR" || mkdir -p "$LOGS_DIR" 22 - else 23 - # when $PERFSUITE_RUN_DIR is not set, logs will be placed here 24 - export CURRENT_TEST_DIR="." 25 - export LOGS_DIR="." 26 - fi 27 - 28 - check_kprobes_available() 29 - { 30 - test -e /sys/kernel/debug/tracing/kprobe_events 31 - } 32 - 33 - check_uprobes_available() 34 - { 35 - test -e /sys/kernel/debug/tracing/uprobe_events 36 - } 37 - 38 - clear_all_probes() 39 - { 40 - echo 0 > /sys/kernel/debug/tracing/events/enable 41 - check_kprobes_available && echo > /sys/kernel/debug/tracing/kprobe_events 42 - check_uprobes_available && echo > /sys/kernel/debug/tracing/uprobe_events 43 - } 44 - 45 - check_sdt_support() 46 - { 47 - $CMD_PERF list sdt | grep sdt > /dev/null 2> /dev/null 48 - }
-3
tools/perf/tests/shell/base_probe/test_adding_kernel.sh
··· 15 15 16 16 # include working environment 17 17 . ../common/init.sh 18 - . ./settings.sh 19 18 20 - # shellcheck disable=SC2034 # the variable is later used after the working environment is included 21 - THIS_TEST_NAME=`basename $0 .sh` 22 19 TEST_RESULT=0 23 20 24 21 # shellcheck source=lib/probe_vfs_getname.sh
+23
tools/perf/tests/shell/common/init.sh
··· 115 115 # 1 = is not AMD or unknown 116 116 grep "vendor_id" < /proc/cpuinfo | grep -q "AMD" 117 117 } 118 + 119 + # base probe utility 120 + check_kprobes_available() 121 + { 122 + test -e /sys/kernel/debug/tracing/kprobe_events 123 + } 124 + 125 + check_uprobes_available() 126 + { 127 + test -e /sys/kernel/debug/tracing/uprobe_events 128 + } 129 + 130 + clear_all_probes() 131 + { 132 + echo 0 > /sys/kernel/debug/tracing/events/enable 133 + check_kprobes_available && echo > /sys/kernel/debug/tracing/kprobe_events 134 + check_uprobes_available && echo > /sys/kernel/debug/tracing/uprobe_events 135 + } 136 + 137 + check_sdt_support() 138 + { 139 + $CMD_PERF list sdt | grep sdt > /dev/null 2> /dev/null 140 + }
+23
tools/perf/tests/shell/common/settings.sh
··· 65 65 export MEND="" 66 66 fi 67 67 68 + ### general info 69 + DIR_PATH=`dirname "$(readlink -e "$0")"` 70 + 71 + export TEST_NAME=`basename $DIR_PATH | sed 's/base/perf/'` 72 + export MY_ARCH=`arch` 73 + 74 + # storing logs and temporary files variables 75 + if [ -n "$PERFSUITE_RUN_DIR" ]; then 76 + # when $PERFSUITE_RUN_DIR is set to something, all the logs and temp files will be placed there 77 + # --> the $PERFSUITE_RUN_DIR/perf_something/examples and $PERFSUITE_RUN_DIR/perf_something/logs 78 + # dirs will be used for that 79 + export PERFSUITE_RUN_DIR=`readlink -f $PERFSUITE_RUN_DIR` 80 + 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 + test -d "$CURRENT_TEST_DIR" || mkdir -p "$CURRENT_TEST_DIR" 84 + test -d "$LOGS_DIR" || mkdir -p "$LOGS_DIR" 85 + else 86 + # when $PERFSUITE_RUN_DIR is not set, logs will be placed here 87 + export CURRENT_TEST_DIR="." 88 + export LOGS_DIR="." 89 + fi 90 + 68 91 69 92 #### test parametrization 70 93 if [ ! -d ./common ]; then