aboutsummaryrefslogtreecommitdiffstats
path: root/test/utils
diff options
context:
space:
mode:
authorLibravatar netblue30 <netblue30@yahoo.com>2016-04-23 20:35:52 -0400
committerLibravatar netblue30 <netblue30@yahoo.com>2016-04-23 20:35:52 -0400
commitc729d5927d5db964e71bfe30a269acf26786fef7 (patch)
tree192c74fa0dae843fd2b59044df6e0c78925f424a /test/utils
parentmake testing (diff)
downloadfirejail-c729d5927d5db964e71bfe30a269acf26786fef7.tar.gz
firejail-c729d5927d5db964e71bfe30a269acf26786fef7.tar.zst
firejail-c729d5927d5db964e71bfe30a269acf26786fef7.zip
testing
Diffstat (limited to 'test/utils')
-rwxr-xr-xtest/utils/catchsignal-master.sh4
-rwxr-xr-xtest/utils/catchsignal.sh27
-rwxr-xr-xtest/utils/catchsignal2.sh49
-rwxr-xr-xtest/utils/join-profile.exp39
-rwxr-xr-xtest/utils/join.exp42
-rwxr-xr-xtest/utils/join2.exp42
-rwxr-xr-xtest/utils/join3.exp42
-rw-r--r--test/utils/name.profile1
-rwxr-xr-xtest/utils/shutdown.exp33
-rwxr-xr-xtest/utils/shutdown2.exp45
-rwxr-xr-xtest/utils/shutdown3.exp65
-rwxr-xr-xtest/utils/shutdown4.exp69
-rwxr-xr-xtest/utils/utils.sh24
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
20trap _term SIGTERM
21trap _term SIGINT
22
23echo "Sleeping..."
24
25sleep inf &
26pid=$!
27wait $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
42trap _term SIGTERM
43trap _term SIGINT
44
45echo "Sleeping..."
46
47sleep inf &
48pid=$!
49wait $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
3set timeout 10
4spawn $env(SHELL)
5match_max 100000
6
7send -- "firejail --profile=name.profile\r"
8expect {
9 timeout {puts "TESTING ERROR 0\n";exit}
10 "Child process initialized"
11}
12sleep 3
13
14spawn $env(SHELL)
15send -- "firejail --join=jointesting;pwd\r"
16expect {
17 timeout {puts "TESTING ERROR 1\n";exit}
18 "Switching to pid"
19}
20sleep 3
21
22
23spawn $env(SHELL)
24send -- "firejail --shutdown=jointesting;pwd\r"
25expect {
26 timeout {puts "TESTING ERROR 3\n";exit}
27 "home"
28}
29sleep 5
30
31send -- "firejail --list;pwd\r"
32expect {
33 timeout {puts "TESTING ERROR 4\n";exit}
34 "jointesting" {puts "TESTING ERROR 5\n";exit}
35 "home"
36}
37sleep 1
38
39puts "\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
6set timeout 10
7spawn $env(SHELL)
8match_max 100000
9
10send -- "firejail --name=svntesting\r"
11expect {
12 timeout {puts "TESTING ERROR 0\n";exit}
13 "Child process initialized"
14}
15sleep 3
16
17spawn $env(SHELL)
18send -- "firejail --join=svntesting;pwd\r"
19expect {
20 timeout {puts "TESTING ERROR 1\n";exit}
21 "Switching to pid"
22}
23sleep 1
24
25
26spawn $env(SHELL)
27send -- "firejail --shutdown=svntesting;pwd\r"
28expect {
29 timeout {puts "TESTING ERROR 3\n";exit}
30 "home"
31}
32sleep 1
33
34send -- "firejail --list;pwd\r"
35expect {
36 timeout {puts "TESTING ERROR 4\n";exit}
37 "svntesting" {puts "TESTING ERROR 5\n";exit}
38 "home"
39}
40sleep 1
41
42puts "\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
6set timeout 10
7spawn $env(SHELL)
8match_max 100000
9
10send -- "firejail --name=\"svn testing\"\r"
11expect {
12 timeout {puts "TESTING ERROR 0\n";exit}
13 "Child process initialized"
14}
15sleep 3
16
17spawn $env(SHELL)
18send -- "firejail --join=\"svn testing\";pwd\r"
19expect {
20 timeout {puts "TESTING ERROR 1\n";exit}
21 "Switching to pid"
22}
23sleep 1
24
25
26spawn $env(SHELL)
27send -- "firejail --shutdown=\"svn testing\";pwd\r"
28expect {
29 timeout {puts "TESTING ERROR 3\n";exit}
30 "home"
31}
32sleep 1
33
34send -- "firejail --list;pwd\r"
35expect {
36 timeout {puts "TESTING ERROR 4\n";exit}
37 "svn testing" {puts "TESTING ERROR 5\n";exit}
38 "home"
39}
40sleep 1
41
42puts "\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
6set timeout 10
7spawn $env(SHELL)
8match_max 100000
9
10send -- "firejail --name=svn\\ testing\r"
11expect {
12 timeout {puts "TESTING ERROR 0\n";exit}
13 "Child process initialized"
14}
15sleep 3
16
17spawn $env(SHELL)
18send -- "firejail --join=svn\\ testing;pwd\r"
19expect {
20 timeout {puts "TESTING ERROR 1\n";exit}
21 "Switching to pid"
22}
23sleep 1
24
25
26spawn $env(SHELL)
27send -- "firejail --shutdown=svn\\ testing;pwd\r"
28expect {
29 timeout {puts "TESTING ERROR 3\n";exit}
30 "home"
31}
32sleep 1
33
34send -- "firejail --list;pwd\r"
35expect {
36 timeout {puts "TESTING ERROR 4\n";exit}
37 "svn testing" {puts "TESTING ERROR 5\n";exit}
38 "home"
39}
40sleep 1
41
42puts "\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
6set timeout 10
7spawn $env(SHELL)
8match_max 100000
9
10send -- "firejail --name=shutdowntesting\r"
11expect {
12 timeout {puts "TESTING ERROR 0\n";exit}
13 "Child process initialized"
14}
15sleep 3
16
17spawn $env(SHELL)
18send -- "firejail --shutdown=shutdowntesting;pwd\r"
19expect {
20 timeout {puts "TESTING ERROR 4\n";exit}
21 "home"
22}
23sleep 1
24
25send -- "firejail --list;pwd\r"
26expect {
27 timeout {puts "TESTING ERROR 5\n";exit}
28 "shutdowntesting" {puts "TESTING ERROR 6\n";exit}
29 "home"
30}
31sleep 1
32
33puts "\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
6set timeout 10
7spawn $env(SHELL)
8match_max 100000
9
10set firstspawn $spawn_id
11
12send -- "firejail --name=shutdowntesting ./catchsignal.sh\r"
13expect {
14 timeout {puts "TESTING ERROR 0\n";exit}
15 "Child process initialized"
16}
17sleep 2
18
19spawn $env(SHELL)
20send -- "firejail --shutdown=shutdowntesting\r"
21
22set spawn_id $firstspawn
23expect {
24 timeout {puts "TESTING ERROR 1\n";exit}
25 "1"
26}
27expect {
28 timeout {puts "TESTING ERROR 2\n";exit}
29 "2"
30}
31expect {
32 timeout {puts "TESTING ERROR 3\n";exit}
33 "3"
34}
35expect {
36 timeout {puts "TESTING ERROR 4\n";exit}
37 "4"
38}
39expect {
40 timeout {puts "TESTING ERROR 5\n";exit}
41 "5"
42}
43sleep 1
44
45puts "\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
6set timeout 10
7spawn $env(SHELL)
8match_max 100000
9
10set firstspawn $spawn_id
11
12send -- "firejail --name=shutdowntesting ./catchsignal-master.sh\r"
13expect {
14 timeout {puts "TESTING ERROR 0\n";exit}
15 "Child process initialized"
16}
17sleep 2
18
19spawn $env(SHELL)
20send -- "firejail --shutdown=shutdowntesting\r"
21
22set spawn_id $firstspawn
23expect {
24 timeout {puts "TESTING ERROR 1\n";exit}
25 "1"
26}
27expect {
28 timeout {puts "TESTING ERROR 2\n";exit}
29 "1"
30}
31expect {
32 timeout {puts "TESTING ERROR 3\n";exit}
33 "2"
34}
35expect {
36 timeout {puts "TESTING ERROR 4\n";exit}
37 "2"
38}
39expect {
40 timeout {puts "TESTING ERROR 5\n";exit}
41 "3"
42}
43expect {
44 timeout {puts "TESTING ERROR 6\n";exit}
45 "3"
46}
47expect {
48 timeout {puts "TESTING ERROR 7\n";exit}
49 "4"
50}
51expect {
52 timeout {puts "TESTING ERROR 8\n";exit}
53 "4"
54}
55expect {
56 timeout {puts "TESTING ERROR 9\n";exit}
57 "5"
58}
59expect {
60 timeout {puts "TESTING ERROR 10\n";exit}
61 "5"
62}
63sleep 1
64
65puts "\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
6set timeout 10
7spawn $env(SHELL)
8match_max 100000
9
10set firstspawn $spawn_id
11
12send -- "firejail --name=shutdowntesting ./catchsignal2.sh\r"
13expect {
14 timeout {puts "TESTING ERROR 0\n";exit}
15 "Child process initialized"
16}
17sleep 2
18
19spawn $env(SHELL)
20send -- "firejail --shutdown=shutdowntesting\r"
21
22set spawn_id $firstspawn
23expect {
24 timeout {puts "TESTING ERROR 1\n";exit}
25 "1"
26}
27expect {
28 timeout {puts "TESTING ERROR 2\n";exit}
29 "2"
30}
31expect {
32 timeout {puts "TESTING ERROR 3\n";exit}
33 "3"
34}
35expect {
36 timeout {puts "TESTING ERROR 4\n";exit}
37 "4"
38}
39expect {
40 timeout {puts "TESTING ERROR 5\n";exit}
41 "5"
42}
43expect {
44 timeout {puts "TESTING ERROR 10\n";exit}
45 "10"
46}
47expect {
48 timeout {puts "TESTING ERROR 20\n";exit}
49 "20"
50}
51expect {
52 timeout {puts "TESTING ERROR 30\n";exit}
53 "30"
54}
55expect {
56 timeout {puts "TESTING ERROR 40\n";exit}
57 "40"
58}
59expect {
60 timeout {puts "TESTING ERROR 50\n";exit}
61 "50"
62}
63expect {
64 timeout {puts "TESTING ERROR 60\n";exit}
65 "Killed"
66}
67sleep 1
68
69puts "\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)"
40echo "TESTING: protocol.print (test/utils/protocol-print.exp)" 40echo "TESTING: protocol.print (test/utils/protocol-print.exp)"
41./protocol-print.exp 41./protocol-print.exp
42 42
43echo "TESTING: shutdown (test/utils/shutdown.exp)"
44./shutdown.exp
45
46echo "TESTING: shutdown2 (test/utils/shutdown2.exp)"
47./shutdown2.exp
48
49echo "TESTING: shutdown3 (test/utils/shutdown3.exp)"
50./shutdown3.exp
51
52echo "TESTING: shutdown4 (test/utils/shutdown4.exp)"
53./shutdown4.exp
54
55echo "TESTING: join test/utils/(join.exp)"
56./join.exp
57
58echo "TESTING: join2 test/utils/(join2.exp)"
59.join2.exp
60
61echo "TESTING: join3 (test/utils/join3.exp)"
62./join3.exp
63
64echo "TESTING: join profile (test/utils/join-profile.exp)"
65./join-profile.exp
66