diff options
Diffstat (limited to 'test/root/nginx.exp')
-rwxr-xr-x | test/root/nginx.exp | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/test/root/nginx.exp b/test/root/nginx.exp new file mode 100755 index 000000000..0b62fada9 --- /dev/null +++ b/test/root/nginx.exp | |||
@@ -0,0 +1,69 @@ | |||
1 | #!/usr/bin/expect -f | ||
2 | |||
3 | set timeout 5 | ||
4 | spawn $env(SHELL) | ||
5 | match_max 100000 | ||
6 | |||
7 | send -- "pkill nginx\r" | ||
8 | sleep 2 | ||
9 | |||
10 | |||
11 | send -- "firejail --name=nginx /etc/init.d/nginx start\r" | ||
12 | expect { | ||
13 | timeout {puts "TESTING ERROR 0\n";exit} | ||
14 | "Child process initialized" | ||
15 | } | ||
16 | sleep 2 | ||
17 | |||
18 | |||
19 | spawn $env(SHELL) | ||
20 | send -- "firejail --tree\r" | ||
21 | expect { | ||
22 | timeout {puts "TESTING ERROR 1\n";exit} | ||
23 | "root:nginx" | ||
24 | } | ||
25 | expect { | ||
26 | timeout {puts "TESTING ERROR 2\n";exit} | ||
27 | "www-data:nginx" | ||
28 | } | ||
29 | sleep 2 | ||
30 | |||
31 | |||
32 | send -- "rm index.html\r" | ||
33 | sleep 1 | ||
34 | send -- "wget 0\r" | ||
35 | expect { | ||
36 | timeout {puts "TESTING ERROR 3\n";exit} | ||
37 | "saved" | ||
38 | } | ||
39 | send -- "cat index.html\r" | ||
40 | expect { | ||
41 | timeout {puts "TESTING ERROR 4\n";exit} | ||
42 | "DOCTYPE html PUBLIC" | ||
43 | } | ||
44 | |||
45 | sleep 1 | ||
46 | send -- "rm index.html\r" | ||
47 | |||
48 | send -- "firejail --join=nginx\r" | ||
49 | sleep 2 | ||
50 | |||
51 | send -- "ls /dev\r" | ||
52 | expect { | ||
53 | timeout {puts "TESTING ERROR 5\n";exit} | ||
54 | "tty0" {puts "TESTING ERROR 6\n";exit} | ||
55 | "ttyS0" {puts "TESTING ERROR 6\n";exit} | ||
56 | "audio" {puts "TESTING ERROR 6\n";exit} | ||
57 | "ppp" {puts "TESTING ERROR 6\n";exit} | ||
58 | "log" | ||
59 | } | ||
60 | sleep 1 | ||
61 | send -- "ls -al /tmp;pwd\r" | ||
62 | expect { | ||
63 | timeout {puts "TESTING ERROR 10\n";exit} | ||
64 | "X11-unix" {puts "TESTING ERROR 11\n";exit} | ||
65 | "/root" | ||
66 | } | ||
67 | sleep 2 | ||
68 | |||
69 | puts "\nall done\n" | ||