diff options
Diffstat (limited to 'test')
-rwxr-xr-x | test/catchsignal-master.sh | 4 | ||||
-rwxr-xr-x | test/catchsignal.sh | 27 | ||||
-rwxr-xr-x | test/catchsignal2.sh | 49 | ||||
-rwxr-xr-x | test/option-shutdown2.exp | 42 | ||||
-rwxr-xr-x | test/option-shutdown3.exp | 62 | ||||
-rwxr-xr-x | test/option-shutdown4.exp | 66 | ||||
-rwxr-xr-x | test/pid.exp | 2 | ||||
-rwxr-xr-x | test/test.sh | 9 |
8 files changed, 260 insertions, 1 deletions
diff --git a/test/catchsignal-master.sh b/test/catchsignal-master.sh new file mode 100755 index 000000000..62a1801cc --- /dev/null +++ b/test/catchsignal-master.sh | |||
@@ -0,0 +1,4 @@ | |||
1 | #!/bin/bash | ||
2 | |||
3 | ./catchsignal.sh & | ||
4 | ./catchsignal.sh & | ||
diff --git a/test/catchsignal.sh b/test/catchsignal.sh new file mode 100755 index 000000000..87a1d0adf --- /dev/null +++ b/test/catchsignal.sh | |||
@@ -0,0 +1,27 @@ | |||
1 | #!/bin/bash | ||
2 | |||
3 | _term() { | ||
4 | echo "Caught Signal" | ||
5 | echo 1 | ||
6 | sleep 1 | ||
7 | echo 2 | ||
8 | sleep 1 | ||
9 | echo 3 | ||
10 | sleep 1 | ||
11 | echo 4 | ||
12 | sleep 1 | ||
13 | echo 5 | ||
14 | sleep 1 | ||
15 | |||
16 | kill $pid | ||
17 | exit | ||
18 | } | ||
19 | |||
20 | trap _term SIGTERM | ||
21 | trap _term SIGINT | ||
22 | |||
23 | echo "Sleeping..." | ||
24 | |||
25 | sleep inf & | ||
26 | pid=$! | ||
27 | wait $pid | ||
diff --git a/test/catchsignal2.sh b/test/catchsignal2.sh new file mode 100755 index 000000000..424350397 --- /dev/null +++ b/test/catchsignal2.sh | |||
@@ -0,0 +1,49 @@ | |||
1 | #!/bin/bash | ||
2 | |||
3 | _term() { | ||
4 | echo "Caught Signal" | ||
5 | echo 1 | ||
6 | sleep 1 | ||
7 | echo 2 | ||
8 | sleep 1 | ||
9 | echo 3 | ||
10 | sleep 1 | ||
11 | echo 4 | ||
12 | sleep 1 | ||
13 | echo 5 | ||
14 | sleep 1 | ||
15 | |||
16 | echo 10 | ||
17 | sleep 1 | ||
18 | echo 20 | ||
19 | sleep 1 | ||
20 | echo 30 | ||
21 | sleep 1 | ||
22 | echo 40 | ||
23 | sleep 1 | ||
24 | echo 50 | ||
25 | sleep 1 | ||
26 | |||
27 | echo 100 | ||
28 | sleep 1 | ||
29 | echo 200 | ||
30 | sleep 1 | ||
31 | echo 300 | ||
32 | sleep 1 | ||
33 | echo 400 | ||
34 | sleep 1 | ||
35 | echo 500 | ||
36 | sleep 1 | ||
37 | |||
38 | kill $pid | ||
39 | exit | ||
40 | } | ||
41 | |||
42 | trap _term SIGTERM | ||
43 | trap _term SIGINT | ||
44 | |||
45 | echo "Sleeping..." | ||
46 | |||
47 | sleep inf & | ||
48 | pid=$! | ||
49 | wait $pid | ||
diff --git a/test/option-shutdown2.exp b/test/option-shutdown2.exp new file mode 100755 index 000000000..403bc30be --- /dev/null +++ b/test/option-shutdown2.exp | |||
@@ -0,0 +1,42 @@ | |||
1 | #!/usr/bin/expect -f | ||
2 | |||
3 | set timeout 10 | ||
4 | spawn $env(SHELL) | ||
5 | match_max 100000 | ||
6 | |||
7 | set firstspawn $spawn_id | ||
8 | |||
9 | send -- "firejail --name=shutdowntesting ./catchsignal.sh\r" | ||
10 | expect { | ||
11 | timeout {puts "TESTING ERROR 0\n";exit} | ||
12 | "Child process initialized" | ||
13 | } | ||
14 | sleep 2 | ||
15 | |||
16 | spawn $env(SHELL) | ||
17 | send -- "firejail --shutdown=shutdowntesting\r" | ||
18 | |||
19 | set spawn_id $firstspawn | ||
20 | expect { | ||
21 | timeout {puts "TESTING ERROR 1\n";exit} | ||
22 | "1" | ||
23 | } | ||
24 | expect { | ||
25 | timeout {puts "TESTING ERROR 2\n";exit} | ||
26 | "2" | ||
27 | } | ||
28 | expect { | ||
29 | timeout {puts "TESTING ERROR 3\n";exit} | ||
30 | "3" | ||
31 | } | ||
32 | expect { | ||
33 | timeout {puts "TESTING ERROR 4\n";exit} | ||
34 | "4" | ||
35 | } | ||
36 | expect { | ||
37 | timeout {puts "TESTING ERROR 5\n";exit} | ||
38 | "5" | ||
39 | } | ||
40 | sleep 1 | ||
41 | |||
42 | puts "\nalldone\n" | ||
diff --git a/test/option-shutdown3.exp b/test/option-shutdown3.exp new file mode 100755 index 000000000..0ef371cd8 --- /dev/null +++ b/test/option-shutdown3.exp | |||
@@ -0,0 +1,62 @@ | |||
1 | #!/usr/bin/expect -f | ||
2 | |||
3 | set timeout 10 | ||
4 | spawn $env(SHELL) | ||
5 | match_max 100000 | ||
6 | |||
7 | set firstspawn $spawn_id | ||
8 | |||
9 | send -- "firejail --name=shutdowntesting ./catchsignal-master.sh\r" | ||
10 | expect { | ||
11 | timeout {puts "TESTING ERROR 0\n";exit} | ||
12 | "Child process initialized" | ||
13 | } | ||
14 | sleep 2 | ||
15 | |||
16 | spawn $env(SHELL) | ||
17 | send -- "firejail --shutdown=shutdowntesting\r" | ||
18 | |||
19 | set spawn_id $firstspawn | ||
20 | expect { | ||
21 | timeout {puts "TESTING ERROR 1\n";exit} | ||
22 | "1" | ||
23 | } | ||
24 | expect { | ||
25 | timeout {puts "TESTING ERROR 2\n";exit} | ||
26 | "1" | ||
27 | } | ||
28 | expect { | ||
29 | timeout {puts "TESTING ERROR 3\n";exit} | ||
30 | "2" | ||
31 | } | ||
32 | expect { | ||
33 | timeout {puts "TESTING ERROR 4\n";exit} | ||
34 | "2" | ||
35 | } | ||
36 | expect { | ||
37 | timeout {puts "TESTING ERROR 5\n";exit} | ||
38 | "3" | ||
39 | } | ||
40 | expect { | ||
41 | timeout {puts "TESTING ERROR 6\n";exit} | ||
42 | "3" | ||
43 | } | ||
44 | expect { | ||
45 | timeout {puts "TESTING ERROR 7\n";exit} | ||
46 | "4" | ||
47 | } | ||
48 | expect { | ||
49 | timeout {puts "TESTING ERROR 8\n";exit} | ||
50 | "4" | ||
51 | } | ||
52 | expect { | ||
53 | timeout {puts "TESTING ERROR 9\n";exit} | ||
54 | "5" | ||
55 | } | ||
56 | expect { | ||
57 | timeout {puts "TESTING ERROR 10\n";exit} | ||
58 | "5" | ||
59 | } | ||
60 | sleep 1 | ||
61 | |||
62 | puts "\nalldone\n" | ||
diff --git a/test/option-shutdown4.exp b/test/option-shutdown4.exp new file mode 100755 index 000000000..f188ec66d --- /dev/null +++ b/test/option-shutdown4.exp | |||
@@ -0,0 +1,66 @@ | |||
1 | #!/usr/bin/expect -f | ||
2 | |||
3 | set timeout 10 | ||
4 | spawn $env(SHELL) | ||
5 | match_max 100000 | ||
6 | |||
7 | set firstspawn $spawn_id | ||
8 | |||
9 | send -- "firejail --name=shutdowntesting ./catchsignal2.sh\r" | ||
10 | expect { | ||
11 | timeout {puts "TESTING ERROR 0\n";exit} | ||
12 | "Child process initialized" | ||
13 | } | ||
14 | sleep 2 | ||
15 | |||
16 | spawn $env(SHELL) | ||
17 | send -- "firejail --shutdown=shutdowntesting\r" | ||
18 | |||
19 | set spawn_id $firstspawn | ||
20 | expect { | ||
21 | timeout {puts "TESTING ERROR 1\n";exit} | ||
22 | "1" | ||
23 | } | ||
24 | expect { | ||
25 | timeout {puts "TESTING ERROR 2\n";exit} | ||
26 | "2" | ||
27 | } | ||
28 | expect { | ||
29 | timeout {puts "TESTING ERROR 3\n";exit} | ||
30 | "3" | ||
31 | } | ||
32 | expect { | ||
33 | timeout {puts "TESTING ERROR 4\n";exit} | ||
34 | "4" | ||
35 | } | ||
36 | expect { | ||
37 | timeout {puts "TESTING ERROR 5\n";exit} | ||
38 | "5" | ||
39 | } | ||
40 | expect { | ||
41 | timeout {puts "TESTING ERROR 10\n";exit} | ||
42 | "10" | ||
43 | } | ||
44 | expect { | ||
45 | timeout {puts "TESTING ERROR 20\n";exit} | ||
46 | "20" | ||
47 | } | ||
48 | expect { | ||
49 | timeout {puts "TESTING ERROR 30\n";exit} | ||
50 | "30" | ||
51 | } | ||
52 | expect { | ||
53 | timeout {puts "TESTING ERROR 40\n";exit} | ||
54 | "40" | ||
55 | } | ||
56 | expect { | ||
57 | timeout {puts "TESTING ERROR 50\n";exit} | ||
58 | "50" | ||
59 | } | ||
60 | expect { | ||
61 | timeout {puts "TESTING ERROR 60\n";exit} | ||
62 | "Killed" | ||
63 | } | ||
64 | sleep 1 | ||
65 | |||
66 | puts "\nalldone\n" | ||
diff --git a/test/pid.exp b/test/pid.exp index fb5b90f04..cdeb9d5fb 100755 --- a/test/pid.exp +++ b/test/pid.exp | |||
@@ -37,7 +37,7 @@ sleep 1 | |||
37 | send -- "ps aux |wc -l; pwd\r" | 37 | send -- "ps aux |wc -l; pwd\r" |
38 | expect { | 38 | expect { |
39 | timeout {puts "TESTING ERROR 5\n";exit} | 39 | timeout {puts "TESTING ERROR 5\n";exit} |
40 | "6" {puts "normal system\n'} | 40 | "6" {puts "normal system\n"} |
41 | "5" {puts "grsecurity\n"} | 41 | "5" {puts "grsecurity\n"} |
42 | } | 42 | } |
43 | expect { | 43 | expect { |
diff --git a/test/test.sh b/test/test.sh index 96ef8f423..c6fe4f299 100755 --- a/test/test.sh +++ b/test/test.sh | |||
@@ -133,6 +133,15 @@ echo "TESTING: rlimit (option_rlimit.exp)" | |||
133 | echo "TESTING: shutdown (option_shutdown.exp)" | 133 | echo "TESTING: shutdown (option_shutdown.exp)" |
134 | ./option-shutdown.exp | 134 | ./option-shutdown.exp |
135 | 135 | ||
136 | echo "TESTING: shutdown2 (option_shutdown2.exp)" | ||
137 | ./option-shutdown2.exp | ||
138 | |||
139 | echo "TESTING: shutdown3 (option_shutdown3.exp)" | ||
140 | ./option-shutdown3.exp | ||
141 | |||
142 | echo "TESTING: shutdown4 (option_shutdown4.exp)" | ||
143 | ./option-shutdown4.exp | ||
144 | |||
136 | echo "TESTING: join (option-join.exp)" | 145 | echo "TESTING: join (option-join.exp)" |
137 | ./option-join.exp | 146 | ./option-join.exp |
138 | 147 | ||