diff options
Diffstat (limited to 'test')
-rwxr-xr-x | test/features/3.7.exp | 91 | ||||
-rwxr-xr-x | test/features/3.8.exp | 79 | ||||
-rw-r--r-- | test/features/features.txt | 7 | ||||
-rwxr-xr-x | test/features/test.sh | 7 |
4 files changed, 182 insertions, 2 deletions
diff --git a/test/features/3.7.exp b/test/features/3.7.exp new file mode 100755 index 000000000..d8236b851 --- /dev/null +++ b/test/features/3.7.exp | |||
@@ -0,0 +1,91 @@ | |||
1 | #!/usr/bin/expect -f | ||
2 | # | ||
3 | # private-tmp | ||
4 | # | ||
5 | |||
6 | set timeout 10 | ||
7 | spawn $env(SHELL) | ||
8 | match_max 100000 | ||
9 | set overlay [lindex $argv 0] | ||
10 | set chroot [lindex $argv 1] | ||
11 | |||
12 | # | ||
13 | # N | ||
14 | # | ||
15 | send -- "touch /tmp/test1\r" | ||
16 | sleep 1 | ||
17 | send -- "touch /tmp/test2\r" | ||
18 | sleep 1 | ||
19 | send -- "firejail --noprofile --private-tmp\r" | ||
20 | expect { | ||
21 | timeout {puts "TESTING ERROR 0\n";exit} | ||
22 | "Child process initialized" | ||
23 | } | ||
24 | sleep 1 | ||
25 | |||
26 | send -- "ls -al /tmp | wc -l\r" | ||
27 | expect { | ||
28 | timeout {puts "TESTING ERROR 1.1\n";exit} | ||
29 | "3" | ||
30 | } | ||
31 | |||
32 | |||
33 | after 100 | ||
34 | send -- "exit\r" | ||
35 | sleep 1 | ||
36 | |||
37 | # | ||
38 | # O | ||
39 | # | ||
40 | if { $overlay == "overlay" } { | ||
41 | send -- "touch /tmp/test1\r" | ||
42 | sleep 1 | ||
43 | send -- "touch /tmp/test2\r" | ||
44 | sleep 1 | ||
45 | send -- "firejail --noprofile --overlay --private-tmp\r" | ||
46 | expect { | ||
47 | timeout {puts "TESTING ERROR 2\n";exit} | ||
48 | "Child process initialized" | ||
49 | } | ||
50 | sleep 1 | ||
51 | |||
52 | send -- "ls -al /tmp | wc -l\r" | ||
53 | expect { | ||
54 | timeout {puts "TESTING ERROR 3.1\n";exit} | ||
55 | "3" | ||
56 | } | ||
57 | |||
58 | |||
59 | after 100 | ||
60 | send -- "exit\r" | ||
61 | sleep 1 | ||
62 | } | ||
63 | |||
64 | # | ||
65 | # C | ||
66 | # | ||
67 | if { $chroot == "chroot" } { | ||
68 | send -- "touch /tmp/test1\r" | ||
69 | sleep 1 | ||
70 | send -- "touch /tmp/test2\r" | ||
71 | sleep 1 | ||
72 | send -- "firejail --noprofile --chroot=/tmp/chroot --private-tmp\r" | ||
73 | expect { | ||
74 | timeout {puts "TESTING ERROR 4\n";exit} | ||
75 | "Child process initialized" | ||
76 | } | ||
77 | sleep 1 | ||
78 | |||
79 | send -- "ls -al /tmp | wc -l\r" | ||
80 | expect { | ||
81 | timeout {puts "TESTING ERROR 5.1\n";exit} | ||
82 | "3" | ||
83 | } | ||
84 | |||
85 | after 100 | ||
86 | send -- "exit\r" | ||
87 | sleep 1 | ||
88 | } | ||
89 | |||
90 | |||
91 | puts "\nall done\n" | ||
diff --git a/test/features/3.8.exp b/test/features/3.8.exp new file mode 100755 index 000000000..72953d159 --- /dev/null +++ b/test/features/3.8.exp | |||
@@ -0,0 +1,79 @@ | |||
1 | #!/usr/bin/expect -f | ||
2 | # | ||
3 | # private-bin | ||
4 | # | ||
5 | |||
6 | set timeout 10 | ||
7 | spawn $env(SHELL) | ||
8 | match_max 100000 | ||
9 | set overlay [lindex $argv 0] | ||
10 | set chroot [lindex $argv 1] | ||
11 | |||
12 | # | ||
13 | # N | ||
14 | # | ||
15 | send -- "firejail --noprofile --private-bin=bash,cat,cp,ls,wc\r" | ||
16 | expect { | ||
17 | timeout {puts "TESTING ERROR 0\n";exit} | ||
18 | "Child process initialized" | ||
19 | } | ||
20 | sleep 1 | ||
21 | |||
22 | send -- "ls -l /bin | wc -l\r" | ||
23 | expect { | ||
24 | timeout {puts "TESTING ERROR 1.1\n";exit} | ||
25 | "6" | ||
26 | } | ||
27 | |||
28 | |||
29 | after 100 | ||
30 | send -- "exit\r" | ||
31 | sleep 1 | ||
32 | |||
33 | # | ||
34 | # O | ||
35 | # | ||
36 | if { $overlay == "overlay" } { | ||
37 | send -- "firejail --noprofile --overlay --private-bin=bash,cat,cp,ls,wc\r" | ||
38 | expect { | ||
39 | timeout {puts "TESTING ERROR 2\n";exit} | ||
40 | "Child process initialized" | ||
41 | } | ||
42 | sleep 1 | ||
43 | |||
44 | send -- "ls -l /bin | wc -l\r" | ||
45 | expect { | ||
46 | timeout {puts "TESTING ERROR 3.1\n";exit} | ||
47 | "6" | ||
48 | } | ||
49 | |||
50 | |||
51 | after 100 | ||
52 | send -- "exit\r" | ||
53 | sleep 1 | ||
54 | } | ||
55 | |||
56 | # | ||
57 | # C | ||
58 | # | ||
59 | if { $chroot == "chroot" } { | ||
60 | send -- "firejail --noprofile --chroot=/tmp/chroot --private-bin=bash,cat,cp,ls,wc\r" | ||
61 | expect { | ||
62 | timeout {puts "TESTING ERROR 4\n";exit} | ||
63 | "Child process initialized" | ||
64 | } | ||
65 | sleep 1 | ||
66 | |||
67 | send -- "ls -l /bin | wc -l\r" | ||
68 | expect { | ||
69 | timeout {puts "TESTING ERROR 5.1\n";exit} | ||
70 | "6" | ||
71 | } | ||
72 | |||
73 | after 100 | ||
74 | send -- "exit\r" | ||
75 | sleep 1 | ||
76 | } | ||
77 | |||
78 | |||
79 | puts "\nall done\n" | ||
diff --git a/test/features/features.txt b/test/features/features.txt index 0c41090aa..ac5390bc9 100644 --- a/test/features/features.txt +++ b/test/features/features.txt | |||
@@ -46,6 +46,11 @@ C - chroot filesystem | |||
46 | 3.5 private-dev | 46 | 3.5 private-dev |
47 | - O, C - somehow /dev/log is missing | 47 | - O, C - somehow /dev/log is missing |
48 | 3.6 private-etc | 48 | 3.6 private-etc |
49 | - O not working | 49 | - O not working - todo |
50 | 3.7 private-tmp | ||
51 | 3.8 private-bin | ||
52 | - O, C not working - todo | ||
53 | |||
54 | |||
50 | 55 | ||
51 | \ No newline at end of file | 56 | \ No newline at end of file |
diff --git a/test/features/test.sh b/test/features/test.sh index a162fc9ca..4e84f1f9c 100755 --- a/test/features/test.sh +++ b/test/features/test.sh | |||
@@ -99,5 +99,10 @@ echo "TESTING: 3.5 private-dev" | |||
99 | ./3.5.exp $OVERLAY $CHROOT | 99 | ./3.5.exp $OVERLAY $CHROOT |
100 | 100 | ||
101 | echo "TESTING: 3.6 private-etc" | 101 | echo "TESTING: 3.6 private-etc" |
102 | ./3.6.exp notworking-todo $CHROOT | 102 | ./3.6.exp notworking $CHROOT |
103 | 103 | ||
104 | echo "TESTING: 3.7 private-tmp" | ||
105 | ./3.7.exp $OVERLAY $CHROOT | ||
106 | |||
107 | echo "TESTING: 3.8 private-bin" | ||
108 | ./3.6.exp notworking notworking | ||