1#!/bin/sh
2# SPDX-License-Identifier: GPL-2.0
3# description: event trigger - test synthetic event create remove
4# requires: set_event synthetic_events
5
6fail() { #msg
7    echo $1
8    exit_fail
9}
10
11echo "Test create synthetic event"
12
13echo 'wakeup_latency  u64 lat pid_t pid char comm[16]' > synthetic_events
14if [ ! -d events/synthetic/wakeup_latency ]; then
15    fail "Failed to create wakeup_latency synthetic event"
16fi
17
18reset_trigger
19
20echo "Test remove synthetic event"
21echo '!wakeup_latency  u64 lat pid_t pid char comm[16]' >> synthetic_events
22if [ -d events/synthetic/wakeup_latency ]; then
23    fail "Failed to delete wakeup_latency synthetic event"
24fi
25
26reset_trigger
27
28echo "Test create synthetic event with an error"
29echo 'wakeup_latency  u64 lat pid_t pid char' > synthetic_events > /dev/null
30if [ -d events/synthetic/wakeup_latency ]; then
31    fail "Created wakeup_latency synthetic event with an invalid format"
32fi
33
34exit 0
35