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