diff options
author | netblue30 <netblue30@yahoo.com> | 2016-11-10 08:23:58 -0500 |
---|---|---|
committer | netblue30 <netblue30@yahoo.com> | 2016-11-10 08:23:58 -0500 |
commit | d8984ed12a0cb7cef4376f544ac19b6e71bb213c (patch) | |
tree | c5281c93c8c4768fc235fdc18edcfbc19d380265 | |
parent | bug: mkdir and mkfile are not applied to private directories (diff) | |
download | firejail-d8984ed12a0cb7cef4376f544ac19b6e71bb213c.tar.gz firejail-d8984ed12a0cb7cef4376f544ac19b6e71bb213c.tar.zst firejail-d8984ed12a0cb7cef4376f544ac19b6e71bb213c.zip |
testing
-rwxr-xr-x | test/fs/fs.sh | 7 | ||||
-rwxr-xr-x | test/fs/mkdir_mkfile.exp | 46 | ||||
-rw-r--r-- | test/fs/mkdir_mkfile.profile | 4 |
3 files changed, 57 insertions, 0 deletions
diff --git a/test/fs/fs.sh b/test/fs/fs.sh index 812da02b0..8ad67141a 100755 --- a/test/fs/fs.sh +++ b/test/fs/fs.sh | |||
@@ -6,6 +6,10 @@ | |||
6 | export MALLOC_CHECK_=3 | 6 | export MALLOC_CHECK_=3 |
7 | export MALLOC_PERTURB_=$(($RANDOM % 255 + 1)) | 7 | export MALLOC_PERTURB_=$(($RANDOM % 255 + 1)) |
8 | 8 | ||
9 | rm -fr ~/_firejail_test_* | ||
10 | echo "TESTING: mkdir/mkfile (test/fs/mkdir_mkfile.exp)" | ||
11 | rm -fr ~/_firejail_test_* | ||
12 | |||
9 | echo "TESTING: /sys/fs access (test/fs/sys_fs.exp)" | 13 | echo "TESTING: /sys/fs access (test/fs/sys_fs.exp)" |
10 | ./sys_fs.exp | 14 | ./sys_fs.exp |
11 | 15 | ||
@@ -69,12 +73,15 @@ echo "TESTING: double whitelist (test/fs/whitelist-double.exp)" | |||
69 | 73 | ||
70 | echo "TESTING: whitelist (test/fs/whitelist.exp)" | 74 | echo "TESTING: whitelist (test/fs/whitelist.exp)" |
71 | ./whitelist.exp | 75 | ./whitelist.exp |
76 | |||
77 | #cleanup | ||
72 | rm -fr ~/fjtest-dir | 78 | rm -fr ~/fjtest-dir |
73 | rm -fr ~/fjtest-dir-lnk | 79 | rm -fr ~/fjtest-dir-lnk |
74 | rm -f ~/fjtest-file | 80 | rm -f ~/fjtest-file |
75 | rm -f ~/fjtest-file-lnk | 81 | rm -f ~/fjtest-file-lnk |
76 | rm -f /tmp/fjtest-file | 82 | rm -f /tmp/fjtest-file |
77 | rm -fr /tmp/fjtest-dir | 83 | rm -fr /tmp/fjtest-dir |
84 | rm -fr ~/_firejail_test_* | ||
78 | 85 | ||
79 | 86 | ||
80 | 87 | ||
diff --git a/test/fs/mkdir_mkfile.exp b/test/fs/mkdir_mkfile.exp new file mode 100755 index 000000000..98163bf77 --- /dev/null +++ b/test/fs/mkdir_mkfile.exp | |||
@@ -0,0 +1,46 @@ | |||
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 | # testing profile and private | ||
12 | send -- "firejail --private --profile=mkdir_mkfile.profile\r" | ||
13 | expect { | ||
14 | timeout {puts "TESTING ERROR 0\n";exit} | ||
15 | "Child process initialized" | ||
16 | } | ||
17 | sleep 1 | ||
18 | |||
19 | send -- "find ~\r" | ||
20 | expect { | ||
21 | timeout {puts "TESTING ERROR 1\n";exit} | ||
22 | "_firejail_test_file" | ||
23 | } | ||
24 | expect { | ||
25 | timeout {puts "TESTING ERROR 1\n";exit} | ||
26 | "_firejail_test_dir" | ||
27 | } | ||
28 | expect { | ||
29 | timeout {puts "TESTING ERROR 1\n";exit} | ||
30 | "_firejail_test_dir/dir1" | ||
31 | } | ||
32 | expect { | ||
33 | timeout {puts "TESTING ERROR 1\n";exit} | ||
34 | "_firejail_test_dir/dir1/dir2" | ||
35 | } | ||
36 | expect { | ||
37 | timeout {puts "TESTING ERROR 1\n";exit} | ||
38 | "_firejail_test_dir/dir1/dir2/dir3" | ||
39 | } | ||
40 | expect { | ||
41 | timeout {puts "TESTING ERROR 1\n";exit} | ||
42 | "_firejail_test_dir/dir1/dir2/dir3/file1" | ||
43 | } | ||
44 | after 100 | ||
45 | |||
46 | puts "all done\n" | ||
diff --git a/test/fs/mkdir_mkfile.profile b/test/fs/mkdir_mkfile.profile new file mode 100644 index 000000000..d179c62ac --- /dev/null +++ b/test/fs/mkdir_mkfile.profile | |||
@@ -0,0 +1,4 @@ | |||
1 | mkdir ~/_firejail_test_dir | ||
2 | mkfile ~/_firejail_test_file | ||
3 | mkdir ~/_firejail_test_dir/dir1/dir2/dir3 | ||
4 | mkfile ~/_firejail_test_dir/dir1/dir2/dir3/file1 | ||