diff options
Diffstat (limited to 'test')
-rwxr-xr-x | test/root/join.exp | 52 | ||||
-rwxr-xr-x | test/root/root.sh | 6 | ||||
-rwxr-xr-x | test/utils/join.exp | 15 |
3 files changed, 72 insertions, 1 deletions
diff --git a/test/root/join.exp b/test/root/join.exp new file mode 100755 index 000000000..e4a4e87af --- /dev/null +++ b/test/root/join.exp | |||
@@ -0,0 +1,52 @@ | |||
1 | #!/usr/bin/expect -f | ||
2 | # This file is part of Firejail project | ||
3 | # Copyright (C) 2014-2016 Firejail Authors | ||
4 | # License GPL v2 | ||
5 | |||
6 | set timeout 10 | ||
7 | cd /home | ||
8 | spawn $env(SHELL) | ||
9 | match_max 100000 | ||
10 | |||
11 | send -- "firejail --name=jointesting --cpu=0 --nice=2\r" | ||
12 | expect { | ||
13 | timeout {puts "TESTING ERROR 0\n";exit} | ||
14 | "Child process initialized" | ||
15 | } | ||
16 | sleep 2 | ||
17 | |||
18 | spawn $env(SHELL) | ||
19 | send -- "firejail --join=jointesting\r" | ||
20 | expect { | ||
21 | timeout {puts "TESTING ERROR 1\n";exit} | ||
22 | "Switching to pid" | ||
23 | } | ||
24 | sleep 1 | ||
25 | send -- "ps aux\r" | ||
26 | expect { | ||
27 | timeout {puts "TESTING ERROR 2\n";exit} | ||
28 | "/bin/bash" | ||
29 | } | ||
30 | expect { | ||
31 | timeout {puts "TESTING ERROR 3\n";exit} | ||
32 | "/bin/bash" | ||
33 | } | ||
34 | |||
35 | send -- "exit\r" | ||
36 | sleep 1 | ||
37 | send -- "firejail --join-network=jointesting\r" | ||
38 | expect { | ||
39 | timeout {puts "TESTING ERROR 4\n";exit} | ||
40 | "Child process initialized" | ||
41 | } | ||
42 | send -- "exit\r" | ||
43 | sleep 1 | ||
44 | send -- "firejail --join-filesystem=jointesting\r" | ||
45 | expect { | ||
46 | timeout {puts "TESTING ERROR 5\n";exit} | ||
47 | "Child process initialized" | ||
48 | } | ||
49 | |||
50 | after 100 | ||
51 | |||
52 | puts "\nall done\n" | ||
diff --git a/test/root/root.sh b/test/root/root.sh index 371bccdff..9764b3804 100755 --- a/test/root/root.sh +++ b/test/root/root.sh | |||
@@ -57,6 +57,12 @@ echo "TESTING: fs whitelist mnt, opt, media (test/root/whitelist-mnt.exp)" | |||
57 | ./whitelist.exp | 57 | ./whitelist.exp |
58 | 58 | ||
59 | #******************************** | 59 | #******************************** |
60 | # utils | ||
61 | #******************************** | ||
62 | echo "TESTING: join (test/root/join.exp)" | ||
63 | ./join.exp | ||
64 | |||
65 | #******************************** | ||
60 | # seccomp | 66 | # seccomp |
61 | #******************************** | 67 | #******************************** |
62 | echo "TESTING: seccomp umount (test/root/seccomp-umount.exp)" | 68 | echo "TESTING: seccomp umount (test/root/seccomp-umount.exp)" |
diff --git a/test/utils/join.exp b/test/utils/join.exp index fc30bc6a4..79fe99f2d 100755 --- a/test/utils/join.exp +++ b/test/utils/join.exp | |||
@@ -32,7 +32,20 @@ expect { | |||
32 | "/bin/bash" | 32 | "/bin/bash" |
33 | } | 33 | } |
34 | 34 | ||
35 | send -- "exit" | 35 | send -- "exit\r" |
36 | sleep 1 | ||
37 | send -- "firejail --join-network=jointesting\r" | ||
38 | expect { | ||
39 | timeout {puts "TESTING ERROR 4\n";exit} | ||
40 | "is only available to root user" | ||
41 | } | ||
42 | after 100 | ||
43 | send -- "firejail --join-filesystem=jointesting\r" | ||
44 | expect { | ||
45 | timeout {puts "TESTING ERROR 5\n";exit} | ||
46 | "is only available to root user" | ||
47 | } | ||
48 | |||
36 | after 100 | 49 | after 100 |
37 | 50 | ||
38 | puts "\nall done\n" | 51 | puts "\nall done\n" |