selftests/ftrace: Reset ftrace filter on older kernel
authorMasami Hiramatsu <mhiramat@kernel.org>
Tue, 23 May 2017 06:06:53 +0000 (15:06 +0900)
committerShuah Khan <shuahkh@osg.samsung.com>
Wed, 7 Jun 2017 16:59:51 +0000 (10:59 -0600)
Since older kernel didn't support separated instance of
set_ftrace_filter, if the test case set the filter in
an instance, it will propagate to top-level instance.
This means that the filter setting remains even if we
remove the instance, and will cause other tests failure.
To avoid this issue, reset the ftrace filter if we
detect the propagation.

Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
tools/testing/selftests/ftrace/test.d/instances/instance-event.tc

index c73db78..8a35331 100644 (file)
@@ -82,7 +82,10 @@ rmdir foo
 if [ -d foo ]; then
         fail "foo still exists"
 fi
-
+if grep -q "schedule:enable_event:sched:sched_switch" ../set_ftrace_filter; then
+       echo "Older kernel detected. Cleanup filter"
+       echo '!schedule:enable_event:sched:sched_switch' > ../set_ftrace_filter
+fi
 
 instance_slam() {
     while :; do