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

Configure Feed

Select the types of activity you want to include in your feed.

selftests/ftrace: Add "requires:" list support

Introduce "requires:" list to check required ftrace interface
for each test. This will simplify the interface checking code
and unify the error message. Another good point is, it can
skip the ftrace initializing.

Note that this requires list must be written as a shell
comment.

Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
Reviewed-by: Tom Zanussi <zanussi@kernel.org>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>

authored by

Masami Hiramatsu and committed by
Shuah Khan
fa33e623 1e11b7db

+17 -1
+7 -1
tools/testing/selftests/ftrace/ftracetest
··· 267 267 prlog -n "[$CASENO]$INSTANCE$desc" 268 268 } 269 269 270 + checkreq() { # testfile 271 + requires=`grep "^#[ \t]*requires:" $1 | cut -f2- -d:` 272 + check_requires $requires 273 + } 274 + 270 275 test_on_instance() { # testfile 271 276 grep -q "^#[ \t]*flags:.*instance" $1 272 277 } ··· 361 356 362 357 __run_test() { # testfile 363 358 # setup PID and PPID, $$ is not updated. 364 - (cd $TRACING_DIR; read PID _ < /proc/self/stat; set -e; set -x; initialize_ftrace; . $1) 359 + (cd $TRACING_DIR; read PID _ < /proc/self/stat; set -e; set -x; 360 + checkreq $1; initialize_ftrace; . $1) 365 361 [ $? -ne 0 ] && kill -s $SIG_FAIL $SIG_PID 366 362 } 367 363
+9
tools/testing/selftests/ftrace/test.d/functions
··· 113 113 enable_tracing 114 114 } 115 115 116 + check_requires() { # Check required files 117 + for i in $* ; do 118 + if [ ! -e $i ]; then 119 + echo "Required feature interface $i doesn't exist." 120 + exit_unsupported 121 + fi 122 + done 123 + } 124 + 116 125 LOCALHOST=127.0.0.1 117 126 118 127 yield() {
+1
tools/testing/selftests/ftrace/test.d/template
··· 1 1 #!/bin/sh 2 2 # SPDX-License-Identifier: GPL-2.0 3 3 # description: %HERE DESCRIBE WHAT THIS DOES% 4 + # requires: %HERE LIST THE REQUIRED FILES% 4 5 # you have to add ".tc" extention for your testcase file 5 6 # Note that all tests are run with "errexit" option. 6 7