xref: /linux/tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-onchange-action-hist.tc (revision 7ae9fb1b7ecbb5d85d07857943f677fd1a559b18)
16f6eaa1eSTom Zanussi#!/bin/sh
26f6eaa1eSTom Zanussi# SPDX-License-Identifier: GPL-2.0
36f6eaa1eSTom Zanussi# description: event trigger - test inter-event histogram trigger onchange action
4*4aa4d4deSNaveen N. Rao# requires: set_event "onchange(var)":README ping:program
56f6eaa1eSTom Zanussi
66f6eaa1eSTom Zanussifail() { #msg
76f6eaa1eSTom Zanussi    echo $1
86f6eaa1eSTom Zanussi    exit_fail
96f6eaa1eSTom Zanussi}
106f6eaa1eSTom Zanussi
116f6eaa1eSTom Zanussiecho "Test onchange action"
126f6eaa1eSTom Zanussi
13ba1b9c50SMasami Hiramatsuecho 'hist:keys=comm:newprio=prio:onchange($newprio).save(comm,prio) if comm=="ping"' >> events/sched/sched_waking/trigger
146f6eaa1eSTom Zanussi
156f6eaa1eSTom Zanussiping $LOCALHOST -c 3
166f6eaa1eSTom Zanussinice -n 1 ping $LOCALHOST -c 3
176f6eaa1eSTom Zanussi
186f6eaa1eSTom Zanussiif ! grep -q "changed:" events/sched/sched_waking/hist; then
196f6eaa1eSTom Zanussi    fail "Failed to create onchange action inter-event histogram"
206f6eaa1eSTom Zanussifi
216f6eaa1eSTom Zanussi
226f6eaa1eSTom Zanussiexit 0
23