1f06eec4dSRajvi Jingar#!/bin/sh
2403726d8STom Zanussi# SPDX-License-Identifier: GPL-2.0
3f06eec4dSRajvi Jingar# description: event trigger - test synthetic event create remove
4*3591e90fSMasami Hiramatsu# requires: set_event synthetic_events
5f06eec4dSRajvi Jingar
6f06eec4dSRajvi Jingarfail() { #msg
7f06eec4dSRajvi Jingar    echo $1
8f06eec4dSRajvi Jingar    exit_fail
9f06eec4dSRajvi Jingar}
10f06eec4dSRajvi Jingar
11f06eec4dSRajvi Jingarecho "Test create synthetic event"
12f06eec4dSRajvi Jingar
13f06eec4dSRajvi Jingarecho 'wakeup_latency  u64 lat pid_t pid char comm[16]' > synthetic_events
14f06eec4dSRajvi Jingarif [ ! -d events/synthetic/wakeup_latency ]; then
15f06eec4dSRajvi Jingar    fail "Failed to create wakeup_latency synthetic event"
16f06eec4dSRajvi Jingarfi
17f06eec4dSRajvi Jingar
18f06eec4dSRajvi Jingarreset_trigger
19f06eec4dSRajvi Jingar
200d0352d8SMasami Hiramatsuecho "Test remove synthetic event"
210d0352d8SMasami Hiramatsuecho '!wakeup_latency  u64 lat pid_t pid char comm[16]' >> synthetic_events
22f06eec4dSRajvi Jingarif [ -d events/synthetic/wakeup_latency ]; then
230d0352d8SMasami Hiramatsu    fail "Failed to delete wakeup_latency synthetic event"
24f06eec4dSRajvi Jingarfi
25f06eec4dSRajvi Jingar
26f06eec4dSRajvi Jingarreset_trigger
27f06eec4dSRajvi Jingar
280d0352d8SMasami Hiramatsuecho "Test create synthetic event with an error"
290d0352d8SMasami Hiramatsuecho 'wakeup_latency  u64 lat pid_t pid char' > synthetic_events > /dev/null
30f06eec4dSRajvi Jingarif [ -d events/synthetic/wakeup_latency ]; then
310d0352d8SMasami Hiramatsu    fail "Created wakeup_latency synthetic event with an invalid format"
32f06eec4dSRajvi Jingarfi
33f06eec4dSRajvi Jingar
34f06eec4dSRajvi Jingarexit 0
35