1#!/bin/sh
2# SPDX-License-Identifier: GPL-2.0
3# description: event trigger - test traceon/off trigger
4
5fail() { #msg
6    echo $1
7    exit_fail
8}
9
10if [ ! -f set_event -o ! -d events/sched ]; then
11    echo "event tracing is not supported"
12    exit_unsupported
13fi
14
15if [ ! -f events/sched/sched_process_fork/trigger ]; then
16    echo "event trigger is not supported"
17    exit_unsupported
18fi
19
20echo "Test traceoff trigger"
21echo 1 > tracing_on
22echo 'traceoff' > events/sched/sched_process_fork/trigger
23( echo "forked")
24if [ `cat tracing_on` -ne 0 ]; then
25    fail "traceoff trigger on sched_process_fork did not work"
26fi
27
28reset_trigger
29
30echo "Test traceon trigger"
31echo 0 > tracing_on
32echo 'traceon' > events/sched/sched_process_fork/trigger
33( echo "forked")
34if [ `cat tracing_on` -ne 1 ]; then
35    fail "traceoff trigger on sched_process_fork did not work"
36fi
37
38reset_trigger
39
40echo "Test semantic error for traceoff/on trigger"
41! echo 'traceoff:badparam' > events/sched/sched_process_fork/trigger
42! echo 'traceoff+0' > events/sched/sched_process_fork/trigger
43echo 'traceon' > events/sched/sched_process_fork/trigger
44! echo 'traceon' > events/sched/sched_process_fork/trigger
45! echo 'traceoff' > events/sched/sched_process_fork/trigger
46
47exit 0
48