xref: /linux/tools/testing/selftests/ftrace/test.d/trigger/trigger-traceonoff.tc (revision 6c8c1406a6d6a3f2e61ac590f5c0994231bc6be7)
1#!/bin/sh
2# SPDX-License-Identifier: GPL-2.0
3# description: event trigger - test traceon/off trigger
4# requires: set_event events/sched/sched_process_fork/trigger
5
6fail() { #msg
7    echo $1
8    exit_fail
9}
10
11echo "Test traceoff trigger"
12echo 1 > tracing_on
13echo 'traceoff' > events/sched/sched_process_fork/trigger
14( echo "forked")
15if [ `cat tracing_on` -ne 0 ]; then
16    fail "traceoff trigger on sched_process_fork did not work"
17fi
18
19reset_trigger
20
21echo "Test traceon trigger"
22echo 0 > tracing_on
23echo 'traceon' > events/sched/sched_process_fork/trigger
24( echo "forked")
25if [ `cat tracing_on` -ne 1 ]; then
26    fail "traceoff trigger on sched_process_fork did not work"
27fi
28
29reset_trigger
30
31echo "Test semantic error for traceoff/on trigger"
32! echo 'traceoff:badparam' > events/sched/sched_process_fork/trigger
33! echo 'traceoff+0' > events/sched/sched_process_fork/trigger
34echo 'traceon' > events/sched/sched_process_fork/trigger
35! echo 'traceon' > events/sched/sched_process_fork/trigger
36! echo 'traceoff' > events/sched/sched_process_fork/trigger
37
38exit 0
39