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