diff options
author | 2018-09-10 09:58:53 -0400 | |
---|---|---|
committer | 2018-09-10 09:58:53 -0400 | |
commit | e54f8100d90f29b58d2a30bf8d93704c06e6761b (patch) | |
tree | 7669ba470de82ee544d00363bc1946e74ee05290 /test | |
parent | cleanup (diff) | |
download | firejail-e54f8100d90f29b58d2a30bf8d93704c06e6761b.tar.gz firejail-e54f8100d90f29b58d2a30bf8d93704c06e6761b.tar.zst firejail-e54f8100d90f29b58d2a30bf8d93704c06e6761b.zip |
testing
Diffstat (limited to 'test')
-rwxr-xr-x | test/arguments/arguments.sh | 5 | ||||
-rwxr-xr-x | test/arguments/outrun.sh | 22 | ||||
-rwxr-xr-x | test/environment/dash.exp | 2 | ||||
-rwxr-xr-x | test/environment/dns.exp | 2 | ||||
-rwxr-xr-x | test/fs/invalid_filename.exp | 62 | ||||
-rwxr-xr-x | test/ssh/login.exp | 49 | ||||
-rwxr-xr-x | test/ssh/scp.exp | 63 | ||||
-rwxr-xr-x | test/ssh/sftp.exp | 87 | ||||
-rwxr-xr-x | test/ssh/ssh.sh | 16 | ||||
-rwxr-xr-x | test/utils/firemon-cgroup.exp | 40 | ||||
-rwxr-xr-x | test/utils/utils.sh | 3 |
11 files changed, 2 insertions, 349 deletions
diff --git a/test/arguments/arguments.sh b/test/arguments/arguments.sh index d9f2d4697..c3505c188 100755 --- a/test/arguments/arguments.sh +++ b/test/arguments/arguments.sh | |||
@@ -18,8 +18,3 @@ sleep 1 | |||
18 | echo "TESTING: 3. --join option" | 18 | echo "TESTING: 3. --join option" |
19 | ./joinrun.exp | 19 | ./joinrun.exp |
20 | sleep 1 | 20 | sleep 1 |
21 | |||
22 | echo "TESTING: 4. --output option" | ||
23 | ./outrun.exp | ||
24 | rm out | ||
25 | rm out.* | ||
diff --git a/test/arguments/outrun.sh b/test/arguments/outrun.sh deleted file mode 100755 index 5bc3b1e37..000000000 --- a/test/arguments/outrun.sh +++ /dev/null | |||
@@ -1,22 +0,0 @@ | |||
1 | #!/bin/bash | ||
2 | |||
3 | echo "TESTING: 4.1 - simple args" | ||
4 | firejail --env=FIREJAIL_TEST_ARGUMENTS=yes --output=out faudit arg1 arg2 | ||
5 | |||
6 | # simple quotes, testing spaces in file names | ||
7 | echo "TESTING: 4.2 - args with space and \"" | ||
8 | firejail --env=FIREJAIL_TEST_ARGUMENTS=yes --output=out faudit "arg1 tail" "arg2 tail" | ||
9 | |||
10 | echo "TESTING: 4.3 - args with space and '" | ||
11 | firejail --env=FIREJAIL_TEST_ARGUMENTS=yes --output=out faudit 'arg1 tail' 'arg2 tail' | ||
12 | |||
13 | # escaped space in file names | ||
14 | echo "TESTING: 4.4 - args with space and \\" | ||
15 | firejail --env=FIREJAIL_TEST_ARGUMENTS=yes --output=out faudit arg1\ tail arg2\ tail | ||
16 | |||
17 | # & char appears in URLs - URLs should be quoted | ||
18 | echo "TESTING: 4.5 - args with & and \"" | ||
19 | firejail --env=FIREJAIL_TEST_ARGUMENTS=yes --output=out faudit "arg1&tail" "arg2&tail" | ||
20 | |||
21 | echo "TESTING: 4.6 - args with & and '" | ||
22 | firejail --env=FIREJAIL_TEST_ARGUMENTS=yes --output=out faudit 'arg1&tail' 'arg2&tail' | ||
diff --git a/test/environment/dash.exp b/test/environment/dash.exp index cad4422a0..daaa26dab 100755 --- a/test/environment/dash.exp +++ b/test/environment/dash.exp | |||
@@ -5,7 +5,7 @@ cd /home | |||
5 | spawn $env(SHELL) | 5 | spawn $env(SHELL) |
6 | match_max 100000 | 6 | match_max 100000 |
7 | 7 | ||
8 | send -- "firejail --private --tracelog --shell=/bin/dash\r" | 8 | send -- "firejail --private --shell=/bin/dash\r" |
9 | expect { | 9 | expect { |
10 | timeout {puts "TESTING ERROR 0\n";exit} | 10 | timeout {puts "TESTING ERROR 0\n";exit} |
11 | "Child process initialized" | 11 | "Child process initialized" |
diff --git a/test/environment/dns.exp b/test/environment/dns.exp index 6ddc0ccea..4a23cb4d7 100755 --- a/test/environment/dns.exp +++ b/test/environment/dns.exp | |||
@@ -61,7 +61,7 @@ expect { | |||
61 | send -- "exit\r" | 61 | send -- "exit\r" |
62 | sleep 1 | 62 | sleep 1 |
63 | 63 | ||
64 | send -- "firejail --trace --dns=208.67.222.222 wget -q debian.org\r" | 64 | send -- "firejail --dns=208.67.222.222 wget -q debian.org\r" |
65 | expect { | 65 | expect { |
66 | timeout {puts "TESTING ERROR 1.2\n";exit} | 66 | timeout {puts "TESTING ERROR 1.2\n";exit} |
67 | "connect" | 67 | "connect" |
diff --git a/test/fs/invalid_filename.exp b/test/fs/invalid_filename.exp index 84abe74cd..085dc9803 100755 --- a/test/fs/invalid_filename.exp +++ b/test/fs/invalid_filename.exp | |||
@@ -18,28 +18,6 @@ expect { | |||
18 | } | 18 | } |
19 | after 100 | 19 | after 100 |
20 | 20 | ||
21 | send -- "firejail --noprofile --cgroup=\"bla&&bla\"\r" | ||
22 | expect { | ||
23 | timeout {puts "TESTING ERROR 2.2\n";exit} | ||
24 | "Error:" | ||
25 | } | ||
26 | expect { | ||
27 | timeout {puts "TESTING ERROR 2.3\n";exit} | ||
28 | "is an invalid filename" | ||
29 | } | ||
30 | after 100 | ||
31 | |||
32 | send -- "firejail --noprofile --chroot=\"bla&&bla\"\r" | ||
33 | expect { | ||
34 | timeout {puts "TESTING ERROR 3.2\n";exit} | ||
35 | "Error:" | ||
36 | } | ||
37 | expect { | ||
38 | timeout {puts "TESTING ERROR 3.3\n";exit} | ||
39 | "is an invalid filename" | ||
40 | } | ||
41 | after 100 | ||
42 | |||
43 | send -- "firejail --noprofile --netfilter=\"bla&&bla\"\r" | 21 | send -- "firejail --noprofile --netfilter=\"bla&&bla\"\r" |
44 | expect { | 22 | expect { |
45 | timeout {puts "TESTING ERROR 4.2\n";exit} | 23 | timeout {puts "TESTING ERROR 4.2\n";exit} |
@@ -51,13 +29,6 @@ expect { | |||
51 | } | 29 | } |
52 | after 100 | 30 | after 100 |
53 | 31 | ||
54 | send -- "firejail --noprofile --output=\"bla&&bla\"\r" | ||
55 | expect { | ||
56 | timeout {puts "TESTING ERROR 5.3\n";exit} | ||
57 | "is an invalid filename" | ||
58 | } | ||
59 | after 100 | ||
60 | |||
61 | send -- "firejail --noprofile --private=\"bla&&bla\"\r" | 32 | send -- "firejail --noprofile --private=\"bla&&bla\"\r" |
62 | expect { | 33 | expect { |
63 | timeout {puts "TESTING ERROR 6.2\n";exit} | 34 | timeout {puts "TESTING ERROR 6.2\n";exit} |
@@ -69,39 +40,6 @@ expect { | |||
69 | } | 40 | } |
70 | after 100 | 41 | after 100 |
71 | 42 | ||
72 | send -- "firejail --noprofile --private-bin=\"bla&&bla\"\r" | ||
73 | expect { | ||
74 | timeout {puts "TESTING ERROR 7.2\n";exit} | ||
75 | "Error:" | ||
76 | } | ||
77 | expect { | ||
78 | timeout {puts "TESTING ERROR 7.3\n";exit} | ||
79 | "is an invalid filename" | ||
80 | } | ||
81 | after 100 | ||
82 | |||
83 | send -- "firejail --noprofile --private-home=\"bla&&bla\"\r" | ||
84 | expect { | ||
85 | timeout {puts "TESTING ERROR 8.2\n";exit} | ||
86 | "Error:" | ||
87 | } | ||
88 | expect { | ||
89 | timeout {puts "TESTING ERROR 8.3\n";exit} | ||
90 | "is an invalid filename" | ||
91 | } | ||
92 | after 100 | ||
93 | |||
94 | send -- "firejail --noprofile --private-etc=\"bla&&bla\"\r" | ||
95 | expect { | ||
96 | timeout {puts "TESTING ERROR 9.2\n";exit} | ||
97 | "Error:" | ||
98 | } | ||
99 | expect { | ||
100 | timeout {puts "TESTING ERROR 9.3\n";exit} | ||
101 | "is an invalid filename" | ||
102 | } | ||
103 | after 100 | ||
104 | |||
105 | send -- "firejail --profile=\"bla&&bla\"\r" | 43 | send -- "firejail --profile=\"bla&&bla\"\r" |
106 | expect { | 44 | expect { |
107 | timeout {puts "TESTING ERROR 10.2\n";exit} | 45 | timeout {puts "TESTING ERROR 10.2\n";exit} |
diff --git a/test/ssh/login.exp b/test/ssh/login.exp deleted file mode 100755 index 479292c91..000000000 --- a/test/ssh/login.exp +++ /dev/null | |||
@@ -1,49 +0,0 @@ | |||
1 | #!/usr/bin/expect -f | ||
2 | |||
3 | set timeout 10 | ||
4 | spawn $env(SHELL) | ||
5 | match_max 100000 | ||
6 | |||
7 | send -- "ssh firejail-test@0\r" | ||
8 | expect { | ||
9 | timeout {puts "TESTING ERROR 0\n";exit} | ||
10 | "Child process initialized" {puts "OK\n"} | ||
11 | "an existing sandbox was detected" {puts "OK\n"} | ||
12 | } | ||
13 | sleep 1 | ||
14 | |||
15 | send -- "ps aux | wc -l\r" | ||
16 | expect { | ||
17 | timeout {puts "TESTING ERROR 1\n";exit} | ||
18 | "5" | ||
19 | } | ||
20 | after 100 | ||
21 | |||
22 | send -- "ls -l /home | grep drw | wc -l\r" | ||
23 | expect { | ||
24 | timeout {puts "TESTING ERROR 2\n";exit} | ||
25 | "1" | ||
26 | } | ||
27 | after 100 | ||
28 | |||
29 | send -- "cat /proc/self/status | grep Seccomp\r" | ||
30 | expect { | ||
31 | timeout {puts "TESTING ERROR 3\n";exit} | ||
32 | "2" | ||
33 | } | ||
34 | after 100 | ||
35 | |||
36 | send -- "cat /proc/self/status | grep CapBnd\r" | ||
37 | expect { | ||
38 | timeout {puts "TESTING ERROR 4\n";exit} | ||
39 | "0000000000000000" | ||
40 | } | ||
41 | after 100 | ||
42 | |||
43 | # preparing scp/sftp tests | ||
44 | send -- "rm testfile\r" | ||
45 | |||
46 | send -- "exit\r" | ||
47 | sleep 1 | ||
48 | |||
49 | puts "\nall done\n" | ||
diff --git a/test/ssh/scp.exp b/test/ssh/scp.exp deleted file mode 100755 index 355125751..000000000 --- a/test/ssh/scp.exp +++ /dev/null | |||
@@ -1,63 +0,0 @@ | |||
1 | #!/usr/bin/expect -f | ||
2 | |||
3 | set timeout 10 | ||
4 | spawn $env(SHELL) | ||
5 | match_max 100000 | ||
6 | |||
7 | send -- "ssh firejail-test@0\r" | ||
8 | expect { | ||
9 | timeout {puts "TESTING ERROR 0\n";exit} | ||
10 | "Child process initialized" {puts "OK\n"} | ||
11 | "an existing sandbox was detected" {puts "OK\n"} | ||
12 | } | ||
13 | sleep 1 | ||
14 | |||
15 | send -- "rm -f testfile\r" | ||
16 | after 100 | ||
17 | send -- "exit\r" | ||
18 | sleep 1 | ||
19 | |||
20 | send -- "echo 12345 > testfile\r" | ||
21 | after 100 | ||
22 | send -- "scp testfile firejail-test@0:~/testfile\r" | ||
23 | expect { | ||
24 | timeout {puts "TESTING ERROR 1\n";exit} | ||
25 | "100%" | ||
26 | } | ||
27 | sleep 1 | ||
28 | |||
29 | |||
30 | send -- "ssh firejail-test@0\r" | ||
31 | expect { | ||
32 | timeout {puts "TESTING ERROR 2\n";exit} | ||
33 | "Child process initialized" {puts "OK\n"} | ||
34 | "an existing sandbox was detected" {puts "OK\n"} | ||
35 | } | ||
36 | sleep 1 | ||
37 | send -- "cat testfile\r" | ||
38 | expect { | ||
39 | timeout {puts "TESTING ERROR 3\n";exit} | ||
40 | "12345" | ||
41 | } | ||
42 | after 100 | ||
43 | send -- "exit\r" | ||
44 | sleep 1 | ||
45 | |||
46 | send -- "rm testfile\r" | ||
47 | after 100 | ||
48 | send -- "scp firejail-test@0:~/testfile testfile\r" | ||
49 | expect { | ||
50 | timeout {puts "TESTING ERROR 4\n";exit} | ||
51 | "100%" | ||
52 | } | ||
53 | sleep 1 | ||
54 | send -- "cat testfile\r" | ||
55 | expect { | ||
56 | timeout {puts "TESTING ERROR 5\n";exit} | ||
57 | "12345" | ||
58 | } | ||
59 | after 100 | ||
60 | send -- "rm testfile\r" | ||
61 | sleep 1 | ||
62 | |||
63 | puts "\nall done\n" | ||
diff --git a/test/ssh/sftp.exp b/test/ssh/sftp.exp deleted file mode 100755 index 3b0124ec7..000000000 --- a/test/ssh/sftp.exp +++ /dev/null | |||
@@ -1,87 +0,0 @@ | |||
1 | #!/usr/bin/expect -f | ||
2 | |||
3 | set timeout 10 | ||
4 | spawn $env(SHELL) | ||
5 | match_max 100000 | ||
6 | |||
7 | send -- "ssh firejail-test@0\r" | ||
8 | expect { | ||
9 | timeout {puts "TESTING ERROR 0\n";exit} | ||
10 | "Child process initialized" {puts "OK\n"} | ||
11 | "an existing sandbox was detected" {puts "OK\n"} | ||
12 | } | ||
13 | sleep 1 | ||
14 | |||
15 | send -- "rm -f testfile\r" | ||
16 | after 100 | ||
17 | send -- "exit\r" | ||
18 | sleep 1 | ||
19 | |||
20 | send -- "echo 12345 > testfile\r" | ||
21 | after 100 | ||
22 | send -- "sftp firejail-test@0\r" | ||
23 | expect { | ||
24 | timeout {puts "TESTING ERROR 1\n";exit} | ||
25 | "Connected to 0" | ||
26 | } | ||
27 | expect { | ||
28 | timeout {puts "TESTING ERROR 2\n";exit} | ||
29 | "sftp>" | ||
30 | } | ||
31 | after 100 | ||
32 | send -- "put testfile\r" | ||
33 | expect { | ||
34 | timeout {puts "TESTING ERROR 3\n";exit} | ||
35 | "100%" | ||
36 | } | ||
37 | after 100 | ||
38 | send -- "exit\r" | ||
39 | sleep 1 | ||
40 | |||
41 | |||
42 | send -- "ssh firejail-test@0\r" | ||
43 | expect { | ||
44 | timeout {puts "TESTING ERROR 4\n";exit} | ||
45 | "Child process initialized" {puts "OK\n"} | ||
46 | "an existing sandbox was detected" {puts "OK\n"} | ||
47 | } | ||
48 | sleep 1 | ||
49 | send -- "cat testfile\r" | ||
50 | expect { | ||
51 | timeout {puts "TESTING ERROR 5\n";exit} | ||
52 | "12345" | ||
53 | } | ||
54 | after 100 | ||
55 | send -- "exit\r" | ||
56 | sleep 1 | ||
57 | |||
58 | send -- "rm testfile\r" | ||
59 | after 100 | ||
60 | send -- "sftp firejail-test@0\r" | ||
61 | expect { | ||
62 | timeout {puts "TESTING ERROR 6\n";exit} | ||
63 | "Connected to 0" | ||
64 | } | ||
65 | expect { | ||
66 | timeout {puts "TESTING ERROR 7\n";exit} | ||
67 | "sftp>" | ||
68 | } | ||
69 | after 100 | ||
70 | send -- "get testfile\r" | ||
71 | expect { | ||
72 | timeout {puts "TESTING ERROR 8\n";exit} | ||
73 | "100%" | ||
74 | } | ||
75 | after 100 | ||
76 | send -- "exit\r" | ||
77 | sleep 1 | ||
78 | send -- "cat testfile\r" | ||
79 | expect { | ||
80 | timeout {puts "TESTING ERROR 9\n";exit} | ||
81 | "12345" | ||
82 | } | ||
83 | after 100 | ||
84 | send -- "rm testfile\r" | ||
85 | sleep 1 | ||
86 | |||
87 | puts "\nall done\n" | ||
diff --git a/test/ssh/ssh.sh b/test/ssh/ssh.sh deleted file mode 100755 index 20a70b1b6..000000000 --- a/test/ssh/ssh.sh +++ /dev/null | |||
@@ -1,16 +0,0 @@ | |||
1 | #!/bin/bash | ||
2 | # This file is part of Firejail project | ||
3 | # Copyright (C) 2014-2018 Firejail Authors | ||
4 | # License GPL v2 | ||
5 | |||
6 | export MALLOC_CHECK_=3 | ||
7 | export MALLOC_PERTURB_=$(($RANDOM % 255 + 1)) | ||
8 | |||
9 | echo "TESTING: ssh login (test/ssh/login.exp)" | ||
10 | ./login.exp | ||
11 | |||
12 | echo "TESTING: sftp (test/ssh/sftp.exp)" | ||
13 | ./sftp.exp | ||
14 | |||
15 | echo "TESTING: scp (test/ssh/scp.exp)" | ||
16 | ./scp.exp | ||
diff --git a/test/utils/firemon-cgroup.exp b/test/utils/firemon-cgroup.exp deleted file mode 100755 index 8282e701a..000000000 --- a/test/utils/firemon-cgroup.exp +++ /dev/null | |||
@@ -1,40 +0,0 @@ | |||
1 | #!/usr/bin/expect -f | ||
2 | # This file is part of Firejail project | ||
3 | # Copyright (C) 2014-2018 Firejail Authors | ||
4 | # License GPL v2 | ||
5 | |||
6 | set timeout 10 | ||
7 | spawn $env(SHELL) | ||
8 | match_max 100000 | ||
9 | |||
10 | send -- "firejail --name=test1\r" | ||
11 | expect { | ||
12 | timeout {puts "TESTING ERROR 0\n";exit} | ||
13 | "Child process initialized" | ||
14 | } | ||
15 | sleep 1 | ||
16 | |||
17 | spawn $env(SHELL) | ||
18 | send -- "firejail --name=test2\r" | ||
19 | expect { | ||
20 | timeout {puts "TESTING ERROR 1\n";exit} | ||
21 | "Child process initialized" | ||
22 | } | ||
23 | sleep 1 | ||
24 | |||
25 | spawn $env(SHELL) | ||
26 | send -- "firemon --cgroup\r" | ||
27 | sleep 4 | ||
28 | expect { | ||
29 | timeout {puts "TESTING ERROR 2\n";exit} | ||
30 | "need to be root" {puts "TESTING SKIP: /proc mounted as hidepid\n"; exit} | ||
31 | "name=test1" | ||
32 | } | ||
33 | expect { | ||
34 | timeout {puts "TESTING ERROR 3\n";exit} | ||
35 | "name=test2" | ||
36 | } | ||
37 | |||
38 | after 100 | ||
39 | |||
40 | puts "\nall done\n" | ||
diff --git a/test/utils/utils.sh b/test/utils/utils.sh index c4958094e..79184ab99 100755 --- a/test/utils/utils.sh +++ b/test/utils/utils.sh | |||
@@ -104,9 +104,6 @@ echo "TESTING: firemon caps (test/utils/firemon-caps.exp)" | |||
104 | echo "TESTING: firemon cpu (test/utils/firemon-cpu.exp)" | 104 | echo "TESTING: firemon cpu (test/utils/firemon-cpu.exp)" |
105 | ./firemon-cpu.exp | 105 | ./firemon-cpu.exp |
106 | 106 | ||
107 | echo "TESTING: firemon cgroup (test/utils/firemon-cgroup.exp)" | ||
108 | ./firemon-cgroup.exp | ||
109 | |||
110 | echo "TESTING: firemon version (test/utils/firemon-version.exp)" | 107 | echo "TESTING: firemon version (test/utils/firemon-version.exp)" |
111 | ./firemon-version.exp | 108 | ./firemon-version.exp |
112 | 109 | ||