WIP FPC-III support
[linux/fpc-iii.git] / tools / testing / selftests / ftrace / test.d / trigger / inter-event / trigger-synthetic-event-syntax.tc
blob59216f3cfb129788577d06ce5b6788cd4abc6e4a
1 #!/bin/sh
2 # SPDX-License-Identifier: GPL-2.0
3 # description: event trigger - test synthetic_events syntax parser
4 # requires: set_event synthetic_events
6 do_reset() {
7 reset_trigger
8 echo > set_event
9 clear_trace
12 fail() { #msg
13 do_reset
14 echo $1
15 exit_fail
18 reset_tracer
19 do_reset
21 echo "Test synthetic_events syntax parser"
23 echo > synthetic_events
25 # synthetic event must have a field
26 ! echo "myevent" >> synthetic_events
27 echo "myevent u64 var1" >> synthetic_events
29 # synthetic event must be found in synthetic_events
30 grep "myevent[[:space:]]u64 var1" synthetic_events
32 # it is not possible to add same name event
33 ! echo "myevent u64 var2" >> synthetic_events
35 # Non-append open will cleanup all events and add new one
36 echo "myevent u64 var2" > synthetic_events
38 # multiple fields with different spaces
39 echo "myevent u64 var1; u64 var2;" > synthetic_events
40 grep "myevent[[:space:]]u64 var1; u64 var2" synthetic_events
41 echo "myevent u64 var1 ; u64 var2 ;" > synthetic_events
42 grep "myevent[[:space:]]u64 var1; u64 var2" synthetic_events
43 echo "myevent u64 var1 ;u64 var2" > synthetic_events
44 grep "myevent[[:space:]]u64 var1; u64 var2" synthetic_events
46 # test field types
47 echo "myevent u32 var" > synthetic_events
48 echo "myevent u16 var" > synthetic_events
49 echo "myevent u8 var" > synthetic_events
50 echo "myevent s64 var" > synthetic_events
51 echo "myevent s32 var" > synthetic_events
52 echo "myevent s16 var" > synthetic_events
53 echo "myevent s8 var" > synthetic_events
55 echo "myevent char var" > synthetic_events
56 echo "myevent int var" > synthetic_events
57 echo "myevent long var" > synthetic_events
58 echo "myevent pid_t var" > synthetic_events
60 echo "myevent unsigned char var" > synthetic_events
61 echo "myevent unsigned int var" > synthetic_events
62 echo "myevent unsigned long var" > synthetic_events
63 grep "myevent[[:space:]]unsigned long var" synthetic_events
65 # test string type
66 echo "myevent char var[10]" > synthetic_events
67 grep "myevent[[:space:]]char\[10\] var" synthetic_events
69 do_reset
71 exit 0