diff options
author | netblue30 <netblue30@yahoo.com> | 2016-11-10 20:15:22 -0500 |
---|---|---|
committer | netblue30 <netblue30@yahoo.com> | 2016-11-10 20:15:22 -0500 |
commit | fffce11c3da087172c069ec0ff4c788f5bcc522b (patch) | |
tree | 7e3297f56448ebc8122f8fbb006fa3ce034ea62c /test/fs | |
parent | testing (diff) | |
download | firejail-fffce11c3da087172c069ec0ff4c788f5bcc522b.tar.gz firejail-fffce11c3da087172c069ec0ff4c788f5bcc522b.tar.zst firejail-fffce11c3da087172c069ec0ff4c788f5bcc522b.zip |
testing
Diffstat (limited to 'test/fs')
-rwxr-xr-x | test/fs/fs.sh | 9 | ||||
-rwxr-xr-x | test/fs/read-write.exp | 49 |
2 files changed, 58 insertions, 0 deletions
diff --git a/test/fs/fs.sh b/test/fs/fs.sh index 8ad67141a..0b9cf977e 100755 --- a/test/fs/fs.sh +++ b/test/fs/fs.sh | |||
@@ -8,6 +8,15 @@ export MALLOC_PERTURB_=$(($RANDOM % 255 + 1)) | |||
8 | 8 | ||
9 | rm -fr ~/_firejail_test_* | 9 | rm -fr ~/_firejail_test_* |
10 | echo "TESTING: mkdir/mkfile (test/fs/mkdir_mkfile.exp)" | 10 | echo "TESTING: mkdir/mkfile (test/fs/mkdir_mkfile.exp)" |
11 | ./mkdir_mkfile.exp | ||
12 | rm -fr ~/_firejail_test_* | ||
13 | |||
14 | mkdir ~/_firejail_test_dir | ||
15 | touch ~/_firejail_test_dir/a | ||
16 | mkdir ~/_firejail_test_dir/test1 | ||
17 | touch ~/_firejail_test_dir/test1/b | ||
18 | echo "TESTING: read/write (test/fs/read-write.exp)" | ||
19 | ./read-write.exp | ||
11 | rm -fr ~/_firejail_test_* | 20 | rm -fr ~/_firejail_test_* |
12 | 21 | ||
13 | echo "TESTING: /sys/fs access (test/fs/sys_fs.exp)" | 22 | echo "TESTING: /sys/fs access (test/fs/sys_fs.exp)" |
diff --git a/test/fs/read-write.exp b/test/fs/read-write.exp new file mode 100755 index 000000000..cfca15605 --- /dev/null +++ b/test/fs/read-write.exp | |||
@@ -0,0 +1,49 @@ | |||
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 | send -- "firejail --read-only=~/_firejail_test_dir --read-write=~/_firejail_test_dir/test1\r" | ||
12 | expect { | ||
13 | timeout {puts "TESTING ERROR 0\n";exit} | ||
14 | "Child process initialized" | ||
15 | } | ||
16 | sleep 1 | ||
17 | |||
18 | send -- "echo mytest >~/_firejail_test_dir/a;echo done\r" | ||
19 | expect { | ||
20 | timeout {puts "TESTING ERROR 1\n";exit} | ||
21 | "done" | ||
22 | } | ||
23 | |||
24 | send -- "echo mytest >~/_firejail_test_dir/test1/b;echo done\r" | ||
25 | expect { | ||
26 | timeout {puts "TESTING ERROR 2\n";exit} | ||
27 | "done" | ||
28 | } | ||
29 | |||
30 | send -- "cat ~/_firejail_test_dir/a;echo done\r" | ||
31 | expect { | ||
32 | timeout {puts "TESTING ERROR 3\n";exit} | ||
33 | "mytest" {puts "TESTING ERROR 4\n";exit} | ||
34 | "done" | ||
35 | } | ||
36 | |||
37 | |||
38 | send -- "cat ~/_firejail_test_dir/test1/b;echo done\r" | ||
39 | expect { | ||
40 | timeout {puts "TESTING ERROR 5\n";exit} | ||
41 | "mytest" | ||
42 | } | ||
43 | expect { | ||
44 | timeout {puts "TESTING ERROR 6\n";exit} | ||
45 | "done" | ||
46 | } | ||
47 | |||
48 | after 100 | ||
49 | puts "\nall done\n" | ||