aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorSteven Rostedt (VMware) <rostedt@goodmis.org>2017-04-20 12:53:18 -0400
committerSteven Rostedt (VMware) <rostedt@goodmis.org>2017-04-26 08:54:01 -0400
commitb5b77be812de78265e794523bf4e969fadf581be (patch)
tree961d9ba5a25072abe1cbeda0fb6727a7526cc543 /tools
parentdcc19d28091a86d5baf78e3fbb32e3fc3de524be (diff)
selftests: ftrace: Allow some tests to be run in a tracing instance
An tracing instance has several of the same capabilities as the top level instance, but may be implemented slightly different. Instead of just writing tests that duplicat the same test cases of the top level instance, allow a test to be written for both the top level as well as for an instance. If a test case can be run in both the top level as well as in an tracing instance directory, then it should add a tag "# flags: instance" in the header of the test file. Then after all tests have run, any test that has an instance flag set, will run again within a tracing instance. Link: http://lkml.kernel.org/r/20170421233850.1d0e9e05@gandalf.local.home Cc: Shuah Khan <shuah@kernel.org> Acked-by: Namhyung Kim <namhyung@kernel.org> Acked-by: Masami Hiramatsu <mhiramat@kernel.org> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Diffstat (limited to 'tools')
-rwxr-xr-xtools/testing/selftests/ftrace/ftracetest18
1 files changed, 17 insertions, 1 deletions
diff --git a/tools/testing/selftests/ftrace/ftracetest b/tools/testing/selftests/ftrace/ftracetest
index a8631d978725..32e6211e1c6e 100755
--- a/tools/testing/selftests/ftrace/ftracetest
+++ b/tools/testing/selftests/ftrace/ftracetest
@@ -150,11 +150,16 @@ XFAILED_CASES=
150UNDEFINED_CASES= 150UNDEFINED_CASES=
151TOTAL_RESULT=0 151TOTAL_RESULT=0
152 152
153INSTANCE=
153CASENO=0 154CASENO=0
154testcase() { # testfile 155testcase() { # testfile
155 CASENO=$((CASENO+1)) 156 CASENO=$((CASENO+1))
156 desc=`grep "^#[ \t]*description:" $1 | cut -f2 -d:` 157 desc=`grep "^#[ \t]*description:" $1 | cut -f2 -d:`
157 prlog -n "[$CASENO]$desc" 158 prlog -n "[$CASENO]$INSTANCE$desc"
159}
160
161test_on_instance() { # testfile
162 grep -q "^#[ \t]*flags:.*instance" $1
158} 163}
159 164
160eval_result() { # sigval 165eval_result() { # sigval
@@ -271,6 +276,17 @@ for t in $TEST_CASES; do
271 run_test $t 276 run_test $t
272done 277done
273 278
279# Test on instance loop
280INSTANCE=" (instance) "
281for t in $TEST_CASES; do
282 test_on_instance $t || continue
283 SAVED_TRACING_DIR=$TRACING_DIR
284 export TRACING_DIR=`mktemp -d $TRACING_DIR/instances/ftracetest.XXXXXX`
285 run_test $t
286 rmdir $TRACING_DIR
287 TRACING_DIR=$SAVED_TRACING_DIR
288done
289
274prlog "" 290prlog ""
275prlog "# of passed: " `echo $PASSED_CASES | wc -w` 291prlog "# of passed: " `echo $PASSED_CASES | wc -w`
276prlog "# of failed: " `echo $FAILED_CASES | wc -w` 292prlog "# of failed: " `echo $FAILED_CASES | wc -w`