diff options
Diffstat (limited to 'test')
-rwxr-xr-x | test/servers.exp | 6 | ||||
-rwxr-xr-x | test/servers6.exp | 68 | ||||
-rwxr-xr-x | test/test-root.sh | 6 |
3 files changed, 75 insertions, 5 deletions
diff --git a/test/servers.exp b/test/servers.exp index a36814a69..60f584919 100755 --- a/test/servers.exp +++ b/test/servers.exp | |||
@@ -18,7 +18,7 @@ expect { | |||
18 | sleep 2 | 18 | sleep 2 |
19 | 19 | ||
20 | 20 | ||
21 | send -- "/etc/init.d/rsyslog start;sleep 1;/etc/init.d/ssh start;sleep 1;/etc/init.d/nginx start\r" | 21 | send -- "/etc/init.d/rsyslog start;sleep 1;/etc/init.d/ssh start\r" |
22 | sleep 3 | 22 | sleep 3 |
23 | 23 | ||
24 | send -- "ps aux; pwd\r" | 24 | send -- "ps aux; pwd\r" |
@@ -30,10 +30,6 @@ expect { | |||
30 | timeout {puts "TESTING ERROR 2\n";exit} | 30 | timeout {puts "TESTING ERROR 2\n";exit} |
31 | "sshd" | 31 | "sshd" |
32 | } | 32 | } |
33 | expect { | ||
34 | timeout {puts "TESTING ERROR 3\n";exit} | ||
35 | "nginx" | ||
36 | } | ||
37 | 33 | ||
38 | send -- "exit\r" | 34 | send -- "exit\r" |
39 | sleep 1 | 35 | sleep 1 |
diff --git a/test/servers6.exp b/test/servers6.exp new file mode 100755 index 000000000..2179f6f98 --- /dev/null +++ b/test/servers6.exp | |||
@@ -0,0 +1,68 @@ | |||
1 | #!/usr/bin/expect -f | ||
2 | |||
3 | set timeout 5 | ||
4 | spawn $env(SHELL) | ||
5 | match_max 100000 | ||
6 | |||
7 | send -- "sudo ls; sudo whoami; sudo pwd\r" | ||
8 | expect { | ||
9 | timeout {puts "TESTING ERROR: you need to root run this test as root\n";exit} | ||
10 | "root" | ||
11 | } | ||
12 | |||
13 | send -- "pkill nginx\r" | ||
14 | sleep 2 | ||
15 | |||
16 | |||
17 | send -- "firejail --name=nginx /etc/init.d/nginx start\r" | ||
18 | expect { | ||
19 | timeout {puts "TESTING ERROR 0\n";exit} | ||
20 | "Child process initialized" | ||
21 | } | ||
22 | sleep 2 | ||
23 | |||
24 | |||
25 | spawn $env(SHELL) | ||
26 | send -- "firejail --tree\r" | ||
27 | expect { | ||
28 | timeout {puts "TESTING ERROR 1\n";exit} | ||
29 | "root:nginx" | ||
30 | } | ||
31 | expect { | ||
32 | timeout {puts "TESTING ERROR 2\n";exit} | ||
33 | "www-data:nginx" | ||
34 | } | ||
35 | sleep 2 | ||
36 | |||
37 | |||
38 | send -- "rm index.html\r" | ||
39 | sleep 1 | ||
40 | send -- "wget 0\r" | ||
41 | expect { | ||
42 | timeout {puts "TESTING ERROR 3\n";exit} | ||
43 | "saved" | ||
44 | } | ||
45 | send -- "cat index.html\r" | ||
46 | expect { | ||
47 | timeout {puts "TESTING ERROR 4\n";exit} | ||
48 | "Welcome to nginx" | ||
49 | } | ||
50 | |||
51 | sleep 1 | ||
52 | send -- "rm index.html\r" | ||
53 | |||
54 | send -- "firejail --join=nginx\r" | ||
55 | sleep 2 | ||
56 | |||
57 | send -- "ls /dev\r" | ||
58 | expect { | ||
59 | timeout {puts "TESTING ERROR 5\n";exit} | ||
60 | "tty0" {puts "TESTING ERROR 6\n";exit} | ||
61 | "ttyS0" {puts "TESTING ERROR 6\n";exit} | ||
62 | "audio" {puts "TESTING ERROR 6\n";exit} | ||
63 | "ppp" {puts "TESTING ERROR 6\n";exit} | ||
64 | "log" | ||
65 | } | ||
66 | sleep 2 | ||
67 | |||
68 | puts "\nall done\n" | ||
diff --git a/test/test-root.sh b/test/test-root.sh index 43bf84bfe..3c57532a3 100755 --- a/test/test-root.sh +++ b/test/test-root.sh | |||
@@ -35,6 +35,12 @@ then | |||
35 | ./servers5.exp | 35 | ./servers5.exp |
36 | fi | 36 | fi |
37 | 37 | ||
38 | if [ -f /etc/init.d/nginx ] | ||
39 | then | ||
40 | echo "TESTING: servers nginx, private-dev" | ||
41 | ./servers6.exp | ||
42 | fi | ||
43 | |||
38 | echo "TESTING: /proc/sysrq-trigger reset disabled" | 44 | echo "TESTING: /proc/sysrq-trigger reset disabled" |
39 | ./sysrq-trigger.exp | 45 | ./sysrq-trigger.exp |
40 | 46 | ||