diff options
Diffstat (limited to 'test/fs/private-home-dir.exp')
-rwxr-xr-x | test/fs/private-home-dir.exp | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/test/fs/private-home-dir.exp b/test/fs/private-home-dir.exp new file mode 100755 index 000000000..5491be834 --- /dev/null +++ b/test/fs/private-home-dir.exp | |||
@@ -0,0 +1,70 @@ | |||
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 | |||
11 | if {[file exists ~/.asoundrc]} { | ||
12 | puts "found .asoundrc file\n" | ||
13 | } else { | ||
14 | send -- "touch ~/.asoundrc\r" | ||
15 | } | ||
16 | after 100 | ||
17 | |||
18 | if {[file exists ~/.Xauthority]} { | ||
19 | puts "found .Xauthority file\n" | ||
20 | } else { | ||
21 | send -- "touch ~/.Xauthority\r" | ||
22 | } | ||
23 | after 100 | ||
24 | send -- "mkdir ~/_firejail_test_dir_\r" | ||
25 | sleep 1 | ||
26 | |||
27 | # testing profile and private | ||
28 | send -- "firejail --private=~/_firejail_test_dir_\r" | ||
29 | expect { | ||
30 | timeout {puts "TESTING ERROR 0\n";exit} | ||
31 | "Child process initialized" | ||
32 | } | ||
33 | sleep 1 | ||
34 | |||
35 | send -- "ls -l ~\r" | ||
36 | expect { | ||
37 | timeout {puts "TESTING ERROR 1\n";exit} | ||
38 | "total 0" | ||
39 | } | ||
40 | after 100 | ||
41 | |||
42 | send -- "ls -al ~\r" | ||
43 | expect { | ||
44 | timeout {puts "TESTING ERROR 2\n";exit} | ||
45 | ".asoundrc" | ||
46 | } | ||
47 | expect { | ||
48 | timeout {puts "TESTING ERROR 3\n";exit} | ||
49 | ".bashrc" | ||
50 | } | ||
51 | expect { | ||
52 | timeout {puts "TESTING ERROR 4\n";exit} | ||
53 | ".Xauthority" | ||
54 | } | ||
55 | after 100 | ||
56 | |||
57 | send -- "exit\r" | ||
58 | sleep 1 | ||
59 | |||
60 | |||
61 | # testing profile and private | ||
62 | send -- "firejail --private=/etc\r" | ||
63 | expect { | ||
64 | timeout {puts "TESTING ERROR 5\n";exit} | ||
65 | "private directory should be owned by the current user" | ||
66 | } | ||
67 | sleep 1 | ||
68 | |||
69 | |||
70 | puts "all done\n" | ||