1#!/bin/sh 2# SPDX-License-Identifier: GPL-2.0 3# description: ftrace - function profiler with function tracing 4# requires: function_profile_enabled set_ftrace_filter function_graph:tracer 5 6# There was a bug after a rewrite of the ftrace infrastructure that 7# caused the function_profiler not to be able to run with the function 8# tracer, because the function_profiler used the function_graph tracer 9# and it was assumed the two could not run simultaneously. 10# 11# There was another related bug where the solution to the first bug 12# broke the way filtering of the function tracer worked. 13# 14# This test triggers those bugs on those kernels. 15# 16# We need function_graph and profiling to to run this test 17 18fail() { # mesg 19 echo $1 20 exit_fail 21} 22 23echo "Testing function tracer with profiler:" 24echo "enable function tracer" 25echo function > current_tracer 26echo "enable profiler" 27echo 1 > function_profile_enabled 28 29sleep 1 30 31echo "Now filter on just schedule" 32echo '*schedule' > set_ftrace_filter 33clear_trace 34 35echo "Now disable function profiler" 36echo 0 > function_profile_enabled 37 38sleep 1 39 40# make sure only schedule functions exist 41 42echo "testing if only schedule is being traced" 43if grep -v -e '^#' -e 'schedule' trace; then 44 fail "more than schedule was found" 45fi 46 47echo "Make sure schedule was traced" 48if ! grep -e 'schedule' trace > /dev/null; then 49 cat trace 50 fail "can not find schedule in trace" 51fi 52 53echo > set_ftrace_filter 54clear_trace 55 56sleep 1 57 58echo "make sure something other than scheduler is being traced" 59if ! grep -v -e '^#' -e 'schedule' trace > /dev/null; then 60 cat trace 61 fail "no other functions besides schedule was found" 62fi 63 64exit 0 65