diff options
author | Nikolay Marchuk <marchuk.nikolay.a@gmail.com> | 2017-08-23 20:47:48 +0700 |
---|---|---|
committer | Dmitry V. Levin <ldv@altlinux.org> | 2018-06-13 15:05:09 +0000 |
commit | 39ece647b07699cbc1c59791fa5dcfb3e139422b (patch) | |
tree | 75100de63ab37cab890040e2fe2592fe220bdfd3 | |
parent | 60f0cd1d92719914c3ad6cd8bf43ae0198c291f1 (diff) | |
download | strace-39ece647b07699cbc1c59791fa5dcfb3e139422b.tar.gz |
tests: check error handling of syscall filter
* tests/filtering_syscall-syntax.test: Add checks of syscall filter.
* tests/qual_fault-syntax.test: Move checks with ':' to filtering_syscall-syntax.test
* tests/qual_inject-syntax.test: Likewise.
-rwxr-xr-x | tests/filtering_syscall-syntax.test | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/filtering_syscall-syntax.test b/tests/filtering_syscall-syntax.test index 8fda8dc2a..18614bb06 100755 --- a/tests/filtering_syscall-syntax.test +++ b/tests/filtering_syscall-syntax.test @@ -70,9 +70,23 @@ check_syscall() check_e "invalid system call '$1'" -e fault="$2:when=4" } +# Check different variations of new syntax. +check_syscall_new() +{ + if [ -n "$2" ]; then + check_e "invalid system call '$1'" -e "syscall $2" + check_e "invalid system call '$1'" -e "(syscall $2)" + check_e "invalid system call '$1'" -e "((syscall $2))" + check_e "invalid system call '$1'" -e "((syscall none) or syscall $2)" + check_e "invalid system call '$1'" -e "((syscall all) and syscall $2)" + check_e "invalid system call '$1'" -e "trace(syscall $2)" + fi +} + for arg in '' , ,, ,,, ; do check_syscall "$arg" "$arg" check_syscall "!$arg" "!$arg" + check_syscall_new "$arg" "$arg" done for arg in -1 -2 -3 -4 -5 \ @@ -89,10 +103,21 @@ for arg in -1 -2 -3 -4 -5 \ check_syscall "$arg" "$arg" check_syscall "$arg" "!$arg" check_syscall "$arg" "1,$arg" + check_syscall_new "$arg" "$arg" done for arg in '!chdir' none all; do check_syscall "$arg" "1,$arg" + check_syscall_new "$arg" "1,$arg" +done + +for arg in desc \ + file \ + memory \ + process \ + network \ + ; do + check_syscall_new "$arg" "$arg" done # invalid syscall, multiple syscalls @@ -112,6 +137,8 @@ for arg in %desc \ check_syscall nonsense "!$arg,nonsense" check_syscall nonsense "nonsense,$arg" check_syscall nonsense "!nonsense,$arg" + check_syscall_new nonsense "$arg,nonsense" + check_syscall_new nonsense "nonsense,$arg" done check_e_using_grep 'regcomp: \+id: [[:alpha:]].+' -e trace='/+id' @@ -119,3 +146,8 @@ check_e_using_grep 'regcomp: \*id: [[:alpha:]].+' -e trace='/*id' check_e_using_grep 'regcomp: \{id: [[:alpha:]].+' -e trace='/{id' check_e_using_grep 'regcomp: \(id: [[:alpha:]].+' -e trace='/(id' check_e_using_grep 'regcomp: \[id: [[:alpha:]].+' -e trace='/[id' +check_e_using_grep 'regcomp: \+id: [[:alpha:]].+' -e 'trace(syscall /+id)' +check_e_using_grep 'regcomp: \*id: [[:alpha:]].+' -e 'trace(syscall /*id)' +check_e_using_grep 'regcomp: \{id: [[:alpha:]].+' -e 'trace(syscall /{id)' +check_e_using_grep 'regcomp: \(id: [[:alpha:]].+' -e 'trace(syscall /\(id)' +check_e_using_grep 'regcomp: \[id: [[:alpha:]].+' -e 'trace(syscall /[id)' |