1#!/bin/sh
2# SPDX-License-Identifier: GPL-2.0
3# description: event trigger - test stacktrace-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
20FEATURE=`grep stacktrace events/sched/sched_process_fork/trigger`
21if [ -z "$FEATURE" ]; then
22    echo "stacktrace trigger is not supported"
23    exit_unsupported
24fi
25
26echo "Test stacktrace tigger"
27echo 0 > trace
28echo 0 > options/stacktrace
29echo 'stacktrace' > events/sched/sched_process_fork/trigger
30( echo "forked")
31grep "<stack trace>" trace > /dev/null || \
32    fail "stacktrace trigger on sched_process_fork did not work"
33
34reset_trigger
35
36echo "Test stacktrace semantic errors"
37
38! echo "stacktrace:foo" > events/sched/sched_process_fork/trigger
39echo "stacktrace" > events/sched/sched_process_fork/trigger
40! echo "stacktrace" > events/sched/sched_process_fork/trigger
41
42exit 0
43