diff options
Diffstat (limited to 'test/filters/filters.sh')
-rwxr-xr-x | test/filters/filters.sh | 77 |
1 files changed, 38 insertions, 39 deletions
diff --git a/test/filters/filters.sh b/test/filters/filters.sh index 04d7080d6..3b4a6b492 100755 --- a/test/filters/filters.sh +++ b/test/filters/filters.sh | |||
@@ -7,37 +7,37 @@ export MALLOC_CHECK_=3 | |||
7 | export MALLOC_PERTURB_=$(($RANDOM % 255 + 1)) | 7 | export MALLOC_PERTURB_=$(($RANDOM % 255 + 1)) |
8 | export LC_ALL=C | 8 | export LC_ALL=C |
9 | 9 | ||
10 | if [ -f /etc/debian_version ]; then | 10 | if [[ -f /etc/debian_version ]]; then |
11 | libdir=$(dirname "$(dpkg -L firejail | grep fseccomp)") | 11 | libdir=$(dirname "$(dpkg -L firejail | grep fseccomp)") |
12 | export PATH="$PATH:$libdir" | 12 | export PATH="$PATH:$libdir" |
13 | fi | 13 | fi |
14 | export PATH="$PATH:/usr/lib/firejail:/usr/lib64/firejail" | 14 | export PATH="$PATH:/usr/lib/firejail:/usr/lib64/firejail" |
15 | 15 | ||
16 | if [ -f /sys/kernel/security/apparmor/profiles ]; then | 16 | if [[ -f /sys/kernel/security/apparmor/profiles ]]; then |
17 | echo "TESTING: apparmor (test/filters/apparmor.exp)" | 17 | echo "TESTING: apparmor (test/filters/apparmor.exp)" |
18 | ./apparmor.exp | 18 | ./apparmor.exp |
19 | else | 19 | else |
20 | echo "TESTING SKIP: no apparmor support in Linux kernel (test/filters/apparmor.exp)" | 20 | echo "TESTING SKIP: no apparmor support in Linux kernel (test/filters/apparmor.exp)" |
21 | fi | 21 | fi |
22 | 22 | ||
23 | if [ "$(uname -m)" = "x86_64" ]; then | 23 | if [[ $(uname -m) == "x86_64" ]]; then |
24 | echo "TESTING: memory-deny-write-execute (test/filters/memwrexe.exp)" | 24 | echo "TESTING: memory-deny-write-execute (test/filters/memwrexe.exp)" |
25 | ./memwrexe.exp | 25 | ./memwrexe.exp |
26 | elif [ "$(uname -m)" = "i686" ]; then | 26 | elif [[ $(uname -m) == "i686" ]]; then |
27 | echo "TESTING: memory-deny-write-execute (test/filters/memwrexe-32.exp)" | 27 | echo "TESTING: memory-deny-write-execute (test/filters/memwrexe-32.exp)" |
28 | ./memwrexe-32.exp | 28 | ./memwrexe-32.exp |
29 | else | 29 | else |
30 | echo "TESTING SKIP: memwrexe binary only running on x86_64 and i686." | 30 | echo "TESTING SKIP: memwrexe binary only running on x86_64 and i686." |
31 | fi | 31 | fi |
32 | 32 | ||
33 | echo "TESTING: debug options (test/filters/debug.exp)" | 33 | echo "TESTING: debug options (test/filters/debug.exp)" |
34 | ./debug.exp | 34 | ./debug.exp |
35 | 35 | ||
36 | if [ "$(uname -m)" = "x86_64" ]; then | 36 | if [[ $(uname -m) == "x86_64" ]]; then |
37 | echo "TESTING: seccomp run files (test/filters/seccomp-run-files.exp)" | 37 | echo "TESTING: seccomp run files (test/filters/seccomp-run-files.exp)" |
38 | ./seccomp-run-files.exp | 38 | ./seccomp-run-files.exp |
39 | else | 39 | else |
40 | echo "TESTING SKIP: seccomp-run-files test implemented only for x86_64." | 40 | echo "TESTING SKIP: seccomp-run-files test implemented only for x86_64." |
41 | fi | 41 | fi |
42 | 42 | ||
43 | echo "TESTING: seccomp postexec (test/filters/seccomp-postexec.exp)" | 43 | echo "TESTING: seccomp postexec (test/filters/seccomp-postexec.exp)" |
@@ -61,33 +61,33 @@ echo "TESTING: capabilities join (test/filters/caps-join.exp)" | |||
61 | ./caps-join.exp | 61 | ./caps-join.exp |
62 | 62 | ||
63 | rm -f seccomp-test-file | 63 | rm -f seccomp-test-file |
64 | if [ "$(uname -m)" = "x86_64" ]; then | 64 | if [[ $(uname -m) == "x86_64" ]]; then |
65 | echo "TESTING: fseccomp (test/filters/fseccomp.exp)" | 65 | echo "TESTING: fseccomp (test/filters/fseccomp.exp)" |
66 | ./fseccomp.exp | 66 | ./fseccomp.exp |
67 | else | 67 | else |
68 | echo "TESTING SKIP: fseccomp test implemented only for x86_64" | 68 | echo "TESTING SKIP: fseccomp test implemented only for x86_64" |
69 | fi | 69 | fi |
70 | rm -f seccomp-test-file | 70 | rm -f seccomp-test-file |
71 | 71 | ||
72 | 72 | ||
73 | if [ "$(uname -m)" = "x86_64" ]; then | 73 | if [[ $(uname -m) == "x86_64" ]]; then |
74 | echo "TESTING: protocol (test/filters/protocol.exp)" | 74 | echo "TESTING: protocol (test/filters/protocol.exp)" |
75 | ./protocol.exp | 75 | ./protocol.exp |
76 | else | 76 | else |
77 | echo "TESTING SKIP: protocol, running only on x86_64" | 77 | echo "TESTING SKIP: protocol, running only on x86_64" |
78 | fi | 78 | fi |
79 | 79 | ||
80 | echo "TESTING: seccomp bad empty (test/filters/seccomp-bad-empty.exp)" | 80 | echo "TESTING: seccomp bad empty (test/filters/seccomp-bad-empty.exp)" |
81 | ./seccomp-bad-empty.exp | 81 | ./seccomp-bad-empty.exp |
82 | 82 | ||
83 | if [ "$(uname -m)" = "x86_64" ]; then | 83 | if [[ $(uname -m) == "x86_64" ]]; then |
84 | echo "TESTING: seccomp debug (test/filters/seccomp-debug.exp)" | 84 | echo "TESTING: seccomp debug (test/filters/seccomp-debug.exp)" |
85 | ./seccomp-debug.exp | 85 | ./seccomp-debug.exp |
86 | elif [ "$(uname -m)" = "i686" ]; then | 86 | elif [[ $(uname -m) == "i686" ]]; then |
87 | echo "TESTING: seccomp debug (test/filters/seccomp-debug-32.exp)" | 87 | echo "TESTING: seccomp debug (test/filters/seccomp-debug-32.exp)" |
88 | ./seccomp-debug-32.exp | 88 | ./seccomp-debug-32.exp |
89 | else | 89 | else |
90 | echo "TESTING SKIP: protocol, running only on x86_64 and i686" | 90 | echo "TESTING SKIP: protocol, running only on x86_64 and i686" |
91 | fi | 91 | fi |
92 | 92 | ||
93 | echo "TESTING: seccomp errno (test/filters/seccomp-errno.exp)" | 93 | echo "TESTING: seccomp errno (test/filters/seccomp-errno.exp)" |
@@ -96,12 +96,11 @@ echo "TESTING: seccomp errno (test/filters/seccomp-errno.exp)" | |||
96 | echo "TESTING: seccomp su (test/filters/seccomp-su.exp)" | 96 | echo "TESTING: seccomp su (test/filters/seccomp-su.exp)" |
97 | ./seccomp-su.exp | 97 | ./seccomp-su.exp |
98 | 98 | ||
99 | which strace 2>/dev/null | 99 | if command -v strace; then |
100 | if [ $? -eq 0 ]; then | 100 | echo "TESTING: seccomp ptrace (test/filters/seccomp-ptrace.exp)" |
101 | echo "TESTING: seccomp ptrace (test/filters/seccomp-ptrace.exp)" | 101 | ./seccomp-ptrace.exp |
102 | ./seccomp-ptrace.exp | ||
103 | else | 102 | else |
104 | echo "TESTING SKIP: ptrace, strace not found" | 103 | echo "TESTING SKIP: ptrace, strace not found" |
105 | fi | 104 | fi |
106 | 105 | ||
107 | echo "TESTING: seccomp chmod - seccomp lists (test/filters/seccomp-chmod.exp)" | 106 | echo "TESTING: seccomp chmod - seccomp lists (test/filters/seccomp-chmod.exp)" |
@@ -115,16 +114,16 @@ echo "TESTING: seccomp chmod profile - seccomp lists (test/filters/seccomp-chmod | |||
115 | echo "TESTING: seccomp empty (test/filters/seccomp-empty.exp)" | 114 | echo "TESTING: seccomp empty (test/filters/seccomp-empty.exp)" |
116 | ./seccomp-empty.exp | 115 | ./seccomp-empty.exp |
117 | 116 | ||
118 | if [ "$(uname -m)" = "x86_64" ]; then | 117 | if [[ $(uname -m) == "x86_64" ]]; then |
119 | echo "TESTING: seccomp numeric (test/filters/seccomp-numeric.exp)" | 118 | echo "TESTING: seccomp numeric (test/filters/seccomp-numeric.exp)" |
120 | ./seccomp-numeric.exp | 119 | ./seccomp-numeric.exp |
121 | else | 120 | else |
122 | echo "TESTING SKIP: seccomp numeric test implemented only for x86_64" | 121 | echo "TESTING SKIP: seccomp numeric test implemented only for x86_64" |
123 | fi | 122 | fi |
124 | 123 | ||
125 | if [ "$(uname -m)" = "x86_64" ]; then | 124 | if [[ $(uname -m) == "x86_64" ]]; then |
126 | echo "TESTING: seccomp join (test/filters/seccomp-join.exp)" | 125 | echo "TESTING: seccomp join (test/filters/seccomp-join.exp)" |
127 | ./seccomp-join.exp | 126 | ./seccomp-join.exp |
128 | else | 127 | else |
129 | echo "TESTING SKIP: seccomp join test implemented only for x86_64" | 128 | echo "TESTING SKIP: seccomp join test implemented only for x86_64" |
130 | fi | 129 | fi |