diff options
Diffstat (limited to 'test/profile_readonly.exp')
-rwxr-xr-x | test/profile_readonly.exp | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/test/profile_readonly.exp b/test/profile_readonly.exp new file mode 100755 index 000000000..046b0d738 --- /dev/null +++ b/test/profile_readonly.exp | |||
@@ -0,0 +1,64 @@ | |||
1 | #!/usr/bin/expect -f | ||
2 | |||
3 | set timeout 10 | ||
4 | spawn $env(SHELL) | ||
5 | match_max 100000 | ||
6 | |||
7 | send -- "mkdir /tmp/firejailtestdir\r" | ||
8 | sleep 1 | ||
9 | send -- "touch /tmp/firejailtestfile\r" | ||
10 | sleep 1 | ||
11 | |||
12 | send -- "firejail --profile=readonly.profile\r" | ||
13 | expect { | ||
14 | timeout {puts "TESTING ERROR 0\n";exit} | ||
15 | "Child process initialized" | ||
16 | } | ||
17 | |||
18 | # testing private only | ||
19 | send -- "bash\r" | ||
20 | sleep 1 | ||
21 | |||
22 | |||
23 | send -- "ls > /tmp/firejailtestdir/ttt;pwd\r" | ||
24 | expect { | ||
25 | timeout {puts "TESTING ERROR 1\n";exit} | ||
26 | "Read-only file system" | ||
27 | } | ||
28 | expect { | ||
29 | timeout {puts "TESTING ERROR 1.1\n";exit} | ||
30 | "home" | ||
31 | } | ||
32 | sleep 1 | ||
33 | |||
34 | send -- "ls > /tmp/firejailtestfile;pwd\r" | ||
35 | expect { | ||
36 | timeout {puts "TESTING ERROR 2\n";exit} | ||
37 | "Read-only file system" | ||
38 | } | ||
39 | expect { | ||
40 | timeout {puts "TESTING ERROR 2.1\n";exit} | ||
41 | "home" | ||
42 | } | ||
43 | sleep 1 | ||
44 | |||
45 | send -- "exit\r" | ||
46 | sleep 1 | ||
47 | send -- "pwd\r" | ||
48 | expect { | ||
49 | timeout {puts "TESTING ERROR 3\n";exit} | ||
50 | "home" | ||
51 | } | ||
52 | sleep 1 | ||
53 | send -- "exit\r" | ||
54 | sleep 1 | ||
55 | send -- "pwd\r" | ||
56 | expect { | ||
57 | timeout {puts "TESTING ERROR 4\n";exit} | ||
58 | "home" | ||
59 | } | ||
60 | sleep 2 | ||
61 | send -- "rm -fr /tmp/firejailtest*\r" | ||
62 | sleep 1 | ||
63 | |||
64 | puts "\n" | ||