diff options
Diffstat (limited to 'test/root/cgroup.exp')
-rwxr-xr-x | test/root/cgroup.exp | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/test/root/cgroup.exp b/test/root/cgroup.exp new file mode 100755 index 000000000..4b07183a1 --- /dev/null +++ b/test/root/cgroup.exp | |||
@@ -0,0 +1,61 @@ | |||
1 | #!/usr/bin/expect -f | ||
2 | # This file is part of Firejail project | ||
3 | # Copyright (C) 2014-2017 Firejail Authors | ||
4 | # License GPL v2 | ||
5 | |||
6 | set timeout 10 | ||
7 | cd /home | ||
8 | spawn $env(SHELL) | ||
9 | match_max 100000 | ||
10 | |||
11 | |||
12 | send -- "mkdir /sys/fs/cgroup/systemd/firejail\r" | ||
13 | sleep 1 | ||
14 | send -- "ls /sys/fs/cgroup/systemd/firejail\r" | ||
15 | expect { | ||
16 | timeout {puts "TESTING ERROR 0\n";exit} | ||
17 | "tasks" | ||
18 | } | ||
19 | |||
20 | send -- "firejail --name=\"join testing\" --cgroup=/sys/fs/cgroup/systemd/firejail/tasks\r" | ||
21 | expect { | ||
22 | timeout {puts "TESTING ERROR 1\n";exit} | ||
23 | "Child process initialized" | ||
24 | } | ||
25 | sleep 2 | ||
26 | |||
27 | spawn $env(SHELL) | ||
28 | send -- "wc -l /sys/fs/cgroup/systemd/firejail/tasks\r" | ||
29 | expect { | ||
30 | timeout {puts "TESTING ERROR 2\n";exit} | ||
31 | "3" | ||
32 | } | ||
33 | |||
34 | spawn $env(SHELL) | ||
35 | send -- "firejail --join=\"join testing\"\r" | ||
36 | expect { | ||
37 | timeout {puts "TESTING ERROR 3\n";exit} | ||
38 | "Switching to pid" | ||
39 | } | ||
40 | sleep 1 | ||
41 | send -- "ps aux\r" | ||
42 | expect { | ||
43 | timeout {puts "TESTING ERROR 4\n";exit} | ||
44 | "/bin/bash" | ||
45 | } | ||
46 | expect { | ||
47 | timeout {puts "TESTING ERROR 5\n";exit} | ||
48 | "/bin/bash" | ||
49 | } | ||
50 | |||
51 | after 100 | ||
52 | |||
53 | spawn $env(SHELL) | ||
54 | send -- "wc -l /sys/fs/cgroup/systemd/firejail/tasks\r" | ||
55 | expect { | ||
56 | timeout {puts "TESTING ERROR 6\n";exit} | ||
57 | "3" | ||
58 | } | ||
59 | after 100 | ||
60 | |||
61 | puts "\nall done\n" | ||