1#!/bin/sh
2# SPDX-License-Identifier: GPL-2.0
3# description: trace_marker trigger - test histogram trigger
4# flags: instance
5
6fail() { #msg
7    echo $1
8    exit_fail
9}
10
11if [ ! -f set_event ]; then
12    echo "event tracing is not supported"
13    exit_unsupported
14fi
15
16if [ ! -d events/ftrace/print ]; then
17    echo "event trace_marker is not supported"
18    exit_unsupported
19fi
20
21if [ ! -f events/ftrace/print/trigger ]; then
22    echo "event trigger is not supported"
23    exit_unsupported
24fi
25
26if [ ! -f events/ftrace/print/hist ]; then
27    echo "hist trigger is not supported"
28    exit_unsupported
29fi
30
31echo "Test histogram trace_marker tigger"
32
33echo 'hist:keys=common_pid' > events/ftrace/print/trigger
34for i in `seq 1 10` ; do echo "hello" > trace_marker; done
35grep 'hitcount: *10$' events/ftrace/print/hist > /dev/null || \
36    fail "hist trigger did not trigger correct times on trace_marker"
37
38exit 0
39