diff options
Diffstat (limited to 'test')
-rwxr-xr-x | test/env.exp | 55 | ||||
-rw-r--r-- | test/env.profile | 2 | ||||
-rwxr-xr-x | test/firejail-in-firejail.exp | 18 | ||||
-rwxr-xr-x | test/fscheck-private.exp | 39 | ||||
-rwxr-xr-x | test/test.sh | 3 |
5 files changed, 77 insertions, 40 deletions
diff --git a/test/env.exp b/test/env.exp new file mode 100755 index 000000000..d2edb0477 --- /dev/null +++ b/test/env.exp | |||
@@ -0,0 +1,55 @@ | |||
1 | #!/usr/bin/expect -f | ||
2 | |||
3 | set timeout 10 | ||
4 | spawn $env(SHELL) | ||
5 | match_max 100000 | ||
6 | |||
7 | #*********************************************** | ||
8 | send -- "firejail --env=ENV1=env1 --env=ENV2=env2 --env=ENV3=env3\r" | ||
9 | expect { | ||
10 | timeout {puts "TESTING ERROR 0\n";exit} | ||
11 | "Child process initialized" | ||
12 | } | ||
13 | sleep 1 | ||
14 | |||
15 | send -- "env | grep ENV\r" | ||
16 | expect { | ||
17 | timeout {puts "TESTING ERROR 1\n";exit} | ||
18 | "ENV1" | ||
19 | } | ||
20 | send -- "env | grep ENV\r" | ||
21 | expect { | ||
22 | timeout {puts "TESTING ERROR 2\n";exit} | ||
23 | "ENV2" | ||
24 | } | ||
25 | send -- "env | grep ENV\r" | ||
26 | expect { | ||
27 | timeout {puts "TESTING ERROR 3\n";exit} | ||
28 | "ENV3" | ||
29 | } | ||
30 | send -- "exit\r" | ||
31 | sleep 1 | ||
32 | |||
33 | #*********************************************** | ||
34 | send -- "firejail --profile=env.profile\r" | ||
35 | expect { | ||
36 | timeout {puts "TESTING ERROR 4\n";exit} | ||
37 | "Child process initialized" | ||
38 | } | ||
39 | sleep 1 | ||
40 | send -- "env | grep LD_LIBRARY_PATH\r" | ||
41 | expect { | ||
42 | timeout {puts "TESTING ERROR 5\n";exit} | ||
43 | "/opt/test/lib" | ||
44 | } | ||
45 | send -- "env | grep CFLAGS\r" | ||
46 | expect { | ||
47 | timeout {puts "TESTING ERROR 6\n";exit} | ||
48 | "Wall" | ||
49 | } | ||
50 | expect { | ||
51 | timeout {puts "TESTING ERROR 7\n";exit} | ||
52 | "Werror" | ||
53 | } | ||
54 | |||
55 | puts "\n" | ||
diff --git a/test/env.profile b/test/env.profile new file mode 100644 index 000000000..ba66e6210 --- /dev/null +++ b/test/env.profile | |||
@@ -0,0 +1,2 @@ | |||
1 | env LD_LIBRARY_PATH=/opt/test/lib | ||
2 | env CFLAGS="-W -Wall -Werror" | ||
diff --git a/test/firejail-in-firejail.exp b/test/firejail-in-firejail.exp index 404eb03bb..59a94a7fb 100755 --- a/test/firejail-in-firejail.exp +++ b/test/firejail-in-firejail.exp | |||
@@ -14,24 +14,8 @@ sleep 1 | |||
14 | send -- "firejail\r" | 14 | send -- "firejail\r" |
15 | expect { | 15 | expect { |
16 | timeout {puts "TESTING ERROR 1\n";exit} | 16 | timeout {puts "TESTING ERROR 1\n";exit} |
17 | "Child process initialized" | 17 | "Warning: an existing sandbox was detected" |
18 | } | ||
19 | sleep 1 | ||
20 | |||
21 | send -- "firejail\r" | ||
22 | expect { | ||
23 | timeout {puts "TESTING ERROR 1\n";exit} | ||
24 | "Child process initialized" | ||
25 | } | 18 | } |
26 | sleep 1 | 19 | sleep 1 |
27 | puts "\n" | ||
28 | |||
29 | send -- "exit\r" | ||
30 | sleep 1 | ||
31 | send -- "exit\r" | ||
32 | sleep 1 | ||
33 | send -- "exit\r" | ||
34 | sleep 1 | ||
35 | |||
36 | 20 | ||
37 | puts "\n" | 21 | puts "\n" |
diff --git a/test/fscheck-private.exp b/test/fscheck-private.exp index 4c791423d..8e485cc03 100755 --- a/test/fscheck-private.exp +++ b/test/fscheck-private.exp | |||
@@ -4,37 +4,30 @@ set timeout 10 | |||
4 | spawn $env(SHELL) | 4 | spawn $env(SHELL) |
5 | match_max 100000 | 5 | match_max 100000 |
6 | 6 | ||
7 | # dir | 7 | |
8 | #send -- "firejail --net=br0 --private=fscheck-dir\r" | 8 | # .. |
9 | #send -- "firejail --net=br0 --private=../test/fscheck-dir\r" | ||
9 | #expect { | 10 | #expect { |
10 | # timeout {puts "TESTING ERROR 0\n";exit} | 11 | # timeout {puts "TESTING ERROR 0.1\n";exit} |
11 | # "Error" | 12 | # "Error" |
12 | #} | 13 | #} |
13 | #after 100 | 14 | #after 100 |
14 | 15 | ||
15 | # .. | ||
16 | send -- "firejail --net=br0 --private=../test/fscheck-dir\r" | ||
17 | expect { | ||
18 | timeout {puts "TESTING ERROR 0.1\n";exit} | ||
19 | "Error" | ||
20 | } | ||
21 | after 100 | ||
22 | |||
23 | # dir link | 16 | # dir link |
24 | send -- "firejail --net=br0 --private=fscheck-dir-link\r" | 17 | #send -- "firejail --net=br0 --private=fscheck-dir-link\r" |
25 | expect { | 18 | #expect { |
26 | timeout {puts "TESTING ERROR 1\n";exit} | 19 | # timeout {puts "TESTING ERROR 1\n";exit} |
27 | "Error" | 20 | # "Error" |
28 | } | 21 | #} |
29 | after 100 | 22 | #after 100 |
30 | 23 | ||
31 | # .. | 24 | # .. |
32 | send -- "firejail --net=br0 --private=../test/fscheck-dir-link\r" | 25 | #send -- "firejail --net=br0 --private=../test/fscheck-dir-link\r" |
33 | expect { | 26 | #expect { |
34 | timeout {puts "TESTING ERROR 1.1\n";exit} | 27 | # timeout {puts "TESTING ERROR 1.1\n";exit} |
35 | "Error" | 28 | # "Error" |
36 | } | 29 | #} |
37 | after 100 | 30 | #after 100 |
38 | 31 | ||
39 | # file link | 32 | # file link |
40 | send -- "firejail --net=br0 --private=fscheck-file-link\r" | 33 | send -- "firejail --net=br0 --private=fscheck-file-link\r" |
diff --git a/test/test.sh b/test/test.sh index 83d249b4f..8ddbc476f 100755 --- a/test/test.sh +++ b/test/test.sh | |||
@@ -4,6 +4,9 @@ | |||
4 | 4 | ||
5 | ./fscheck.sh | 5 | ./fscheck.sh |
6 | 6 | ||
7 | echo "TESTING: environment variables" | ||
8 | ./env.exp | ||
9 | |||
7 | echo "TESTING: private-etc" | 10 | echo "TESTING: private-etc" |
8 | ./private-etc.exp | 11 | ./private-etc.exp |
9 | 12 | ||