aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Reiner Herrmann <reiner@reiner-h.de>2017-04-16 21:11:10 +0200
committerLibravatar Reiner Herrmann <reiner@reiner-h.de>2017-04-16 21:16:15 +0200
commitd600a293a7f33397243c449d895168a4d4a9376d (patch)
treef508eea04da0fb5c5eb4ba8f3670b556c9adf8fb
parenttest: argtest no longer available (diff)
downloadfirejail-d600a293a7f33397243c449d895168a4d4a9376d.tar.gz
firejail-d600a293a7f33397243c449d895168a4d4a9376d.tar.zst
firejail-d600a293a7f33397243c449d895168a4d4a9376d.zip
test: make tests independent of libdir
-rwxr-xr-xtest/arguments/arguments.sh7
-rwxr-xr-xtest/arguments/bashrun.sh12
-rwxr-xr-xtest/arguments/joinrun.sh12
-rwxr-xr-xtest/arguments/outrun.sh12
-rwxr-xr-xtest/fcopy/cmdline.exp8
-rwxr-xr-xtest/fcopy/dircopy.exp2
-rwxr-xr-xtest/fcopy/fcopy.sh7
-rwxr-xr-xtest/fcopy/filecopy.exp2
-rwxr-xr-xtest/fcopy/linkcopy.exp2
-rwxr-xr-xtest/filters/filters.sh7
-rwxr-xr-xtest/filters/fseccomp.exp30
11 files changed, 61 insertions, 40 deletions
diff --git a/test/arguments/arguments.sh b/test/arguments/arguments.sh
index 3864b65d8..d9b7058bf 100755
--- a/test/arguments/arguments.sh
+++ b/test/arguments/arguments.sh
@@ -1,5 +1,12 @@
1#!/bin/bash 1#!/bin/bash
2 2
3if [ -f /etc/debian_version ]; then
4 libdir=$(dirname "$(dpkg -L firejail | grep faudit)")
5 export PATH="$PATH:$libdir"
6else
7 export PATH="$PATH:/usr/lib/firejail"
8fi
9
3echo "TESTING: 1. regular bash session" 10echo "TESTING: 1. regular bash session"
4./bashrun.exp 11./bashrun.exp
5sleep 1 12sleep 1
diff --git a/test/arguments/bashrun.sh b/test/arguments/bashrun.sh
index 0797c92c2..a4773fd6c 100755
--- a/test/arguments/bashrun.sh
+++ b/test/arguments/bashrun.sh
@@ -1,22 +1,22 @@
1#!/bin/bash 1#!/bin/bash
2 2
3echo "TESTING: 1.1 - simple args" 3echo "TESTING: 1.1 - simple args"
4firejail --env=FIREJAIL_TEST_ARGUMENTS=yes --quiet /usr/lib/firejail/faudit arg1 arg2 4firejail --env=FIREJAIL_TEST_ARGUMENTS=yes --quiet faudit arg1 arg2
5 5
6# simple quotes, testing spaces in file names 6# simple quotes, testing spaces in file names
7echo "TESTING: 1.2 - args with space and \"" 7echo "TESTING: 1.2 - args with space and \""
8firejail --env=FIREJAIL_TEST_ARGUMENTS=yes --quiet /usr/lib/firejail/faudit "arg1 tail" "arg2 tail" 8firejail --env=FIREJAIL_TEST_ARGUMENTS=yes --quiet faudit "arg1 tail" "arg2 tail"
9 9
10echo "TESTING: 1.3 - args with space and '" 10echo "TESTING: 1.3 - args with space and '"
11firejail --env=FIREJAIL_TEST_ARGUMENTS=yes --quiet /usr/lib/firejail/faudit 'arg1 tail' 'arg2 tail' 11firejail --env=FIREJAIL_TEST_ARGUMENTS=yes --quiet faudit 'arg1 tail' 'arg2 tail'
12 12
13# escaped space in file names 13# escaped space in file names
14echo "TESTING: 1.4 - args with space and \\" 14echo "TESTING: 1.4 - args with space and \\"
15firejail --env=FIREJAIL_TEST_ARGUMENTS=yes --quiet /usr/lib/firejail/faudit arg1\ tail arg2\ tail 15firejail --env=FIREJAIL_TEST_ARGUMENTS=yes --quiet faudit arg1\ tail arg2\ tail
16 16
17# & char appears in URLs - URLs should be quoted 17# & char appears in URLs - URLs should be quoted
18echo "TESTING: 1.5 - args with & and \"" 18echo "TESTING: 1.5 - args with & and \""
19firejail --env=FIREJAIL_TEST_ARGUMENTS=yes --quiet /usr/lib/firejail/faudit "arg1&tail" "arg2&tail" 19firejail --env=FIREJAIL_TEST_ARGUMENTS=yes --quiet faudit "arg1&tail" "arg2&tail"
20 20
21echo "TESTING: 1.6 - args with & and '" 21echo "TESTING: 1.6 - args with & and '"
22firejail --env=FIREJAIL_TEST_ARGUMENTS=yes --quiet /usr/lib/firejail/faudit 'arg1&tail' 'arg2&tail' 22firejail --env=FIREJAIL_TEST_ARGUMENTS=yes --quiet faudit 'arg1&tail' 'arg2&tail'
diff --git a/test/arguments/joinrun.sh b/test/arguments/joinrun.sh
index 2743d823e..3ed166839 100755
--- a/test/arguments/joinrun.sh
+++ b/test/arguments/joinrun.sh
@@ -1,22 +1,22 @@
1#!/bin/bash 1#!/bin/bash
2 2
3echo "TESTING: 3.1 - simple args" 3echo "TESTING: 3.1 - simple args"
4firejail --env=FIREJAIL_TEST_ARGUMENTS=yes --join=joinrun /usr/lib/firejail/faudit arg1 arg2 4firejail --env=FIREJAIL_TEST_ARGUMENTS=yes --join=joinrun faudit arg1 arg2
5 5
6# simple quotes, testing spaces in file names 6# simple quotes, testing spaces in file names
7echo "TESTING: 3.2 - args with space and \"" 7echo "TESTING: 3.2 - args with space and \""
8firejail--env=FIREJAIL_TEST_ARGUMENTS=yes --quiet /usr/lib/firejail/faudit "arg1 tail" "arg2 tail" 8firejail--env=FIREJAIL_TEST_ARGUMENTS=yes --quiet faudit "arg1 tail" "arg2 tail"
9 9
10echo "TESTING: 3.3 - args with space and '" 10echo "TESTING: 3.3 - args with space and '"
11firejail --env=FIREJAIL_TEST_ARGUMENTS=yes --quiet /usr/lib/firejail/faudit 'arg1 tail' 'arg2 tail' 11firejail --env=FIREJAIL_TEST_ARGUMENTS=yes --quiet faudit 'arg1 tail' 'arg2 tail'
12 12
13# escaped space in file names 13# escaped space in file names
14echo "TESTING: 3.4 - args with space and \\" 14echo "TESTING: 3.4 - args with space and \\"
15firejail--env=FIREJAIL_TEST_ARGUMENTS=yes --quiet /usr/lib/firejail/faudit arg1\ tail arg2\ tail 15firejail--env=FIREJAIL_TEST_ARGUMENTS=yes --quiet faudit arg1\ tail arg2\ tail
16 16
17# & char appears in URLs - URLs should be quoted 17# & char appears in URLs - URLs should be quoted
18echo "TESTING: 3.5 - args with & and \"" 18echo "TESTING: 3.5 - args with & and \""
19firejail --env=FIREJAIL_TEST_ARGUMENTS=yes --quiet /usr/lib/firejail/faudit "arg1&tail" "arg2&tail" 19firejail --env=FIREJAIL_TEST_ARGUMENTS=yes --quiet faudit "arg1&tail" "arg2&tail"
20 20
21echo "TESTING: 3.6 - args with & and '" 21echo "TESTING: 3.6 - args with & and '"
22firejail --env=FIREJAIL_TEST_ARGUMENTS=yes --quiet /usr/lib/firejail/faudit 'arg1&tail' 'arg2&tail' 22firejail --env=FIREJAIL_TEST_ARGUMENTS=yes --quiet faudit 'arg1&tail' 'arg2&tail'
diff --git a/test/arguments/outrun.sh b/test/arguments/outrun.sh
index a21243873..e2b3046d6 100755
--- a/test/arguments/outrun.sh
+++ b/test/arguments/outrun.sh
@@ -1,22 +1,22 @@
1#!/bin/bash 1#!/bin/bash
2 2
3echo "TESTING: 4.1 - simple args" 3echo "TESTING: 4.1 - simple args"
4firejail --env=FIREJAIL_TEST_ARGUMENTS=yes --output=out /usr/lib/firejail/faudit arg1 arg2 4firejail --env=FIREJAIL_TEST_ARGUMENTS=yes --output=out faudit arg1 arg2
5 5
6# simple quotes, testing spaces in file names 6# simple quotes, testing spaces in file names
7echo "TESTING: 4.2 - args with space and \"" 7echo "TESTING: 4.2 - args with space and \""
8firejail --env=FIREJAIL_TEST_ARGUMENTS=yes --output=out /usr/lib/firejail/faudit "arg1 tail" "arg2 tail" 8firejail --env=FIREJAIL_TEST_ARGUMENTS=yes --output=out faudit "arg1 tail" "arg2 tail"
9 9
10echo "TESTING: 4.3 - args with space and '" 10echo "TESTING: 4.3 - args with space and '"
11firejail--env=FIREJAIL_TEST_ARGUMENTS=yes --output=out /usr/lib/firejail/faudit 'arg1 tail' 'arg2 tail' 11firejail--env=FIREJAIL_TEST_ARGUMENTS=yes --output=out faudit 'arg1 tail' 'arg2 tail'
12 12
13# escaped space in file names 13# escaped space in file names
14echo "TESTING: 4.4 - args with space and \\" 14echo "TESTING: 4.4 - args with space and \\"
15firejail--env=FIREJAIL_TEST_ARGUMENTS=yes --output=out /usr/lib/firejail/faudit arg1\ tail arg2\ tail 15firejail--env=FIREJAIL_TEST_ARGUMENTS=yes --output=out faudit arg1\ tail arg2\ tail
16 16
17# & char appears in URLs - URLs should be quoted 17# & char appears in URLs - URLs should be quoted
18echo "TESTING: 4.5 - args with & and \"" 18echo "TESTING: 4.5 - args with & and \""
19firejail --env=FIREJAIL_TEST_ARGUMENTS=yes --output=out /usr/lib/firejail/faudit "arg1&tail" "arg2&tail" 19firejail --env=FIREJAIL_TEST_ARGUMENTS=yes --output=out faudit "arg1&tail" "arg2&tail"
20 20
21echo "TESTING: 4.6 - args with & and '" 21echo "TESTING: 4.6 - args with & and '"
22firejail--env=FIREJAIL_TEST_ARGUMENTS=yes --output=out /usr/lib/firejail/faudit 'arg1&tail' 'arg2&tail' 22firejail--env=FIREJAIL_TEST_ARGUMENTS=yes --output=out faudit 'arg1&tail' 'arg2&tail'
diff --git a/test/fcopy/cmdline.exp b/test/fcopy/cmdline.exp
index 10dd8da58..798c9e718 100755
--- a/test/fcopy/cmdline.exp
+++ b/test/fcopy/cmdline.exp
@@ -7,7 +7,7 @@ set timeout 10
7spawn $env(SHELL) 7spawn $env(SHELL)
8match_max 100000 8match_max 100000
9 9
10send -- "/usr/lib/firejail/fcopy\r" 10send -- "fcopy\r"
11expect { 11expect {
12 timeout {puts "TESTING ERROR 0\n";exit} 12 timeout {puts "TESTING ERROR 0\n";exit}
13 "arguments missing" 13 "arguments missing"
@@ -18,7 +18,7 @@ expect {
18} 18}
19after 100 19after 100
20 20
21send -- "/usr/lib/firejail/fcopy foo\r" 21send -- "fcopy foo\r"
22expect { 22expect {
23 timeout {puts "TESTING ERROR 2\n";exit} 23 timeout {puts "TESTING ERROR 2\n";exit}
24 "arguments missing" 24 "arguments missing"
@@ -29,14 +29,14 @@ expect {
29} 29}
30after 100 30after 100
31 31
32send -- "/usr/lib/firejail/fcopy f%oo1 foo2\r" 32send -- "fcopy f%oo1 foo2\r"
33expect { 33expect {
34 timeout {puts "TESTING ERROR 4\n";exit} 34 timeout {puts "TESTING ERROR 4\n";exit}
35 "invalid source file name" 35 "invalid source file name"
36} 36}
37after 100 37after 100
38 38
39send -- "/usr/lib/firejail/fcopy foo1 f,oo2\r" 39send -- "fcopy foo1 f,oo2\r"
40expect { 40expect {
41 timeout {puts "TESTING ERROR 5\n";exit} 41 timeout {puts "TESTING ERROR 5\n";exit}
42 "invalid dest file name" 42 "invalid dest file name"
diff --git a/test/fcopy/dircopy.exp b/test/fcopy/dircopy.exp
index 573f454c8..e8462ae82 100755
--- a/test/fcopy/dircopy.exp
+++ b/test/fcopy/dircopy.exp
@@ -13,7 +13,7 @@ match_max 100000
13send -- "rm -fr dest/*\r" 13send -- "rm -fr dest/*\r"
14after 100 14after 100
15 15
16send -- "/usr/lib/firejail/fcopy src dest\r" 16send -- "fcopy src dest\r"
17after 100 17after 100
18 18
19send -- "find dest\r" 19send -- "find dest\r"
diff --git a/test/fcopy/fcopy.sh b/test/fcopy/fcopy.sh
index 0ae50399a..d122eff5d 100755
--- a/test/fcopy/fcopy.sh
+++ b/test/fcopy/fcopy.sh
@@ -6,6 +6,13 @@
6export MALLOC_CHECK_=3 6export MALLOC_CHECK_=3
7export MALLOC_PERTURB_=$(($RANDOM % 255 + 1)) 7export MALLOC_PERTURB_=$(($RANDOM % 255 + 1))
8 8
9if [ -f /etc/debian_version ]; then
10 libdir=$(dirname "$(dpkg -L firejail | grep fcopy)")
11 export PATH="$PATH:$libdir"
12else
13 export PATH="$PATH:/usr/lib/firejail"
14fi
15
9mkdir dest 16mkdir dest
10 17
11echo "TESTING: fcopy cmdline (test/fcopy/cmdline.exp)" 18echo "TESTING: fcopy cmdline (test/fcopy/cmdline.exp)"
diff --git a/test/fcopy/filecopy.exp b/test/fcopy/filecopy.exp
index e0d959c32..824a22bba 100755
--- a/test/fcopy/filecopy.exp
+++ b/test/fcopy/filecopy.exp
@@ -13,7 +13,7 @@ match_max 100000
13send -- "rm -fr dest/*\r" 13send -- "rm -fr dest/*\r"
14after 100 14after 100
15 15
16send -- "/usr/lib/firejail/fcopy dircopy.exp dest\r" 16send -- "fcopy dircopy.exp dest\r"
17after 100 17after 100
18 18
19send -- "find dest\r" 19send -- "find dest\r"
diff --git a/test/fcopy/linkcopy.exp b/test/fcopy/linkcopy.exp
index beceb3675..46ee327cb 100755
--- a/test/fcopy/linkcopy.exp
+++ b/test/fcopy/linkcopy.exp
@@ -13,7 +13,7 @@ match_max 100000
13send -- "rm -fr dest/*\r" 13send -- "rm -fr dest/*\r"
14after 100 14after 100
15 15
16send -- "/usr/lib/firejail/fcopy src/dircopy.exp dest\r" 16send -- "fcopy src/dircopy.exp dest\r"
17after 100 17after 100
18 18
19send -- "find dest\r" 19send -- "find dest\r"
diff --git a/test/filters/filters.sh b/test/filters/filters.sh
index 4996e6d66..59d7d7e7f 100755
--- a/test/filters/filters.sh
+++ b/test/filters/filters.sh
@@ -6,6 +6,13 @@
6export MALLOC_CHECK_=3 6export MALLOC_CHECK_=3
7export MALLOC_PERTURB_=$(($RANDOM % 255 + 1)) 7export MALLOC_PERTURB_=$(($RANDOM % 255 + 1))
8 8
9if [ -f /etc/debian_version ]; then
10 libdir=$(dirname "$(dpkg -L firejail | grep fseccomp)")
11 export PATH="$PATH:$libdir"
12else
13 export PATH="$PATH:/usr/lib/firejail"
14fi
15
9echo "TESTING: debug options (test/filters/debug.exp)" 16echo "TESTING: debug options (test/filters/debug.exp)"
10./debug.exp 17./debug.exp
11 18
diff --git a/test/filters/fseccomp.exp b/test/filters/fseccomp.exp
index 4d876df08..433524680 100755
--- a/test/filters/fseccomp.exp
+++ b/test/filters/fseccomp.exp
@@ -8,39 +8,39 @@ spawn $env(SHELL)
8match_max 100000 8match_max 100000
9 9
10after 100 10after 100
11send -- "/usr/lib/firejail/fseccomp debug-syscalls\r" 11send -- "fseccomp debug-syscalls\r"
12expect { 12expect {
13 timeout {puts "TESTING ERROR 1\n";exit} 13 timeout {puts "TESTING ERROR 1\n";exit}
14 "1 - write" 14 "1 - write"
15} 15}
16 16
17after 100 17after 100
18send -- "/usr/lib/firejail/fseccomp debug-errnos\r" 18send -- "fseccomp debug-errnos\r"
19expect { 19expect {
20 timeout {puts "TESTING ERROR 2\n";exit} 20 timeout {puts "TESTING ERROR 2\n";exit}
21 "1 - EPERM" 21 "1 - EPERM"
22} 22}
23 23
24after 100 24after 100
25send -- "/usr/lib/firejail/fseccomp debug-protocols\r" 25send -- "fseccomp debug-protocols\r"
26expect { 26expect {
27 timeout {puts "TESTING ERROR 3\n";exit} 27 timeout {puts "TESTING ERROR 3\n";exit}
28 "unix, inet, inet6, netlink, packet," 28 "unix, inet, inet6, netlink, packet,"
29} 29}
30 30
31after 100 31after 100
32send -- "/usr/lib/firejail/fseccomp protocol build unix,inet seccomp-test-file\r" 32send -- "fseccomp protocol build unix,inet seccomp-test-file\r"
33after 100 33after 100
34send -- "/usr/lib/firejail/fseccomp print seccomp-test-file\r" 34send -- "fseccomp print seccomp-test-file\r"
35expect { 35expect {
36 timeout {puts "TESTING ERROR 4.1\n";exit} 36 timeout {puts "TESTING ERROR 4.1\n";exit}
37 "WHITELIST 41 socket" 37 "WHITELIST 41 socket"
38} 38}
39 39
40after 100 40after 100
41send -- "/usr/lib/firejail/fseccomp secondary 64 seccomp-test-file\r" 41send -- "fseccomp secondary 64 seccomp-test-file\r"
42after 100 42after 100
43send -- "/usr/lib/firejail/fseccomp print seccomp-test-file\r" 43send -- "fseccomp print seccomp-test-file\r"
44expect { 44expect {
45 timeout {puts "TESTING ERROR 5.1\n";exit} 45 timeout {puts "TESTING ERROR 5.1\n";exit}
46 "BLACKLIST 165 mount" 46 "BLACKLIST 165 mount"
@@ -55,9 +55,9 @@ expect {
55} 55}
56 56
57after 100 57after 100
58send -- "/usr/lib/firejail/fseccomp default seccomp-test-file\r" 58send -- "fseccomp default seccomp-test-file\r"
59after 100 59after 100
60send -- "/usr/lib/firejail/fseccomp print seccomp-test-file\r" 60send -- "fseccomp print seccomp-test-file\r"
61expect { 61expect {
62 timeout {puts "TESTING ERROR 6.1\n";exit} 62 timeout {puts "TESTING ERROR 6.1\n";exit}
63 "BLACKLIST 165 mount" 63 "BLACKLIST 165 mount"
@@ -72,9 +72,9 @@ expect {
72} 72}
73 73
74after 100 74after 100
75send -- "/usr/lib/firejail/fseccomp drop seccomp-test-file chmod,chown\r" 75send -- "fseccomp drop seccomp-test-file chmod,chown\r"
76after 100 76after 100
77send -- "/usr/lib/firejail/fseccomp print seccomp-test-file\r" 77send -- "fseccomp print seccomp-test-file\r"
78expect { 78expect {
79 timeout {puts "TESTING ERROR 7.1\n";exit} 79 timeout {puts "TESTING ERROR 7.1\n";exit}
80 "BLACKLIST 165 mount" {puts "TESTING ERROR 7.2\n";exit} 80 "BLACKLIST 165 mount" {puts "TESTING ERROR 7.2\n";exit}
@@ -91,9 +91,9 @@ expect {
91} 91}
92 92
93after 100 93after 100
94send -- "/usr/lib/firejail/fseccomp default drop seccomp-test-file chmod,chown\r" 94send -- "fseccomp default drop seccomp-test-file chmod,chown\r"
95after 100 95after 100
96send -- "/usr/lib/firejail/fseccomp print seccomp-test-file\r" 96send -- "fseccomp print seccomp-test-file\r"
97expect { 97expect {
98 timeout {puts "TESTING ERROR 8.1\n";exit} 98 timeout {puts "TESTING ERROR 8.1\n";exit}
99 "BLACKLIST 165 mount" 99 "BLACKLIST 165 mount"
@@ -115,9 +115,9 @@ expect {
115 "RETURN_ALLOW" 115 "RETURN_ALLOW"
116} 116}
117after 100 117after 100
118send -- "/usr/lib/firejail/fseccomp keep seccomp-test-file chmod,chown\r" 118send -- "fseccomp keep seccomp-test-file chmod,chown\r"
119after 100 119after 100
120send -- "/usr/lib/firejail/fseccomp print seccomp-test-file\r" 120send -- "fseccomp print seccomp-test-file\r"
121expect { 121expect {
122 timeout {puts "TESTING ERROR 9.1\n";exit} 122 timeout {puts "TESTING ERROR 9.1\n";exit}
123 "WHITELIST 90 chmod" 123 "WHITELIST 90 chmod"