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