#!/bin/sh
# description: event trigger - test snapshot-trigger

do_reset() {
    reset_trigger
    echo > set_event
    clear_trace
}

fail() { #msg
    do_reset
    echo $1
    exit $FAIL
}

if [ ! -f set_event -o ! -d events/sched ]; then
    echo "event tracing is not supported"
    exit_unsupported
fi

if [ ! -f events/sched/sched_process_fork/trigger ]; then
    echo "event trigger is not supported"
    exit_unsupported
fi

if [ ! -f snapshot ]; then
    echo "snapshot is not supported"
    exit_unsupported
fi

reset_tracer
do_reset

FEATURE=`grep snapshot events/sched/sched_process_fork/trigger`
if [ -z "$FEATURE" ]; then
    echo "snapshot trigger is not supported"
    exit_unsupported
fi

echo "Test snapshot tigger"
echo 0 > snapshot
echo 1 > events/sched/sched_process_fork/enable
( echo "forked")
echo 'snapshot:1' > events/sched/sched_process_fork/trigger
( echo "forked")
grep sched_process_fork snapshot > /dev/null || \
    fail "snapshot trigger on sched_process_fork did not work"

reset_trigger
echo 0 > snapshot
echo 0 > events/sched/sched_process_fork/enable

echo "Test snapshot semantic errors"

! echo "snapshot+1" > events/sched/sched_process_fork/trigger
echo "snapshot" > events/sched/sched_process_fork/trigger
! echo "snapshot" > events/sched/sched_process_fork/trigger

do_reset

exit 0
<td class='sub right'>Tobias Klauser</td></tr></table>
<table class='tabs'><tr><td>
<a href='/cgit.cgi/linux/net-next.git/'>summary</a><a href='/cgit.cgi/linux/net-next.git/refs/?id=bbf892849678ff9e25590cbf78d0202e35d7e41d'>refs</a><a class='active' href='/cgit.cgi/linux/net-next.git/log/fs/aio.c'>log</a><a href='/cgit.cgi/linux/net-next.git/tree/fs/aio.c?id=bbf892849678ff9e25590cbf78d0202e35d7e41d'>tree</a><a href='/cgit.cgi/linux/net-next.git/commit/fs/aio.c?id=bbf892849678ff9e25590cbf78d0202e35d7e41d'>commit</a><a href='/cgit.cgi/linux/net-next.git/diff/fs/aio.c?id=bbf892849678ff9e25590cbf78d0202e35d7e41d'>diff</a></td><td class='form'><form class='right' method='get' action='/cgit.cgi/linux/net-next.git/log/fs/aio.c'>
<input type='hidden' name='id' value='bbf892849678ff9e25590cbf78d0202e35d7e41d'/><select name='qt'>
<option value='grep'>log msg</option>
<option value='author'>author</option>
<option value='committer'>committer</option>
<option value='range'>range</option>
</select>
<input class='txt' type='search' size='10' name='q' value=''/>
<input type='submit' value='search'/>
</form>
</td></tr></table>
<div class='path'>path: <a href='/cgit.cgi/linux/net-next.git/log/?id=bbf892849678ff9e25590cbf78d0202e35d7e41d'>root</a>/<a href='/cgit.cgi/linux/net-next.git/log/fs?id=bbf892849678ff9e25590cbf78d0202e35d7e41d'>fs</a>/<a href='/cgit.cgi/linux/net-next.git/log/fs/aio.c?id=bbf892849678ff9e25590cbf78d0202e35d7e41d'>aio.c</a></div><div class='content'><table class='list nowrap'><tr class='nohover'><th class='left'>Age</th><th class='left'>Commit message (<a href='/cgit.cgi/linux/net-next.git/log/fs/aio.c?id=bbf892849678ff9e25590cbf78d0202e35d7e41d&amp;showmsg=1'>Expand</a>)</th><th class='left'>Author</th><th class='left'>Files</th><th class='left'>Lines</th></tr>