Commit b5734e99 authored by Tom Zanussi's avatar Tom Zanussi Committed by Steven Rostedt (VMware)

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: 81ff92a9 (selftests/ftrace: Add test case for synthetic event syntax errors)
Reported-by: default avatarMasami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: default avatarTom Zanussi <zanussi@kernel.org>
Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
parent 8b5ab6bd
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
# description: event trigger - test synthetic_events syntax parser errors
# requires: synthetic_events error_log
# requires: synthetic_events error_log "char name[]' >> synthetic_events":README
check_error() { # command-with-error-pos-by-^
ftrace_errlog_check 'synthetic_events' "$1" 'synthetic_events'
}
check_dyn_error() { # command-with-error-pos-by-^
ftrace_errlog_check 'synthetic_events' "$1" 'dynamic_events'
}
check_error 'myevent ^chr arg' # INVALID_TYPE
check_error 'myevent ^char str[];; int v' # INVALID_TYPE
check_error 'myevent char ^str]; int v' # INVALID_NAME
check_error 'myevent char ^str;[]' # INVALID_NAME
check_error 'myevent ^char str[; int v' # INVALID_TYPE
check_error '^mye;vent char str[]' # BAD_NAME
check_error 'myevent char str[]; ^int' # INVALID_FIELD
check_error '^myevent' # INCOMPLETE_CMD
check_error 'myevent ^unsigned arg' # INCOMPLETE_TYPE
check_error 'myevent char ^str]; int v' # BAD_NAME
check_error '^mye-vent char str[]' # BAD_NAME
check_error 'myevent char ^st-r[]' # BAD_NAME
check_error 'myevent char str;^[]' # INVALID_FIELD
check_error 'myevent char str; ^int' # INVALID_FIELD
check_error 'myevent char ^str[; int v' # INVALID_ARRAY_SPEC
check_error 'myevent char ^str[kdjdk]' # INVALID_ARRAY_SPEC
check_error 'myevent char ^str[257]' # INVALID_ARRAY_SPEC
check_error '^mye;vent char str[]' # INVALID_CMD
check_error '^myevent ; char str[]' # INVALID_CMD
check_error '^myevent; char str[]' # INVALID_CMD
check_error '^myevent ;char str[]' # INVALID_CMD
check_error '^; char str[]' # INVALID_CMD
check_error '^;myevent char str[]' # INVALID_CMD
check_error '^myevent' # INVALID_CMD
check_dyn_error '^s:junk/myevent char str[' # INVALID_DYN_CMD
exit 0
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment