Home | History | Annotate | Download | only in inter-event
      1 #!/bin/sh
      2 # SPDX-License-Identifier: GPL-2.0
      3 # description: event trigger - test synthetic_events syntax parser
      4 
      5 do_reset() {
      6     reset_trigger
      7     echo > set_event
      8     clear_trace
      9 }
     10 
     11 fail() { #msg
     12     do_reset
     13     echo $1
     14     exit_fail
     15 }
     16 
     17 if [ ! -f set_event ]; then
     18     echo "event tracing is not supported"
     19     exit_unsupported
     20 fi
     21 
     22 if [ ! -f synthetic_events ]; then
     23     echo "synthetic event is not supported"
     24     exit_unsupported
     25 fi
     26 
     27 reset_tracer
     28 do_reset
     29 
     30 echo "Test synthetic_events syntax parser"
     31 
     32 echo > synthetic_events
     33 
     34 # synthetic event must have a field
     35 ! echo "myevent" >> synthetic_events
     36 echo "myevent u64 var1" >> synthetic_events
     37 
     38 # synthetic event must be found in synthetic_events
     39 grep "myevent[[:space:]]u64 var1" synthetic_events
     40 
     41 # it is not possible to add same name event
     42 ! echo "myevent u64 var2" >> synthetic_events
     43 
     44 # Non-append open will cleanup all events and add new one
     45 echo "myevent u64 var2" > synthetic_events
     46 
     47 # multiple fields with different spaces
     48 echo "myevent u64 var1; u64 var2;" > synthetic_events
     49 grep "myevent[[:space:]]u64 var1; u64 var2" synthetic_events
     50 echo "myevent u64 var1 ; u64 var2 ;" > synthetic_events
     51 grep "myevent[[:space:]]u64 var1; u64 var2" synthetic_events
     52 echo "myevent u64 var1 ;u64 var2" > synthetic_events
     53 grep "myevent[[:space:]]u64 var1; u64 var2" synthetic_events
     54 
     55 # test field types
     56 echo "myevent u32 var" > synthetic_events
     57 echo "myevent u16 var" > synthetic_events
     58 echo "myevent u8 var" > synthetic_events
     59 echo "myevent s64 var" > synthetic_events
     60 echo "myevent s32 var" > synthetic_events
     61 echo "myevent s16 var" > synthetic_events
     62 echo "myevent s8 var" > synthetic_events
     63 
     64 echo "myevent char var" > synthetic_events
     65 echo "myevent int var" > synthetic_events
     66 echo "myevent long var" > synthetic_events
     67 echo "myevent pid_t var" > synthetic_events
     68 
     69 echo "myevent unsigned char var" > synthetic_events
     70 echo "myevent unsigned int var" > synthetic_events
     71 echo "myevent unsigned long var" > synthetic_events
     72 grep "myevent[[:space:]]unsigned long var" synthetic_events
     73 
     74 # test string type
     75 echo "myevent char var[10]" > synthetic_events
     76 grep "myevent[[:space:]]char\[10\] var" synthetic_events
     77 
     78 do_reset
     79 
     80 exit 0
     81