Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

selftests/ftrace: Update synthetic event syntax errors

Some of the synthetic event errors and positions have changed in the
code - update those and add several more tests.

Also add a runtime check to ensure that the kernel supports dynamic
strings in synthetic events, which these tests require.

Link: https://lkml.kernel.org/r/51402656433455baead34f068c6e9466b64df9c0.1612208610.git.zanussi@kernel.org

Fixes: 81ff92a93d95 (selftests/ftrace: Add test case for synthetic event syntax errors)
Reported-by: Masami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: Tom Zanussi <zanussi@kernel.org>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>

authored by

Tom Zanussi and committed by
Steven Rostedt (VMware)
b5734e99 8b5ab6bd

+27 -8
+27 -8
tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-synthetic_event_syntax_errors.tc
··· 1 1 #!/bin/sh 2 2 # SPDX-License-Identifier: GPL-2.0 3 3 # description: event trigger - test synthetic_events syntax parser errors 4 - # requires: synthetic_events error_log 4 + # requires: synthetic_events error_log "char name[]' >> synthetic_events":README 5 5 6 6 check_error() { # command-with-error-pos-by-^ 7 7 ftrace_errlog_check 'synthetic_events' "$1" 'synthetic_events' 8 8 } 9 9 10 + check_dyn_error() { # command-with-error-pos-by-^ 11 + ftrace_errlog_check 'synthetic_events' "$1" 'dynamic_events' 12 + } 13 + 10 14 check_error 'myevent ^chr arg' # INVALID_TYPE 11 - check_error 'myevent ^char str[];; int v' # INVALID_TYPE 12 - check_error 'myevent char ^str]; int v' # INVALID_NAME 13 - check_error 'myevent char ^str;[]' # INVALID_NAME 14 - check_error 'myevent ^char str[; int v' # INVALID_TYPE 15 - check_error '^mye;vent char str[]' # BAD_NAME 16 - check_error 'myevent char str[]; ^int' # INVALID_FIELD 17 - check_error '^myevent' # INCOMPLETE_CMD 15 + check_error 'myevent ^unsigned arg' # INCOMPLETE_TYPE 16 + 17 + check_error 'myevent char ^str]; int v' # BAD_NAME 18 + check_error '^mye-vent char str[]' # BAD_NAME 19 + check_error 'myevent char ^st-r[]' # BAD_NAME 20 + 21 + check_error 'myevent char str;^[]' # INVALID_FIELD 22 + check_error 'myevent char str; ^int' # INVALID_FIELD 23 + 24 + check_error 'myevent char ^str[; int v' # INVALID_ARRAY_SPEC 25 + check_error 'myevent char ^str[kdjdk]' # INVALID_ARRAY_SPEC 26 + check_error 'myevent char ^str[257]' # INVALID_ARRAY_SPEC 27 + 28 + check_error '^mye;vent char str[]' # INVALID_CMD 29 + check_error '^myevent ; char str[]' # INVALID_CMD 30 + check_error '^myevent; char str[]' # INVALID_CMD 31 + check_error '^myevent ;char str[]' # INVALID_CMD 32 + check_error '^; char str[]' # INVALID_CMD 33 + check_error '^;myevent char str[]' # INVALID_CMD 34 + check_error '^myevent' # INVALID_CMD 35 + 36 + check_dyn_error '^s:junk/myevent char str[' # INVALID_DYN_CMD 18 37 19 38 exit 0