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

perf test perftool_testsuite: Use absolute paths

Test cases from perftool_testsuite are affected by the current
directory where the test are run. For this reason, the test
driver has to change the directory to the base_dir for references to
work correctly.

Utilize absolute paths when sourcing and referencing other scripts so
that the current working directory doesn't impact the test cases.

Reviewed-by: Ian Rogers <irogers@google.com>
Signed-off-by: Jakub Brnak <jbrnak@redhat.com>
Signed-off-by: Michael Petlan <mpetlan@redhat.com>
Signed-off-by: Veronika Molnarova <vmolnaro@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Veronika Molnarova and committed by
Arnaldo Carvalho de Melo
241f21be a93b9ccb

+202 -84
+14 -6
tools/perf/tests/shell/base_probe/test_adding_blacklisted.sh
··· 13 13 # they must be skipped. 14 14 # 15 15 16 - # include working environment 17 - . ../common/init.sh 18 - 16 + DIR_PATH="$(dirname $0)" 19 17 TEST_RESULT=0 18 + 19 + # include working environment 20 + . "$DIR_PATH/../common/init.sh" 20 21 21 22 # skip if not supported 22 23 BLACKFUNC_LIST=`head -n 5 /sys/kernel/debug/kprobes/blacklist 2> /dev/null | cut -f2` ··· 54 53 PERF_EXIT_CODE=$? 55 54 56 55 # check for bad DWARF polluting the result 57 - ../common/check_all_patterns_found.pl "$REGEX_MISSING_DECL_LINE" >/dev/null < $LOGS_DIR/adding_blacklisted.err 56 + "$DIR_PATH/../common/check_all_patterns_found.pl" \ 57 + "$REGEX_MISSING_DECL_LINE" >/dev/null < $LOGS_DIR/adding_blacklisted.err 58 58 59 59 if [ $? -eq 0 ]; then 60 60 SKIP_DWARF=1 ··· 75 73 fi 76 74 fi 77 75 else 78 - ../common/check_all_lines_matched.pl "$REGEX_SKIP_MESSAGE" "$REGEX_NOT_FOUND_MESSAGE" "$REGEX_ERROR_MESSAGE" "$REGEX_SCOPE_FAIL" "$REGEX_INVALID_ARGUMENT" "$REGEX_SYMBOL_FAIL" "$REGEX_OUT_SECTION" < $LOGS_DIR/adding_blacklisted.err 76 + "$DIR_PATH/../common/check_all_lines_matched.pl" \ 77 + "$REGEX_SKIP_MESSAGE" "$REGEX_NOT_FOUND_MESSAGE" \ 78 + "$REGEX_ERROR_MESSAGE" "$REGEX_SCOPE_FAIL" \ 79 + "$REGEX_INVALID_ARGUMENT" "$REGEX_SYMBOL_FAIL" \ 80 + "$REGEX_OUT_SECTION" < $LOGS_DIR/adding_blacklisted.err 79 81 CHECK_EXIT_CODE=$? 80 82 81 83 SKIP_DWARF=0 ··· 100 94 $CMD_PERF list probe:\* > $LOGS_DIR/adding_blacklisted_list.log 101 95 PERF_EXIT_CODE=$? 102 96 103 - ../common/check_all_lines_matched.pl "$RE_LINE_EMPTY" "List of pre-defined events" "Metric Groups:" < $LOGS_DIR/adding_blacklisted_list.log 97 + "$DIR_PATH/../common/check_all_lines_matched.pl" \ 98 + "$RE_LINE_EMPTY" "List of pre-defined events" "Metric Groups:" \ 99 + < $LOGS_DIR/adding_blacklisted_list.log 104 100 CHECK_EXIT_CODE=$? 105 101 106 102 print_results $PERF_EXIT_CODE $CHECK_EXIT_CODE "listing blacklisted probe (should NOT be listed)"
+71 -26
tools/perf/tests/shell/base_probe/test_adding_kernel.sh
··· 13 13 # and removing. 14 14 # 15 15 16 - # include working environment 17 - . ../common/init.sh 18 - 16 + DIR_PATH="$(dirname $0)" 19 17 TEST_RESULT=0 20 18 19 + # include working environment 20 + . "$DIR_PATH/../common/init.sh" 21 + 21 22 # shellcheck source=lib/probe_vfs_getname.sh 22 - . "$(dirname "$0")/../lib/probe_vfs_getname.sh" 23 + . "$DIR_PATH/../lib/probe_vfs_getname.sh" 23 24 24 25 TEST_PROBE=${TEST_PROBE:-"inode_permission"} 25 26 ··· 45 44 $CMD_PERF probe $opt $TEST_PROBE 2> $LOGS_DIR/adding_kernel_add$opt.err 46 45 PERF_EXIT_CODE=$? 47 46 48 - ../common/check_all_patterns_found.pl "Added new events?:" "probe:$TEST_PROBE" "on $TEST_PROBE" < $LOGS_DIR/adding_kernel_add$opt.err 47 + "$DIR_PATH/../common/check_all_patterns_found.pl" \ 48 + "Added new events?:" "probe:$TEST_PROBE" "on $TEST_PROBE" \ 49 + < $LOGS_DIR/adding_kernel_add$opt.err 49 50 CHECK_EXIT_CODE=$? 50 51 51 52 print_results $PERF_EXIT_CODE $CHECK_EXIT_CODE "adding probe $TEST_PROBE :: $opt" ··· 61 58 $CMD_PERF list probe:\* > $LOGS_DIR/adding_kernel_list.log 62 59 PERF_EXIT_CODE=$? 63 60 64 - ../common/check_all_lines_matched.pl "$RE_LINE_EMPTY" "List of pre-defined events" "probe:${TEST_PROBE}(?:_\d+)?\s+\[Tracepoint event\]" "Metric Groups:" < $LOGS_DIR/adding_kernel_list.log 61 + "$DIR_PATH/../common/check_all_lines_matched.pl" \ 62 + "$RE_LINE_EMPTY" "List of pre-defined events" \ 63 + "probe:${TEST_PROBE}(?:_\d+)?\s+\[Tracepoint event\]" \ 64 + "Metric Groups:" < $LOGS_DIR/adding_kernel_list.log 65 65 CHECK_EXIT_CODE=$? 66 66 67 67 print_results $PERF_EXIT_CODE $CHECK_EXIT_CODE "listing added probe :: perf list" ··· 77 71 $CMD_PERF probe -l > $LOGS_DIR/adding_kernel_list-l.log 78 72 PERF_EXIT_CODE=$? 79 73 80 - ../common/check_all_patterns_found.pl "\s*probe:${TEST_PROBE}(?:_\d+)?\s+\(on ${TEST_PROBE}(?:[:\+]$RE_NUMBER_HEX)?@.+\)" < $LOGS_DIR/adding_kernel_list-l.log 74 + "$DIR_PATH/../common/check_all_patterns_found.pl" \ 75 + "\s*probe:${TEST_PROBE}(?:_\d+)?\s+\(on ${TEST_PROBE}(?:[:\+]$RE_NUMBER_HEX)?@.+\)" \ 76 + < $LOGS_DIR/adding_kernel_list-l.log 81 77 CHECK_EXIT_CODE=$? 82 78 83 79 if [ $NO_DEBUGINFO ] ; then ··· 101 93 # the value should be greater than 1 102 94 REGEX_STAT_VALUE_NONZERO="\s*[1-9][0-9]*\s+probe:$TEST_PROBE" 103 95 REGEX_STAT_TIME="\s*$RE_NUMBER\s+seconds (?:time elapsed|user|sys)" 104 - ../common/check_all_lines_matched.pl "$REGEX_STAT_HEADER" "$REGEX_STAT_VALUES" "$REGEX_STAT_TIME" "$RE_LINE_COMMENT" "$RE_LINE_EMPTY" < $LOGS_DIR/adding_kernel_using_probe.log 96 + "$DIR_PATH/../common/check_all_lines_matched.pl" \ 97 + "$REGEX_STAT_HEADER" "$REGEX_STAT_VALUES" "$REGEX_STAT_TIME" \ 98 + "$RE_LINE_COMMENT" "$RE_LINE_EMPTY" < $LOGS_DIR/adding_kernel_using_probe.log 105 99 CHECK_EXIT_CODE=$? 106 - ../common/check_all_patterns_found.pl "$REGEX_STAT_HEADER" "$REGEX_STAT_VALUE_NONZERO" "$REGEX_STAT_TIME" < $LOGS_DIR/adding_kernel_using_probe.log 100 + "$DIR_PATH/../common/check_all_patterns_found.pl" \ 101 + "$REGEX_STAT_HEADER" "$REGEX_STAT_VALUE_NONZERO" "$REGEX_STAT_TIME" \ 102 + < $LOGS_DIR/adding_kernel_using_probe.log 107 103 (( CHECK_EXIT_CODE += $? )) 108 104 109 105 print_results $PERF_EXIT_CODE $CHECK_EXIT_CODE "using added probe" ··· 120 108 $CMD_PERF probe -d $TEST_PROBE\* 2> $LOGS_DIR/adding_kernel_removing.err 121 109 PERF_EXIT_CODE=$? 122 110 123 - ../common/check_all_lines_matched.pl "Removed event: probe:$TEST_PROBE" < $LOGS_DIR/adding_kernel_removing.err 111 + "$DIR_PATH/../common/check_all_lines_matched.pl" \ 112 + "Removed event: probe:$TEST_PROBE" < $LOGS_DIR/adding_kernel_removing.err 124 113 CHECK_EXIT_CODE=$? 125 114 126 115 print_results $PERF_EXIT_CODE $CHECK_EXIT_CODE "deleting added probe" ··· 134 121 $CMD_PERF list probe:\* > $LOGS_DIR/adding_kernel_list_removed.log 135 122 PERF_EXIT_CODE=$? 136 123 137 - ../common/check_all_lines_matched.pl "$RE_LINE_EMPTY" "List of pre-defined events" "Metric Groups:" < $LOGS_DIR/adding_kernel_list_removed.log 124 + "$DIR_PATH/../common/check_all_lines_matched.pl" \ 125 + "$RE_LINE_EMPTY" "List of pre-defined events" "Metric Groups:" \ 126 + < $LOGS_DIR/adding_kernel_list_removed.log 138 127 CHECK_EXIT_CODE=$? 139 128 140 129 print_results $PERF_EXIT_CODE $CHECK_EXIT_CODE "listing removed probe (should NOT be listed)" ··· 150 135 PERF_EXIT_CODE=$? 151 136 152 137 # check for the output (should be the same as usual) 153 - ../common/check_all_patterns_found.pl "Added new events?:" "probe:$TEST_PROBE" "on $TEST_PROBE" < $LOGS_DIR/adding_kernel_dryrun.err 138 + "$DIR_PATH/../common/check_all_patterns_found.pl" \ 139 + "Added new events?:" "probe:$TEST_PROBE" "on $TEST_PROBE" \ 140 + < $LOGS_DIR/adding_kernel_dryrun.err 154 141 CHECK_EXIT_CODE=$? 155 142 156 143 # check that no probe was added in real ··· 169 152 $CMD_PERF probe --add $TEST_PROBE 2> $LOGS_DIR/adding_kernel_forceadd_01.err 170 153 PERF_EXIT_CODE=$? 171 154 172 - ../common/check_all_patterns_found.pl "Added new events?:" "probe:$TEST_PROBE" "on $TEST_PROBE" < $LOGS_DIR/adding_kernel_forceadd_01.err 155 + "$DIR_PATH/../common/check_all_patterns_found.pl" \ 156 + "Added new events?:" "probe:$TEST_PROBE" "on $TEST_PROBE" \ 157 + < $LOGS_DIR/adding_kernel_forceadd_01.err 173 158 CHECK_EXIT_CODE=$? 174 159 175 160 print_results $PERF_EXIT_CODE $CHECK_EXIT_CODE "force-adding probes :: first probe adding" ··· 181 162 ! $CMD_PERF probe --add $TEST_PROBE 2> $LOGS_DIR/adding_kernel_forceadd_02.err 182 163 PERF_EXIT_CODE=$? 183 164 184 - ../common/check_all_patterns_found.pl "Error: event \"$TEST_PROBE\" already exists." "Error: Failed to add events." < $LOGS_DIR/adding_kernel_forceadd_02.err 165 + "$DIR_PATH/../common/check_all_patterns_found.pl" \ 166 + "Error: event \"$TEST_PROBE\" already exists." \ 167 + "Error: Failed to add events." < $LOGS_DIR/adding_kernel_forceadd_02.err 185 168 CHECK_EXIT_CODE=$? 186 169 187 170 print_results $PERF_EXIT_CODE $CHECK_EXIT_CODE "force-adding probes :: second probe adding (without force)" ··· 194 173 $CMD_PERF probe --force --add $TEST_PROBE 2> $LOGS_DIR/adding_kernel_forceadd_03.err 195 174 PERF_EXIT_CODE=$? 196 175 197 - ../common/check_all_patterns_found.pl "Added new events?:" "probe:${TEST_PROBE}_${NO_OF_PROBES}" "on $TEST_PROBE" < $LOGS_DIR/adding_kernel_forceadd_03.err 176 + "$DIR_PATH/../common/check_all_patterns_found.pl" \ 177 + "Added new events?:" "probe:${TEST_PROBE}_${NO_OF_PROBES}" \ 178 + "on $TEST_PROBE" < $LOGS_DIR/adding_kernel_forceadd_03.err 198 179 CHECK_EXIT_CODE=$? 199 180 200 181 print_results $PERF_EXIT_CODE $CHECK_EXIT_CODE "force-adding probes :: second probe adding (with force)" ··· 210 187 PERF_EXIT_CODE=$? 211 188 212 189 REGEX_LINE="$RE_NUMBER;+probe:${TEST_PROBE}_?(?:$NO_OF_PROBES)?;$RE_NUMBER;$RE_NUMBER" 213 - ../common/check_all_lines_matched.pl "$REGEX_LINE" "$RE_LINE_EMPTY" "$RE_LINE_COMMENT" < $LOGS_DIR/adding_kernel_using_two.log 190 + "$DIR_PATH/../common/check_all_lines_matched.pl" \ 191 + "$REGEX_LINE" "$RE_LINE_EMPTY" "$RE_LINE_COMMENT" \ 192 + < $LOGS_DIR/adding_kernel_using_two.log 214 193 CHECK_EXIT_CODE=$? 215 194 216 195 VALUE_1=`grep "$TEST_PROBE;" $LOGS_DIR/adding_kernel_using_two.log | awk -F';' '{print $1}'` ··· 230 205 $CMD_PERF probe --del \* 2> $LOGS_DIR/adding_kernel_removing_wildcard.err 231 206 PERF_EXIT_CODE=$? 232 207 233 - ../common/check_all_patterns_found.pl "Removed event: probe:$TEST_PROBE" "Removed event: probe:${TEST_PROBE}_1" < $LOGS_DIR/adding_kernel_removing_wildcard.err 208 + "$DIR_PATH/../common/check_all_lines_matched.pl" \ 209 + "Removed event: probe:$TEST_PROBE" \ 210 + "Removed event: probe:${TEST_PROBE}_1" < $LOGS_DIR/adding_kernel_removing_wildcard.err 234 211 CHECK_EXIT_CODE=$? 235 212 236 213 print_results $PERF_EXIT_CODE $CHECK_EXIT_CODE "removing multiple probes" ··· 244 217 $CMD_PERF probe -nf --max-probes=512 -a 'vfs_* $params' 2> $LOGS_DIR/adding_kernel_adding_wildcard.err 245 218 PERF_EXIT_CODE=$? 246 219 247 - ../common/check_all_patterns_found.pl "probe:vfs_mknod" "probe:vfs_create" "probe:vfs_rmdir" "probe:vfs_link" "probe:vfs_write" < $LOGS_DIR/adding_kernel_adding_wildcard.err 220 + "$DIR_PATH/../common/check_all_patterns_found.pl" \ 221 + "probe:vfs_mknod" "probe:vfs_create" "probe:vfs_rmdir" \ 222 + "probe:vfs_link" "probe:vfs_write" < $LOGS_DIR/adding_kernel_adding_wildcard.err 248 223 CHECK_EXIT_CODE=$? 249 224 250 225 if [ $NO_DEBUGINFO ] ; then ··· 269 240 PERF_EXIT_CODE=$? 270 241 271 242 # check that the error message is reasonable 272 - ../common/check_all_patterns_found.pl "Failed to find" "somenonexistingrandomstuffwhichisalsoprettylongorevenlongertoexceed64" < $LOGS_DIR/adding_kernel_nonexisting.err 243 + "$DIR_PATH/../common/check_all_patterns_found.pl" \ 244 + "Failed to find" \ 245 + "somenonexistingrandomstuffwhichisalsoprettylongorevenlongertoexceed64" \ 246 + < $LOGS_DIR/adding_kernel_nonexisting.err 273 247 CHECK_EXIT_CODE=$? 274 - ../common/check_all_patterns_found.pl "in this function|at this address" "Error" "Failed to add events" < $LOGS_DIR/adding_kernel_nonexisting.err 248 + "$DIR_PATH/../common/check_all_patterns_found.pl" \ 249 + "in this function|at this address" "Error" "Failed to add events" \ 250 + < $LOGS_DIR/adding_kernel_nonexisting.err 275 251 (( CHECK_EXIT_CODE += $? )) 276 - ../common/check_all_lines_matched.pl "Failed to find" "Error" "Probe point .+ not found" "optimized out" "Use.+\-\-range option to show.+location range" < $LOGS_DIR/adding_kernel_nonexisting.err 252 + "$DIR_PATH/../common/check_all_lines_matched.pl" \ 253 + "Failed to find" "Error" "Probe point .+ not found" "optimized out" \ 254 + "Use.+\-\-range option to show.+location range" \ 255 + < $LOGS_DIR/adding_kernel_nonexisting.err 277 256 (( CHECK_EXIT_CODE += $? )) 278 - ../common/check_no_patterns_found.pl "$RE_SEGFAULT" < $LOGS_DIR/adding_kernel_nonexisting.err 257 + "$DIR_PATH/../common/check_no_patterns_found.pl" \ 258 + "$RE_SEGFAULT" < $LOGS_DIR/adding_kernel_nonexisting.err 279 259 (( CHECK_EXIT_CODE += $? )) 280 260 281 261 if [ $NO_DEBUGINFO ]; then ··· 302 264 $CMD_PERF probe --add "$TEST_PROBE%return \$retval" 2> $LOGS_DIR/adding_kernel_func_retval_add.err 303 265 PERF_EXIT_CODE=$? 304 266 305 - ../common/check_all_patterns_found.pl "Added new events?:" "probe:$TEST_PROBE" "on $TEST_PROBE%return with \\\$retval" < $LOGS_DIR/adding_kernel_func_retval_add.err 267 + "$DIR_PATH/../common/check_all_patterns_found.pl" \ 268 + "Added new events?:" "probe:$TEST_PROBE" \ 269 + "on $TEST_PROBE%return with \\\$retval" \ 270 + < $LOGS_DIR/adding_kernel_func_retval_add.err 306 271 CHECK_EXIT_CODE=$? 307 272 308 273 print_results $PERF_EXIT_CODE $CHECK_EXIT_CODE "function with retval :: add" ··· 315 274 $CMD_PERF record -e probe:$TEST_PROBE\* -o $CURRENT_TEST_DIR/perf.data -- cat /proc/cpuinfo > /dev/null 2> $LOGS_DIR/adding_kernel_func_retval_record.err 316 275 PERF_EXIT_CODE=$? 317 276 318 - ../common/check_all_patterns_found.pl "$RE_LINE_RECORD1" "$RE_LINE_RECORD2" < $LOGS_DIR/adding_kernel_func_retval_record.err 277 + "$DIR_PATH/../common/check_all_patterns_found.pl" \ 278 + "$RE_LINE_RECORD1" "$RE_LINE_RECORD2" \ 279 + < $LOGS_DIR/adding_kernel_func_retval_record.err 319 280 CHECK_EXIT_CODE=$? 320 281 321 282 print_results $PERF_EXIT_CODE $CHECK_EXIT_CODE "function with retval :: record" ··· 328 285 PERF_EXIT_CODE=$? 329 286 330 287 REGEX_SCRIPT_LINE="\s*cat\s+$RE_NUMBER\s+\[$RE_NUMBER\]\s+$RE_NUMBER:\s+probe:$TEST_PROBE\w*:\s+\($RE_NUMBER_HEX\s+<\-\s+$RE_NUMBER_HEX\)\s+arg1=$RE_NUMBER_HEX" 331 - ../common/check_all_lines_matched.pl "$REGEX_SCRIPT_LINE" < $LOGS_DIR/adding_kernel_func_retval_script.log 288 + "$DIR_PATH/../common/check_all_lines_matched.pl" \ 289 + "$REGEX_SCRIPT_LINE" < $LOGS_DIR/adding_kernel_func_retval_script.log 332 290 CHECK_EXIT_CODE=$? 333 - ../common/check_all_patterns_found.pl "$REGEX_SCRIPT_LINE" < $LOGS_DIR/adding_kernel_func_retval_script.log 291 + "$DIR_PATH/../common/check_all_patterns_found.pl" \ 292 + "$REGEX_SCRIPT_LINE" < $LOGS_DIR/adding_kernel_func_retval_script.log 334 293 (( CHECK_EXIT_CODE += $? )) 335 294 336 295 print_results $PERF_EXIT_CODE $CHECK_EXIT_CODE "function argument probing :: script"
+22 -9
tools/perf/tests/shell/base_probe/test_basic.sh
··· 12 12 # This test tests basic functionality of perf probe command. 13 13 # 14 14 15 - # include working environment 16 - . ../common/init.sh 17 - 15 + DIR_PATH="$(dirname $0)" 18 16 TEST_RESULT=0 17 + 18 + # include working environment 19 + . "$DIR_PATH/../common/init.sh" 19 20 20 21 if ! check_kprobes_available; then 21 22 print_overall_skipped ··· 31 30 $CMD_PERF probe --help > $LOGS_DIR/basic_helpmsg.log 2> $LOGS_DIR/basic_helpmsg.err 32 31 PERF_EXIT_CODE=$? 33 32 34 - ../common/check_all_patterns_found.pl "PERF-PROBE" "NAME" "SYNOPSIS" "DESCRIPTION" "OPTIONS" "PROBE\s+SYNTAX" "PROBE\s+ARGUMENT" "LINE\s+SYNTAX" < $LOGS_DIR/basic_helpmsg.log 33 + "$DIR_PATH/../common/check_all_patterns_found.pl" \ 34 + "PERF-PROBE" "NAME" "SYNOPSIS" "DESCRIPTION" "OPTIONS" \ 35 + "PROBE\s+SYNTAX" "PROBE\s+ARGUMENT" "LINE\s+SYNTAX" \ 36 + < $LOGS_DIR/basic_helpmsg.log 35 37 CHECK_EXIT_CODE=$? 36 - ../common/check_all_patterns_found.pl "LAZY\s+MATCHING" "FILTER\s+PATTERN" "EXAMPLES" "SEE\s+ALSO" < $LOGS_DIR/basic_helpmsg.log 38 + "$DIR_PATH/../common/check_all_patterns_found.pl" \ 39 + "LAZY\s+MATCHING" "FILTER\s+PATTERN" "EXAMPLES" "SEE\s+ALSO" \ 40 + < $LOGS_DIR/basic_helpmsg.log 37 41 (( CHECK_EXIT_CODE += $? )) 38 - ../common/check_all_patterns_found.pl "vmlinux" "module=" "source=" "verbose" "quiet" "add=" "del=" "list.*EVENT" "line=" "vars=" "externs" < $LOGS_DIR/basic_helpmsg.log 42 + "$DIR_PATH/../common/check_all_patterns_found.pl" \ 43 + "vmlinux" "module=" "source=" "verbose" "quiet" "add=" "del=" \ 44 + "list.*EVENT" "line=" "vars=" "externs" < $LOGS_DIR/basic_helpmsg.log 39 45 (( CHECK_EXIT_CODE += $? )) 40 - ../common/check_all_patterns_found.pl "no-inlines" "funcs.*FILTER" "filter=FILTER" "force" "dry-run" "max-probes" "exec=" "demangle-kernel" < $LOGS_DIR/basic_helpmsg.log 46 + "$DIR_PATH/../common/check_all_patterns_found.pl" \ 47 + "no-inlines" "funcs.*FILTER" "filter=FILTER" "force" "dry-run" \ 48 + "max-probes" "exec=" "demangle-kernel" < $LOGS_DIR/basic_helpmsg.log 41 49 (( CHECK_EXIT_CODE += $? )) 42 - ../common/check_no_patterns_found.pl "No manual entry for" < $LOGS_DIR/basic_helpmsg.err 50 + "$DIR_PATH/../common/check_no_patterns_found.pl" \ 51 + "No manual entry for" < $LOGS_DIR/basic_helpmsg.err 43 52 (( CHECK_EXIT_CODE += $? )) 44 53 45 54 print_results $PERF_EXIT_CODE $CHECK_EXIT_CODE "help message" ··· 64 53 # without any args perf-probe should print usage 65 54 $CMD_PERF probe 2> $LOGS_DIR/basic_usage.log > /dev/null 66 55 67 - ../common/check_all_patterns_found.pl "[Uu]sage" "perf probe" "verbose" "quiet" "add" "del" "force" "line" "vars" "externs" "range" < $LOGS_DIR/basic_usage.log 56 + "$DIR_PATH/../common/check_all_patterns_found.pl" \ 57 + "[Uu]sage" "perf probe" "verbose" "quiet" "add" "del" "force" \ 58 + "line" "vars" "externs" "range" < $LOGS_DIR/basic_usage.log 68 59 CHECK_EXIT_CODE=$? 69 60 70 61 print_results 0 $CHECK_EXIT_CODE "usage message"
+9 -5
tools/perf/tests/shell/base_probe/test_invalid_options.sh
··· 12 12 # This test checks whether the invalid and incompatible options are reported 13 13 # 14 14 15 - # include working environment 16 - . ../common/init.sh 17 - 15 + DIR_PATH="$(dirname $0)" 18 16 TEST_RESULT=0 17 + 18 + # include working environment 19 + . "$DIR_PATH/../common/init.sh" 19 20 20 21 if ! check_kprobes_available; then 21 22 print_overall_skipped ··· 34 33 ! $CMD_PERF probe $opt 2> $LOGS_DIR/invalid_options_missing_argument$opt.err 35 34 PERF_EXIT_CODE=$? 36 35 37 - ../common/check_all_patterns_found.pl "Error: switch .* requires a value" < $LOGS_DIR/invalid_options_missing_argument$opt.err 36 + "$DIR_PATH/../common/check_all_patterns_found.pl" \ 37 + "Error: switch .* requires a value" \ 38 + < $LOGS_DIR/invalid_options_missing_argument$opt.err 38 39 CHECK_EXIT_CODE=$? 39 40 40 41 print_results $PERF_EXIT_CODE $CHECK_EXIT_CODE "missing argument for $opt" ··· 69 66 ! $CMD_PERF probe $opt > /dev/null 2> $LOGS_DIR/aux.log 70 67 PERF_EXIT_CODE=$? 71 68 72 - ../common/check_all_patterns_found.pl "Error: switch .+ cannot be used with switch .+" < $LOGS_DIR/aux.log 69 + "$DIR_PATH/../common/check_all_patterns_found.pl" \ 70 + "Error: switch .+ cannot be used with switch .+" < $LOGS_DIR/aux.log 73 71 CHECK_EXIT_CODE=$? 74 72 75 73 print_results $PERF_EXIT_CODE $CHECK_EXIT_CODE "mutually exclusive options :: $opt"
+4 -3
tools/perf/tests/shell/base_probe/test_line_semantics.sh
··· 13 13 # arguments are properly reported. 14 14 # 15 15 16 - # include working environment 17 - . ../common/init.sh 18 - 16 + DIR_PATH="$(dirname $0)" 19 17 TEST_RESULT=0 18 + 19 + # include working environment 20 + . "$DIR_PATH/../common/init.sh" 20 21 21 22 if ! check_kprobes_available; then 22 23 print_overall_skipped
+7 -3
tools/perf/tests/shell/base_report/setup.sh
··· 12 12 # 13 13 # 14 14 15 + DIR_PATH="$(dirname $0)" 16 + 15 17 # include working environment 16 - . ../common/init.sh 18 + . "$DIR_PATH/../common/init.sh" 17 19 18 20 TEST_RESULT=0 19 21 ··· 26 24 $CMD_PERF record -asdg -e $SW_EVENT -o $CURRENT_TEST_DIR/perf.data -- $CMD_LONGER_SLEEP 2> $LOGS_DIR/setup.log 27 25 PERF_EXIT_CODE=$? 28 26 29 - ../common/check_all_patterns_found.pl "$RE_LINE_RECORD1" "$RE_LINE_RECORD2" < $LOGS_DIR/setup.log 27 + "$DIR_PATH/../common/check_all_patterns_found.pl" \ 28 + "$RE_LINE_RECORD1" "$RE_LINE_RECORD2" < $LOGS_DIR/setup.log 30 29 CHECK_EXIT_CODE=$? 31 30 32 31 print_results $PERF_EXIT_CODE $CHECK_EXIT_CODE "prepare the perf.data file" ··· 41 38 cat $LOGS_DIR/setup-latency.log 42 39 echo ================== 43 40 44 - ../common/check_all_patterns_found.pl "$RE_LINE_RECORD1" "$RE_LINE_RECORD2" < $LOGS_DIR/setup-latency.log 41 + "$DIR_PATH/../common/check_all_patterns_found.pl" \ 42 + "$RE_LINE_RECORD1" "$RE_LINE_RECORD2" < $LOGS_DIR/setup-latency.log 45 43 CHECK_EXIT_CODE=$? 46 44 47 45 print_results $PERF_EXIT_CODE $CHECK_EXIT_CODE "prepare the perf.data.1 file"
+73 -30
tools/perf/tests/shell/base_report/test_basic.sh
··· 12 12 # 13 13 # 14 14 15 - # include working environment 16 - . ../common/init.sh 17 - 15 + DIR_PATH="$(dirname $0)" 18 16 TEST_RESULT=0 17 + 18 + # include working environment 19 + . "$DIR_PATH/../common/init.sh" 19 20 20 21 21 22 ### help message ··· 26 25 $CMD_PERF report --help > $LOGS_DIR/basic_helpmsg.log 2> $LOGS_DIR/basic_helpmsg.err 27 26 PERF_EXIT_CODE=$? 28 27 29 - ../common/check_all_patterns_found.pl "PERF-REPORT" "NAME" "SYNOPSIS" "DESCRIPTION" "OPTIONS" "OVERHEAD\s+CALCULATION" "SEE ALSO" < $LOGS_DIR/basic_helpmsg.log 28 + "$DIR_PATH/../common/check_all_patterns_found.pl" \ 29 + "PERF-REPORT" "NAME" "SYNOPSIS" "DESCRIPTION" "OPTIONS" \ 30 + "OVERHEAD\s+CALCULATION" "SEE ALSO" < $LOGS_DIR/basic_helpmsg.log 30 31 CHECK_EXIT_CODE=$? 31 - ../common/check_all_patterns_found.pl "input" "verbose" "show-nr-samples" "show-cpu-utilization" "threads" "comms" "pid" "tid" "dsos" "symbols" "symbol-filter" < $LOGS_DIR/basic_helpmsg.log 32 + "$DIR_PATH/../common/check_all_patterns_found.pl" \ 33 + "input" "verbose" "show-nr-samples" "show-cpu-utilization" \ 34 + "threads" "comms" "pid" "tid" "dsos" "symbols" "symbol-filter" \ 35 + < $LOGS_DIR/basic_helpmsg.log 32 36 (( CHECK_EXIT_CODE += $? )) 33 - ../common/check_all_patterns_found.pl "hide-unresolved" "sort" "fields" "parent" "exclude-other" "column-widths" "field-separator" "dump-raw-trace" "children" < $LOGS_DIR/basic_helpmsg.log 37 + "$DIR_PATH/../common/check_all_patterns_found.pl" \ 38 + "hide-unresolved" "sort" "fields" "parent" "exclude-other" \ 39 + "column-widths" "field-separator" "dump-raw-trace" "children" \ 40 + < $LOGS_DIR/basic_helpmsg.log 34 41 (( CHECK_EXIT_CODE += $? )) 35 - ../common/check_all_patterns_found.pl "call-graph" "max-stack" "inverted" "ignore-callees" "pretty" "stdio" "tui" "gtk" "vmlinux" "kallsyms" "modules" < $LOGS_DIR/basic_helpmsg.log 42 + "$DIR_PATH/../common/check_all_patterns_found.pl" \ 43 + "call-graph" "max-stack" "inverted" "ignore-callees" "pretty" \ 44 + "stdio" "tui" "gtk" "vmlinux" "kallsyms" "modules" \ 45 + < $LOGS_DIR/basic_helpmsg.log 36 46 (( CHECK_EXIT_CODE += $? )) 37 - ../common/check_all_patterns_found.pl "force" "symfs" "cpu" "disassembler-style" "source" "asm-raw" "show-total-period" "show-info" "branch-stack" "group" < $LOGS_DIR/basic_helpmsg.log 47 + "$DIR_PATH/../common/check_all_patterns_found.pl" \ 48 + "force" "symfs" "cpu" "disassembler-style" "source" "asm-raw" \ 49 + "show-total-period" "show-info" "branch-stack" "group" \ 50 + < $LOGS_DIR/basic_helpmsg.log 38 51 (( CHECK_EXIT_CODE += $? )) 39 - ../common/check_all_patterns_found.pl "branch-history" "objdump" "demangle" "percent-limit" "percentage" "header" "itrace" "full-source-path" "show-ref-call-graph" < $LOGS_DIR/basic_helpmsg.log 52 + "$DIR_PATH/../common/check_all_patterns_found.pl" \ 53 + "branch-history" "objdump" "demangle" "percent-limit" "percentage" \ 54 + "header" "itrace" "full-source-path" "show-ref-call-graph" \ 55 + < $LOGS_DIR/basic_helpmsg.log 40 56 (( CHECK_EXIT_CODE += $? )) 41 - ../common/check_no_patterns_found.pl "No manual entry for" < $LOGS_DIR/basic_helpmsg.err 57 + "$DIR_PATH/../common/check_no_patterns_found.pl" \ 58 + "No manual entry for" < $LOGS_DIR/basic_helpmsg.err 42 59 (( CHECK_EXIT_CODE += $? )) 43 60 44 61 print_results $PERF_EXIT_CODE $CHECK_EXIT_CODE "help message" ··· 76 57 REGEX_SAMPLES_INFO="#\s*Samples:\s+(?:$RE_NUMBER)\w?\s+of\s+event\s+'$RE_EVENT_ANY'" 77 58 REGEX_LINES_HEADER="#\s*Children\s+Self\s+Command\s+Shared Object\s+Symbol" 78 59 REGEX_LINES="\s*$RE_NUMBER%\s+$RE_NUMBER%\s+\S+\s+\[kernel\.(?:vmlinux)|(?:kallsyms)\]\s+\[[k\.]\]\s+\w+" 79 - ../common/check_all_patterns_found.pl "$REGEX_LOST_SAMPLES_INFO" "$REGEX_SAMPLES_INFO" "$REGEX_LINES_HEADER" "$REGEX_LINES" < $LOGS_DIR/basic_basic.log 60 + "$DIR_PATH/../common/check_all_patterns_found.pl" \ 61 + "$REGEX_LOST_SAMPLES_INFO" "$REGEX_SAMPLES_INFO" \ 62 + "$REGEX_LINES_HEADER" "$REGEX_LINES" < $LOGS_DIR/basic_basic.log 80 63 CHECK_EXIT_CODE=$? 81 - ../common/check_errors_whitelisted.pl "stderr-whitelist.txt" < $LOGS_DIR/basic_basic.err 64 + "$DIR_PATH/../common/check_errors_whitelisted.pl" \ 65 + "$DIR_PATH/stderr-whitelist.txt" < $LOGS_DIR/basic_basic.err 82 66 (( CHECK_EXIT_CODE += $? )) 83 67 84 68 print_results $PERF_EXIT_CODE $CHECK_EXIT_CODE "basic execution" ··· 96 74 97 75 REGEX_LINES_HEADER="#\s*Children\s+Self\s+Samples\s+Command\s+Shared Object\s+Symbol" 98 76 REGEX_LINES="\s*$RE_NUMBER%\s+$RE_NUMBER%\s+$RE_NUMBER\s+\S+\s+\[kernel\.(?:vmlinux)|(?:kallsyms)\]\s+\[[k\.]\]\s+\w+" 99 - ../common/check_all_patterns_found.pl "$REGEX_LINES_HEADER" "$REGEX_LINES" < $LOGS_DIR/basic_nrsamples.log 77 + "$DIR_PATH/../common/check_all_patterns_found.pl" \ 78 + "$REGEX_LINES_HEADER" "$REGEX_LINES" < $LOGS_DIR/basic_nrsamples.log 100 79 CHECK_EXIT_CODE=$? 101 - ../common/check_errors_whitelisted.pl "stderr-whitelist.txt" < $LOGS_DIR/basic_nrsamples.err 80 + "$DIR_PATH/../common/check_errors_whitelisted.pl" \ 81 + "$DIR_PATH/stderr-whitelist.txt" < $LOGS_DIR/basic_nrsamples.err 102 82 (( CHECK_EXIT_CODE += $? )) 103 83 104 84 print_results $PERF_EXIT_CODE $CHECK_EXIT_CODE "number of samples" ··· 122 98 REGEX_LINE_CPUS_AVAIL="#\s+nrcpus avail\s*:\s*$MY_CPUS_AVAILABLE" 123 99 # disable precise check for "nrcpus avail" in BASIC runmode 124 100 test $PERFTOOL_TESTSUITE_RUNMODE -lt $RUNMODE_STANDARD && REGEX_LINE_CPUS_AVAIL="#\s+nrcpus avail\s*:\s*$RE_NUMBER" 125 - ../common/check_all_patterns_found.pl "$REGEX_LINE_TIMESTAMP" "$REGEX_LINE_HOSTNAME" "$REGEX_LINE_KERNEL" "$REGEX_LINE_PERF" "$REGEX_LINE_ARCH" "$REGEX_LINE_CPUS_ONLINE" "$REGEX_LINE_CPUS_AVAIL" < $LOGS_DIR/basic_header.log 101 + "$DIR_PATH/../common/check_all_patterns_found.pl" \ 102 + "$REGEX_LINE_TIMESTAMP" "$REGEX_LINE_HOSTNAME" "$REGEX_LINE_KERNEL" \ 103 + "$REGEX_LINE_PERF" "$REGEX_LINE_ARCH" "$REGEX_LINE_CPUS_ONLINE" \ 104 + "$REGEX_LINE_CPUS_AVAIL" < $LOGS_DIR/basic_header.log 126 105 CHECK_EXIT_CODE=$? 127 106 128 107 print_results $PERF_EXIT_CODE $CHECK_EXIT_CODE "header" ··· 156 129 157 130 REGEX_LINES_HEADER="#\s*Children\s+Self\s+sys\s+usr\s+Command\s+Shared Object\s+Symbol" 158 131 REGEX_LINES="\s*$RE_NUMBER%\s+$RE_NUMBER%\s+$RE_NUMBER%\s+$RE_NUMBER%\s+\S+\s+\[kernel\.(?:vmlinux)|(?:kallsyms)\]\s+\[[k\.]\]\s+\w+" 159 - ../common/check_all_patterns_found.pl "$REGEX_LINES_HEADER" "$REGEX_LINES" < $LOGS_DIR/basic_cpuut.log 132 + "$DIR_PATH/../common/check_all_patterns_found.pl" \ 133 + "$REGEX_LINES_HEADER" "$REGEX_LINES" < $LOGS_DIR/basic_cpuut.log 160 134 CHECK_EXIT_CODE=$? 161 - ../common/check_errors_whitelisted.pl "stderr-whitelist.txt" < $LOGS_DIR/basic_cpuut.err 135 + "$DIR_PATH/../common/check_errors_whitelisted.pl" \ 136 + "$DIR_PATH/stderr-whitelist.txt" < $LOGS_DIR/basic_cpuut.err 162 137 (( CHECK_EXIT_CODE += $? )) 163 138 164 139 print_results $PERF_EXIT_CODE $CHECK_EXIT_CODE "show CPU utilization" ··· 173 144 $CMD_PERF report --stdio -i $CURRENT_TEST_DIR/perf.data --pid=1 > $LOGS_DIR/basic_pid.log 2> $LOGS_DIR/basic_pid.err 174 145 PERF_EXIT_CODE=$? 175 146 176 - grep -P -v '^#' $LOGS_DIR/basic_pid.log | grep -P '\s+[\d\.]+%' | ../common/check_all_lines_matched.pl "systemd|init" 147 + grep -P -v '^#' $LOGS_DIR/basic_pid.log | grep -P '\s+[\d\.]+%' | \ 148 + "$DIR_PATH/../common/check_all_lines_matched.pl" "systemd|init" 177 149 CHECK_EXIT_CODE=$? 178 - ../common/check_errors_whitelisted.pl "stderr-whitelist.txt" < $LOGS_DIR/basic_pid.err 150 + "$DIR_PATH/../common/check_errors_whitelisted.pl" \ 151 + "$DIR_PATH/stderr-whitelist.txt" < $LOGS_DIR/basic_pid.err 179 152 (( CHECK_EXIT_CODE += $? )) 180 153 181 154 print_results $PERF_EXIT_CODE $CHECK_EXIT_CODE "pid" ··· 190 159 $CMD_PERF report --stdio -i $CURRENT_TEST_DIR/perf.data --symbols=dummynonexistingsymbol > $LOGS_DIR/basic_symbols.log 2> $LOGS_DIR/basic_symbols.err 191 160 PERF_EXIT_CODE=$? 192 161 193 - ../common/check_all_lines_matched.pl "$RE_LINE_EMPTY" "$RE_LINE_COMMENT" < $LOGS_DIR/basic_symbols.log 162 + "$DIR_PATH/../common/check_all_lines_matched.pl" \ 163 + "$RE_LINE_EMPTY" "$RE_LINE_COMMENT" < $LOGS_DIR/basic_symbols.log 194 164 CHECK_EXIT_CODE=$? 195 - ../common/check_errors_whitelisted.pl "stderr-whitelist.txt" < $LOGS_DIR/basic_symbols.err 165 + "$DIR_PATH/../common/check_errors_whitelisted.pl" \ 166 + "$DIR_PATH/stderr-whitelist.txt" < $LOGS_DIR/basic_symbols.err 196 167 (( CHECK_EXIT_CODE += $? )) 197 168 198 169 print_results $PERF_EXIT_CODE $CHECK_EXIT_CODE "non-existing symbol" ··· 207 174 $CMD_PERF report --stdio -i $CURRENT_TEST_DIR/perf.data --symbol-filter=map > $LOGS_DIR/basic_symbolfilter.log 2> $LOGS_DIR/basic_symbolfilter.err 208 175 PERF_EXIT_CODE=$? 209 176 210 - grep -P -v '^#' $LOGS_DIR/basic_symbolfilter.log | grep -P '\s+[\d\.]+%' | ../common/check_all_lines_matched.pl "\[[k\.]\]\s+.*map" 177 + grep -P -v '^#' $LOGS_DIR/basic_symbolfilter.log | grep -P '\s+[\d\.]+%' | \ 178 + "$DIR_PATH/../common/check_all_lines_matched.pl" "\[[k\.]\]\s+.*map" 211 179 CHECK_EXIT_CODE=$? 212 - ../common/check_errors_whitelisted.pl "stderr-whitelist.txt" < $LOGS_DIR/basic_symbolfilter.err 180 + "$DIR_PATH/../common/check_errors_whitelisted.pl" \ 181 + "$DIR_PATH/stderr-whitelist.txt" < $LOGS_DIR/basic_symbolfilter.err 213 182 (( CHECK_EXIT_CODE += $? )) 214 183 215 184 print_results $PERF_EXIT_CODE $CHECK_EXIT_CODE "symbol filter" ··· 224 189 $CMD_PERF report -i $CURRENT_TEST_DIR/perf.data.1 --stdio --header-only > $LOGS_DIR/latency_header.log 225 190 PERF_EXIT_CODE=$? 226 191 227 - ../common/check_all_patterns_found.pl ", context_switch = 1, " < $LOGS_DIR/latency_header.log 192 + "$DIR_PATH/../common/check_all_patterns_found.pl" \ 193 + ", context_switch = 1, " < $LOGS_DIR/latency_header.log 228 194 CHECK_EXIT_CODE=$? 229 195 230 196 print_results $PERF_EXIT_CODE $CHECK_EXIT_CODE "latency header" ··· 236 200 $CMD_PERF report --stdio -i $CURRENT_TEST_DIR/perf.data.1 > $LOGS_DIR/latency_default.log 2> $LOGS_DIR/latency_default.err 237 201 PERF_EXIT_CODE=$? 238 202 239 - ../common/check_all_patterns_found.pl "# Overhead Latency Command" < $LOGS_DIR/latency_default.log 203 + "$DIR_PATH/../common/check_all_patterns_found.pl" \ 204 + "# Overhead Latency Command" < $LOGS_DIR/latency_default.log 240 205 CHECK_EXIT_CODE=$? 241 - ../common/check_errors_whitelisted.pl "stderr-whitelist.txt" < $LOGS_DIR/latency_default.err 206 + "$DIR_PATH/../common/check_errors_whitelisted.pl" \ 207 + "stderr-whitelist.txt" < $LOGS_DIR/latency_default.err 242 208 (( CHECK_EXIT_CODE += $? )) 243 209 244 210 print_results $PERF_EXIT_CODE $CHECK_EXIT_CODE "default report for latency profile" ··· 251 213 $CMD_PERF report --latency --stdio -i $CURRENT_TEST_DIR/perf.data.1 > $LOGS_DIR/latency_latency.log 2> $LOGS_DIR/latency_latency.err 252 214 PERF_EXIT_CODE=$? 253 215 254 - ../common/check_all_patterns_found.pl "# Latency Overhead Command" < $LOGS_DIR/latency_latency.log 216 + "$DIR_PATH/../common/check_all_patterns_found.pl" \ 217 + "# Latency Overhead Command" < $LOGS_DIR/latency_latency.log 255 218 CHECK_EXIT_CODE=$? 256 - ../common/check_errors_whitelisted.pl "stderr-whitelist.txt" < $LOGS_DIR/latency_latency.err 219 + "$DIR_PATH/../common/check_errors_whitelisted.pl" \ 220 + "stderr-whitelist.txt" < $LOGS_DIR/latency_latency.err 257 221 (( CHECK_EXIT_CODE += $? )) 258 222 259 223 print_results $PERF_EXIT_CODE $CHECK_EXIT_CODE "latency report for latency profile" ··· 266 226 $CMD_PERF report --hierarchy --sort latency,parallelism,comm,symbol --parallelism=1,2 --stdio -i $CURRENT_TEST_DIR/perf.data.1 > $LOGS_DIR/parallelism_hierarchy.log 2> $LOGS_DIR/parallelism_hierarchy.err 267 227 PERF_EXIT_CODE=$? 268 228 269 - ../common/check_all_patterns_found.pl "# Latency Parallelism / Command / Symbol" < $LOGS_DIR/parallelism_hierarchy.log 229 + "$DIR_PATH/../common/check_all_patterns_found.pl" \ 230 + "# Latency Parallelism / Command / Symbol" \ 231 + < $LOGS_DIR/parallelism_hierarchy.log 270 232 CHECK_EXIT_CODE=$? 271 - ../common/check_errors_whitelisted.pl "stderr-whitelist.txt" < $LOGS_DIR/parallelism_hierarchy.err 233 + "$DIR_PATH/../common/check_errors_whitelisted.pl" \ 234 + "stderr-whitelist.txt" < $LOGS_DIR/parallelism_hierarchy.err 272 235 (( CHECK_EXIT_CODE += $? )) 273 236 274 237 print_results $PERF_EXIT_CODE $CHECK_EXIT_CODE "parallelism histogram"
+2 -2
tools/perf/tests/shell/common/init.sh
··· 11 11 # 12 12 13 13 14 - . ../common/settings.sh 15 - . ../common/patterns.sh 14 + . "$(dirname $0)/../common/settings.sh" 15 + . "$(dirname $0)/../common/patterns.sh" 16 16 17 17 THIS_TEST_NAME=`basename $0 .sh` 18 18