Skip to content

Commit 81ff92a

Browse files
Tom Zanussirostedt
authored andcommitted
selftests/ftrace: Add test case for synthetic event syntax errors
Add a selftest that verifies that the syntax error messages and caret positions are correct for most of the possible synthetic event syntax error cases. Link: https://lkml.kernel.org/r/af611928ce79f86eaf0af8654f1d7802d5cc21ff.1602598160.git.zanussi@kernel.org Tested-by: Masami Hiramatsu <mhiramat@kernel.org> Signed-off-by: Tom Zanussi <zanussi@kernel.org> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
1 parent 10819e2 commit 81ff92a

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/sh
2+
# SPDX-License-Identifier: GPL-2.0
3+
# description: event trigger - test synthetic_events syntax parser errors
4+
# requires: synthetic_events error_log
5+
6+
check_error() { # command-with-error-pos-by-^
7+
ftrace_errlog_check 'synthetic_events' "$1" 'synthetic_events'
8+
}
9+
10+
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
18+
19+
exit 0

0 commit comments

Comments
 (0)