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