Linux 4.8-rc8
[linux/fpc-iii.git] / tools / testing / selftests / ftrace / test.d / trigger / trigger-snapshot.tc
blobf84b80d551a2804bc44c29f4392453dd4690bac8
1 #!/bin/sh
2 # description: event trigger - test snapshot-trigger
4 do_reset() {
5 reset_trigger
6 echo > set_event
7 clear_trace
10 fail() { #msg
11 do_reset
12 echo $1
13 exit $FAIL
16 if [ ! -f set_event -o ! -d events/sched ]; then
17 echo "event tracing is not supported"
18 exit_unsupported
21 if [ ! -f events/sched/sched_process_fork/trigger ]; then
22 echo "event trigger is not supported"
23 exit_unsupported
26 reset_tracer
27 do_reset
29 FEATURE=`grep snapshot events/sched/sched_process_fork/trigger`
30 if [ -z "$FEATURE" ]; then
31 echo "snapshot trigger is not supported"
32 exit_unsupported
35 echo "Test snapshot tigger"
36 echo 0 > snapshot
37 echo 1 > events/sched/sched_process_fork/enable
38 ( echo "forked")
39 echo 'snapshot:1' > events/sched/sched_process_fork/trigger
40 ( echo "forked")
41 grep sched_process_fork snapshot > /dev/null || \
42 fail "snapshot trigger on sched_process_fork did not work"
44 reset_trigger
45 echo 0 > snapshot
46 echo 0 > events/sched/sched_process_fork/enable
48 echo "Test snapshot semantic errors"
50 ! echo "snapshot+1" > events/sched/sched_process_fork/trigger
51 echo "snapshot" > events/sched/sched_process_fork/trigger
52 ! echo "snapshot" > events/sched/sched_process_fork/trigger
54 do_reset
56 exit 0