diff options
Diffstat (limited to 'test/fs/private-cache.exp')
-rwxr-xr-x | test/fs/private-cache.exp | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/test/fs/private-cache.exp b/test/fs/private-cache.exp new file mode 100755 index 000000000..0a1f00eb5 --- /dev/null +++ b/test/fs/private-cache.exp | |||
@@ -0,0 +1,53 @@ | |||
1 | #!/usr/bin/expect -f | ||
2 | |||
3 | set timeout 10 | ||
4 | spawn $env(SHELL) | ||
5 | match_max 100000 | ||
6 | |||
7 | if {[file exists ~/.cache]} { | ||
8 | puts "found .cache directory\n" | ||
9 | } else { | ||
10 | send -- "mkdir --mode=755 ~/.cache\r" | ||
11 | } | ||
12 | after 100 | ||
13 | |||
14 | send -- "touch ~/.cache/abcdefg\r" | ||
15 | after 100 | ||
16 | |||
17 | send -- "firejail --noprofile --private-cache\r" | ||
18 | expect { | ||
19 | timeout {puts "TESTING ERROR 1\n";exit} | ||
20 | "Child process initialized" | ||
21 | } | ||
22 | sleep 1 | ||
23 | |||
24 | send -- "ls ~/.cache | wc -l\r" | ||
25 | expect { | ||
26 | timeout {puts "TESTING ERROR 2\n";exit} | ||
27 | "\n0" | ||
28 | } | ||
29 | after 100 | ||
30 | |||
31 | send -- "exit\r" | ||
32 | sleep 1 | ||
33 | |||
34 | send -- "rm -v ~/.cache/abcdefg\r" | ||
35 | expect { | ||
36 | timeout {puts "TESTING ERROR 3\n";exit} | ||
37 | "removed" | ||
38 | } | ||
39 | after 100 | ||
40 | |||
41 | # redo the test with --private | ||
42 | |||
43 | send -- "firejail --noprofile --private --private-cache\r" | ||
44 | expect { | ||
45 | timeout {puts "TESTING ERROR 4\n";exit} | ||
46 | "tmpfs not mounted" | ||
47 | } | ||
48 | sleep 1 | ||
49 | |||
50 | send -- "exit\r" | ||
51 | sleep 1 | ||
52 | |||
53 | puts "\nall done\n" | ||