[PATCH v9 08/15] tests: check error handling of syscall filter
Nikolay Marchuk
marchuk.nikolay.a at gmail.com
Thu Aug 24 11:19:46 UTC 2017
* 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.
---
tests/filtering_syscall-syntax.test | 39 +++++++++++++++++++++++++++++++++++--
tests/qual_fault-syntax.test | 4 ----
tests/qual_inject-syntax.test | 4 ----
3 files changed, 37 insertions(+), 10 deletions(-)
diff --git a/tests/filtering_syscall-syntax.test b/tests/filtering_syscall-syntax.test
index 07a62140..560b7bf0 100755
--- a/tests/filtering_syscall-syntax.test
+++ b/tests/filtering_syscall-syntax.test
@@ -45,9 +45,28 @@ 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 : :: ::: ; do
+ check_syscall "" "$arg"
+ check_syscall "!" "!$arg"
done
for arg in -1 -2 -3 -4 -5 \
@@ -63,6 +82,16 @@ for arg in -1 -2 -3 -4 -5 \
; do
check_syscall "$arg" "$arg"
check_syscall "$arg" "!$arg"
+ check_syscall_new "$arg" "$arg"
+done
+
+for arg in desc \
+ file \
+ memory \
+ process \
+ network \
+ ; do
+ check_syscall_new "$arg" "$arg"
done
# invalid syscall, multiple syscalls
@@ -79,13 +108,14 @@ for arg in %desc \
?/non_syscall \
; do
check_syscall nonsense "$arg,nonsense"
- 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
for arg in \! \!open none all -1; do
check_syscall "$arg" "1,$arg"
+ check_syscall_new "$arg" "1,$arg"
done
check_e_using_grep 'regcomp: \+id: [[:alpha:]].+' -e trace='/+id'
@@ -93,3 +123,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)'
diff --git a/tests/qual_fault-syntax.test b/tests/qual_fault-syntax.test
index 1a545b6e..7198afff 100755
--- a/tests/qual_fault-syntax.test
+++ b/tests/qual_fault-syntax.test
@@ -40,10 +40,6 @@ fail_with()
"strace -e fault=$* failed to handle an argument error properly"
}
-for arg in : :: ::: ; do
- check_e "invalid system call ''" -e fault="$arg"
-done
-
for arg in chdir:42 \!chdir:42 \
chdir:42:when=7 \
chdir:invalid \
diff --git a/tests/qual_inject-syntax.test b/tests/qual_inject-syntax.test
index 3866bdcf..17c18fde 100755
--- a/tests/qual_inject-syntax.test
+++ b/tests/qual_inject-syntax.test
@@ -40,10 +40,6 @@ fail_with()
"strace -e inject=$* failed to handle an argument error properly"
}
-for arg in : :: ::: ; do
- check_e "invalid system call ''" -e inject="$arg"
-done
-
for arg in 42 chdir \
chdir:42 \!chdir:42 \
chdir:42:when=7 \
--
2.11.0
More information about the Strace-devel
mailing list