xref: /linux/tools/testing/selftests/ftrace/test.d/trigger/trigger-stacktrace.tc (revision c532de5a67a70f8533d495f8f2aaa9a0491c3ad0)
1#!/bin/sh
2# SPDX-License-Identifier: GPL-2.0
3# description: event trigger - test stacktrace-trigger
4# requires: set_event events/sched/sched_process_fork/trigger
5
6fail() { #msg
7    echo $1
8    exit_fail
9}
10
11FEATURE=`grep stacktrace events/sched/sched_process_fork/trigger`
12if [ -z "$FEATURE" ]; then
13    echo "stacktrace trigger is not supported"
14    exit_unsupported
15fi
16
17echo "Test stacktrace trigger"
18echo 0 > trace
19echo 0 > options/stacktrace
20echo 'stacktrace' > events/sched/sched_process_fork/trigger
21( echo "forked")
22grep "<stack trace>" trace > /dev/null || \
23    fail "stacktrace trigger on sched_process_fork did not work"
24
25reset_trigger
26
27echo "Test stacktrace semantic errors"
28
29! echo "stacktrace:foo" > events/sched/sched_process_fork/trigger
30echo "stacktrace" > events/sched/sched_process_fork/trigger
31! echo "stacktrace" > events/sched/sched_process_fork/trigger
32
33exit 0
34