| .. | .. |
|---|
| 3 | 3 | # description: ftrace - test for function event triggers |
|---|
| 4 | 4 | # flags: instance |
|---|
| 5 | 5 | # |
|---|
| 6 | +# The triggers are set within the set_ftrace_filter file |
|---|
| 7 | +# requires: set_ftrace_filter |
|---|
| 8 | +# |
|---|
| 6 | 9 | # Ftrace allows to add triggers to functions, such as enabling or disabling |
|---|
| 7 | 10 | # tracing, enabling or disabling trace events, or recording a stack trace |
|---|
| 8 | 11 | # within the ring buffer. |
|---|
| 9 | 12 | # |
|---|
| 10 | 13 | # This test is designed to test event triggers |
|---|
| 11 | | -# |
|---|
| 12 | | - |
|---|
| 13 | | -# The triggers are set within the set_ftrace_filter file |
|---|
| 14 | | -if [ ! -f set_ftrace_filter ]; then |
|---|
| 15 | | - echo "set_ftrace_filter not found? Is dynamic ftrace not set?" |
|---|
| 16 | | - exit_unsupported |
|---|
| 17 | | -fi |
|---|
| 18 | 14 | |
|---|
| 19 | 15 | do_reset() { |
|---|
| 20 | 16 | reset_ftrace_filter |
|---|
| .. | .. |
|---|
| 25 | 21 | } |
|---|
| 26 | 22 | |
|---|
| 27 | 23 | fail() { # mesg |
|---|
| 28 | | - do_reset |
|---|
| 29 | 24 | echo $1 |
|---|
| 30 | 25 | exit_fail |
|---|
| 31 | 26 | } |
|---|
| 32 | 27 | |
|---|
| 33 | 28 | SLEEP_TIME=".1" |
|---|
| 34 | | - |
|---|
| 35 | | -do_reset |
|---|
| 36 | 29 | |
|---|
| 37 | 30 | echo "Testing function probes with events:" |
|---|
| 38 | 31 | |
|---|
| .. | .. |
|---|
| 45 | 38 | |
|---|
| 46 | 39 | test_event_enabled() { |
|---|
| 47 | 40 | val=$1 |
|---|
| 41 | + check_times=10 # wait for 10 * SLEEP_TIME at most |
|---|
| 48 | 42 | |
|---|
| 49 | | - e=`cat $EVENT_ENABLE` |
|---|
| 50 | | - if [ "$e" != $val ]; then |
|---|
| 51 | | - fail "Expected $val but found $e" |
|---|
| 52 | | - fi |
|---|
| 43 | + while [ $check_times -ne 0 ]; do |
|---|
| 44 | + e=`cat $EVENT_ENABLE` |
|---|
| 45 | + if [ "$e" = $val ]; then |
|---|
| 46 | + return 0 |
|---|
| 47 | + fi |
|---|
| 48 | + sleep $SLEEP_TIME |
|---|
| 49 | + check_times=$((check_times - 1)) |
|---|
| 50 | + done |
|---|
| 51 | + |
|---|
| 52 | + fail "Expected $val but found $e" |
|---|
| 53 | 53 | } |
|---|
| 54 | 54 | |
|---|
| 55 | 55 | run_enable_disable() { |
|---|