diff options
Diffstat (limited to 'test/utils')
-rwxr-xr-x | test/utils/catchsignal-master.sh | 4 | ||||
-rwxr-xr-x | test/utils/catchsignal.sh | 27 | ||||
-rwxr-xr-x | test/utils/catchsignal2.sh | 49 | ||||
-rwxr-xr-x | test/utils/join-profile.exp | 39 | ||||
-rwxr-xr-x | test/utils/join.exp | 42 | ||||
-rwxr-xr-x | test/utils/join2.exp | 42 | ||||
-rwxr-xr-x | test/utils/join3.exp | 42 | ||||
-rw-r--r-- | test/utils/name.profile | 1 | ||||
-rwxr-xr-x | test/utils/shutdown.exp | 33 | ||||
-rwxr-xr-x | test/utils/shutdown2.exp | 45 | ||||
-rwxr-xr-x | test/utils/shutdown3.exp | 65 | ||||
-rwxr-xr-x | test/utils/shutdown4.exp | 69 | ||||
-rwxr-xr-x | test/utils/utils.sh | 24 |
13 files changed, 482 insertions, 0 deletions
diff --git a/test/utils/catchsignal-master.sh b/test/utils/catchsignal-master.sh new file mode 100755 index 000000000..62a1801cc --- /dev/null +++ b/test/utils/catchsignal-master.sh | |||
@@ -0,0 +1,4 @@ | |||
1 | #!/bin/bash | ||
2 | |||
3 | ./catchsignal.sh & | ||
4 | ./catchsignal.sh & | ||
diff --git a/test/utils/catchsignal.sh b/test/utils/catchsignal.sh new file mode 100755 index 000000000..87a1d0adf --- /dev/null +++ b/test/utils/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/utils/catchsignal2.sh b/test/utils/catchsignal2.sh new file mode 100755 index 000000000..424350397 --- /dev/null +++ b/test/utils/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/utils/join-profile.exp b/test/utils/join-profile.exp new file mode 100755 index 000000000..9200980a1 --- /dev/null +++ b/test/utils/join-profile.exp | |||
@@ -0,0 +1,39 @@ | |||
1 | #!/usr/bin/expect -f | ||
2 | |||
3 | set timeout 10 | ||
4 | spawn $env(SHELL) | ||
5 | match_max 100000 | ||
6 | |||
7 | send -- "firejail --profile=name.profile\r" | ||
8 | expect { | ||
9 | timeout {puts "TESTING ERROR 0\n";exit} | ||
10 | "Child process initialized" | ||
11 | } | ||
12 | sleep 3 | ||
13 | |||
14 | spawn $env(SHELL) | ||
15 | send -- "firejail --join=jointesting;pwd\r" | ||
16 | expect { | ||
17 | timeout {puts "TESTING ERROR 1\n";exit} | ||
18 | "Switching to pid" | ||
19 | } | ||
20 | sleep 3 | ||
21 | |||
22 | |||
23 | spawn $env(SHELL) | ||
24 | send -- "firejail --shutdown=jointesting;pwd\r" | ||
25 | expect { | ||
26 | timeout {puts "TESTING ERROR 3\n";exit} | ||
27 | "home" | ||
28 | } | ||
29 | sleep 5 | ||
30 | |||
31 | send -- "firejail --list;pwd\r" | ||
32 | expect { | ||
33 | timeout {puts "TESTING ERROR 4\n";exit} | ||
34 | "jointesting" {puts "TESTING ERROR 5\n";exit} | ||
35 | "home" | ||
36 | } | ||
37 | sleep 1 | ||
38 | |||
39 | puts "\nall done\n" | ||
diff --git a/test/utils/join.exp b/test/utils/join.exp new file mode 100755 index 000000000..fc94a22c3 --- /dev/null +++ b/test/utils/join.exp | |||
@@ -0,0 +1,42 @@ | |||
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 | spawn $env(SHELL) | ||
8 | match_max 100000 | ||
9 | |||
10 | send -- "firejail --name=svntesting\r" | ||
11 | expect { | ||
12 | timeout {puts "TESTING ERROR 0\n";exit} | ||
13 | "Child process initialized" | ||
14 | } | ||
15 | sleep 3 | ||
16 | |||
17 | spawn $env(SHELL) | ||
18 | send -- "firejail --join=svntesting;pwd\r" | ||
19 | expect { | ||
20 | timeout {puts "TESTING ERROR 1\n";exit} | ||
21 | "Switching to pid" | ||
22 | } | ||
23 | sleep 1 | ||
24 | |||
25 | |||
26 | spawn $env(SHELL) | ||
27 | send -- "firejail --shutdown=svntesting;pwd\r" | ||
28 | expect { | ||
29 | timeout {puts "TESTING ERROR 3\n";exit} | ||
30 | "home" | ||
31 | } | ||
32 | sleep 1 | ||
33 | |||
34 | send -- "firejail --list;pwd\r" | ||
35 | expect { | ||
36 | timeout {puts "TESTING ERROR 4\n";exit} | ||
37 | "svntesting" {puts "TESTING ERROR 5\n";exit} | ||
38 | "home" | ||
39 | } | ||
40 | sleep 1 | ||
41 | |||
42 | puts "\nall done\n" | ||
diff --git a/test/utils/join2.exp b/test/utils/join2.exp new file mode 100755 index 000000000..749e8900f --- /dev/null +++ b/test/utils/join2.exp | |||
@@ -0,0 +1,42 @@ | |||
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 | spawn $env(SHELL) | ||
8 | match_max 100000 | ||
9 | |||
10 | send -- "firejail --name=\"svn testing\"\r" | ||
11 | expect { | ||
12 | timeout {puts "TESTING ERROR 0\n";exit} | ||
13 | "Child process initialized" | ||
14 | } | ||
15 | sleep 3 | ||
16 | |||
17 | spawn $env(SHELL) | ||
18 | send -- "firejail --join=\"svn testing\";pwd\r" | ||
19 | expect { | ||
20 | timeout {puts "TESTING ERROR 1\n";exit} | ||
21 | "Switching to pid" | ||
22 | } | ||
23 | sleep 1 | ||
24 | |||
25 | |||
26 | spawn $env(SHELL) | ||
27 | send -- "firejail --shutdown=\"svn testing\";pwd\r" | ||
28 | expect { | ||
29 | timeout {puts "TESTING ERROR 3\n";exit} | ||
30 | "home" | ||
31 | } | ||
32 | sleep 1 | ||
33 | |||
34 | send -- "firejail --list;pwd\r" | ||
35 | expect { | ||
36 | timeout {puts "TESTING ERROR 4\n";exit} | ||
37 | "svn testing" {puts "TESTING ERROR 5\n";exit} | ||
38 | "home" | ||
39 | } | ||
40 | sleep 1 | ||
41 | |||
42 | puts "\nall done\n" | ||
diff --git a/test/utils/join3.exp b/test/utils/join3.exp new file mode 100755 index 000000000..0a686bc36 --- /dev/null +++ b/test/utils/join3.exp | |||
@@ -0,0 +1,42 @@ | |||
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 | spawn $env(SHELL) | ||
8 | match_max 100000 | ||
9 | |||
10 | send -- "firejail --name=svn\\ testing\r" | ||
11 | expect { | ||
12 | timeout {puts "TESTING ERROR 0\n";exit} | ||
13 | "Child process initialized" | ||
14 | } | ||
15 | sleep 3 | ||
16 | |||
17 | spawn $env(SHELL) | ||
18 | send -- "firejail --join=svn\\ testing;pwd\r" | ||
19 | expect { | ||
20 | timeout {puts "TESTING ERROR 1\n";exit} | ||
21 | "Switching to pid" | ||
22 | } | ||
23 | sleep 1 | ||
24 | |||
25 | |||
26 | spawn $env(SHELL) | ||
27 | send -- "firejail --shutdown=svn\\ testing;pwd\r" | ||
28 | expect { | ||
29 | timeout {puts "TESTING ERROR 3\n";exit} | ||
30 | "home" | ||
31 | } | ||
32 | sleep 1 | ||
33 | |||
34 | send -- "firejail --list;pwd\r" | ||
35 | expect { | ||
36 | timeout {puts "TESTING ERROR 4\n";exit} | ||
37 | "svn testing" {puts "TESTING ERROR 5\n";exit} | ||
38 | "home" | ||
39 | } | ||
40 | sleep 1 | ||
41 | |||
42 | puts "\nall done\n" | ||
diff --git a/test/utils/name.profile b/test/utils/name.profile new file mode 100644 index 000000000..1aa9f2d64 --- /dev/null +++ b/test/utils/name.profile | |||
@@ -0,0 +1 @@ | |||
name jointesting | |||
diff --git a/test/utils/shutdown.exp b/test/utils/shutdown.exp new file mode 100755 index 000000000..135f42d28 --- /dev/null +++ b/test/utils/shutdown.exp | |||
@@ -0,0 +1,33 @@ | |||
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 | spawn $env(SHELL) | ||
8 | match_max 100000 | ||
9 | |||
10 | send -- "firejail --name=shutdowntesting\r" | ||
11 | expect { | ||
12 | timeout {puts "TESTING ERROR 0\n";exit} | ||
13 | "Child process initialized" | ||
14 | } | ||
15 | sleep 3 | ||
16 | |||
17 | spawn $env(SHELL) | ||
18 | send -- "firejail --shutdown=shutdowntesting;pwd\r" | ||
19 | expect { | ||
20 | timeout {puts "TESTING ERROR 4\n";exit} | ||
21 | "home" | ||
22 | } | ||
23 | sleep 1 | ||
24 | |||
25 | send -- "firejail --list;pwd\r" | ||
26 | expect { | ||
27 | timeout {puts "TESTING ERROR 5\n";exit} | ||
28 | "shutdowntesting" {puts "TESTING ERROR 6\n";exit} | ||
29 | "home" | ||
30 | } | ||
31 | sleep 1 | ||
32 | |||
33 | puts "\nalldone\n" | ||
diff --git a/test/utils/shutdown2.exp b/test/utils/shutdown2.exp new file mode 100755 index 000000000..7857b919c --- /dev/null +++ b/test/utils/shutdown2.exp | |||
@@ -0,0 +1,45 @@ | |||
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 | spawn $env(SHELL) | ||
8 | match_max 100000 | ||
9 | |||
10 | set firstspawn $spawn_id | ||
11 | |||
12 | send -- "firejail --name=shutdowntesting ./catchsignal.sh\r" | ||
13 | expect { | ||
14 | timeout {puts "TESTING ERROR 0\n";exit} | ||
15 | "Child process initialized" | ||
16 | } | ||
17 | sleep 2 | ||
18 | |||
19 | spawn $env(SHELL) | ||
20 | send -- "firejail --shutdown=shutdowntesting\r" | ||
21 | |||
22 | set spawn_id $firstspawn | ||
23 | expect { | ||
24 | timeout {puts "TESTING ERROR 1\n";exit} | ||
25 | "1" | ||
26 | } | ||
27 | expect { | ||
28 | timeout {puts "TESTING ERROR 2\n";exit} | ||
29 | "2" | ||
30 | } | ||
31 | expect { | ||
32 | timeout {puts "TESTING ERROR 3\n";exit} | ||
33 | "3" | ||
34 | } | ||
35 | expect { | ||
36 | timeout {puts "TESTING ERROR 4\n";exit} | ||
37 | "4" | ||
38 | } | ||
39 | expect { | ||
40 | timeout {puts "TESTING ERROR 5\n";exit} | ||
41 | "5" | ||
42 | } | ||
43 | sleep 1 | ||
44 | |||
45 | puts "\nalldone\n" | ||
diff --git a/test/utils/shutdown3.exp b/test/utils/shutdown3.exp new file mode 100755 index 000000000..02b68c4ce --- /dev/null +++ b/test/utils/shutdown3.exp | |||
@@ -0,0 +1,65 @@ | |||
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 | spawn $env(SHELL) | ||
8 | match_max 100000 | ||
9 | |||
10 | set firstspawn $spawn_id | ||
11 | |||
12 | send -- "firejail --name=shutdowntesting ./catchsignal-master.sh\r" | ||
13 | expect { | ||
14 | timeout {puts "TESTING ERROR 0\n";exit} | ||
15 | "Child process initialized" | ||
16 | } | ||
17 | sleep 2 | ||
18 | |||
19 | spawn $env(SHELL) | ||
20 | send -- "firejail --shutdown=shutdowntesting\r" | ||
21 | |||
22 | set spawn_id $firstspawn | ||
23 | expect { | ||
24 | timeout {puts "TESTING ERROR 1\n";exit} | ||
25 | "1" | ||
26 | } | ||
27 | expect { | ||
28 | timeout {puts "TESTING ERROR 2\n";exit} | ||
29 | "1" | ||
30 | } | ||
31 | expect { | ||
32 | timeout {puts "TESTING ERROR 3\n";exit} | ||
33 | "2" | ||
34 | } | ||
35 | expect { | ||
36 | timeout {puts "TESTING ERROR 4\n";exit} | ||
37 | "2" | ||
38 | } | ||
39 | expect { | ||
40 | timeout {puts "TESTING ERROR 5\n";exit} | ||
41 | "3" | ||
42 | } | ||
43 | expect { | ||
44 | timeout {puts "TESTING ERROR 6\n";exit} | ||
45 | "3" | ||
46 | } | ||
47 | expect { | ||
48 | timeout {puts "TESTING ERROR 7\n";exit} | ||
49 | "4" | ||
50 | } | ||
51 | expect { | ||
52 | timeout {puts "TESTING ERROR 8\n";exit} | ||
53 | "4" | ||
54 | } | ||
55 | expect { | ||
56 | timeout {puts "TESTING ERROR 9\n";exit} | ||
57 | "5" | ||
58 | } | ||
59 | expect { | ||
60 | timeout {puts "TESTING ERROR 10\n";exit} | ||
61 | "5" | ||
62 | } | ||
63 | sleep 1 | ||
64 | |||
65 | puts "\nalldone\n" | ||
diff --git a/test/utils/shutdown4.exp b/test/utils/shutdown4.exp new file mode 100755 index 000000000..613f3fbc8 --- /dev/null +++ b/test/utils/shutdown4.exp | |||
@@ -0,0 +1,69 @@ | |||
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 | spawn $env(SHELL) | ||
8 | match_max 100000 | ||
9 | |||
10 | set firstspawn $spawn_id | ||
11 | |||
12 | send -- "firejail --name=shutdowntesting ./catchsignal2.sh\r" | ||
13 | expect { | ||
14 | timeout {puts "TESTING ERROR 0\n";exit} | ||
15 | "Child process initialized" | ||
16 | } | ||
17 | sleep 2 | ||
18 | |||
19 | spawn $env(SHELL) | ||
20 | send -- "firejail --shutdown=shutdowntesting\r" | ||
21 | |||
22 | set spawn_id $firstspawn | ||
23 | expect { | ||
24 | timeout {puts "TESTING ERROR 1\n";exit} | ||
25 | "1" | ||
26 | } | ||
27 | expect { | ||
28 | timeout {puts "TESTING ERROR 2\n";exit} | ||
29 | "2" | ||
30 | } | ||
31 | expect { | ||
32 | timeout {puts "TESTING ERROR 3\n";exit} | ||
33 | "3" | ||
34 | } | ||
35 | expect { | ||
36 | timeout {puts "TESTING ERROR 4\n";exit} | ||
37 | "4" | ||
38 | } | ||
39 | expect { | ||
40 | timeout {puts "TESTING ERROR 5\n";exit} | ||
41 | "5" | ||
42 | } | ||
43 | expect { | ||
44 | timeout {puts "TESTING ERROR 10\n";exit} | ||
45 | "10" | ||
46 | } | ||
47 | expect { | ||
48 | timeout {puts "TESTING ERROR 20\n";exit} | ||
49 | "20" | ||
50 | } | ||
51 | expect { | ||
52 | timeout {puts "TESTING ERROR 30\n";exit} | ||
53 | "30" | ||
54 | } | ||
55 | expect { | ||
56 | timeout {puts "TESTING ERROR 40\n";exit} | ||
57 | "40" | ||
58 | } | ||
59 | expect { | ||
60 | timeout {puts "TESTING ERROR 50\n";exit} | ||
61 | "50" | ||
62 | } | ||
63 | expect { | ||
64 | timeout {puts "TESTING ERROR 60\n";exit} | ||
65 | "Killed" | ||
66 | } | ||
67 | sleep 1 | ||
68 | |||
69 | puts "\nalldone\n" | ||
diff --git a/test/utils/utils.sh b/test/utils/utils.sh index 02aaa57c0..a40845a5f 100755 --- a/test/utils/utils.sh +++ b/test/utils/utils.sh | |||
@@ -40,3 +40,27 @@ echo "TESTING: seccomp.print (test/utils/seccomp-print.exp)" | |||
40 | echo "TESTING: protocol.print (test/utils/protocol-print.exp)" | 40 | echo "TESTING: protocol.print (test/utils/protocol-print.exp)" |
41 | ./protocol-print.exp | 41 | ./protocol-print.exp |
42 | 42 | ||
43 | echo "TESTING: shutdown (test/utils/shutdown.exp)" | ||
44 | ./shutdown.exp | ||
45 | |||
46 | echo "TESTING: shutdown2 (test/utils/shutdown2.exp)" | ||
47 | ./shutdown2.exp | ||
48 | |||
49 | echo "TESTING: shutdown3 (test/utils/shutdown3.exp)" | ||
50 | ./shutdown3.exp | ||
51 | |||
52 | echo "TESTING: shutdown4 (test/utils/shutdown4.exp)" | ||
53 | ./shutdown4.exp | ||
54 | |||
55 | echo "TESTING: join test/utils/(join.exp)" | ||
56 | ./join.exp | ||
57 | |||
58 | echo "TESTING: join2 test/utils/(join2.exp)" | ||
59 | .join2.exp | ||
60 | |||
61 | echo "TESTING: join3 (test/utils/join3.exp)" | ||
62 | ./join3.exp | ||
63 | |||
64 | echo "TESTING: join profile (test/utils/join-profile.exp)" | ||
65 | ./join-profile.exp | ||
66 | |||