summaryrefslogtreecommitdiffstats
path: root/test/fs
diff options
context:
space:
mode:
authorLibravatar netblue30 <netblue30@yahoo.com>2016-11-10 20:15:22 -0500
committerLibravatar netblue30 <netblue30@yahoo.com>2016-11-10 20:15:22 -0500
commitfffce11c3da087172c069ec0ff4c788f5bcc522b (patch)
tree7e3297f56448ebc8122f8fbb006fa3ce034ea62c /test/fs
parenttesting (diff)
downloadfirejail-fffce11c3da087172c069ec0ff4c788f5bcc522b.tar.gz
firejail-fffce11c3da087172c069ec0ff4c788f5bcc522b.tar.zst
firejail-fffce11c3da087172c069ec0ff4c788f5bcc522b.zip
testing
Diffstat (limited to 'test/fs')
-rwxr-xr-xtest/fs/fs.sh9
-rwxr-xr-xtest/fs/read-write.exp49
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
9rm -fr ~/_firejail_test_* 9rm -fr ~/_firejail_test_*
10echo "TESTING: mkdir/mkfile (test/fs/mkdir_mkfile.exp)" 10echo "TESTING: mkdir/mkfile (test/fs/mkdir_mkfile.exp)"
11./mkdir_mkfile.exp
12rm -fr ~/_firejail_test_*
13
14mkdir ~/_firejail_test_dir
15touch ~/_firejail_test_dir/a
16mkdir ~/_firejail_test_dir/test1
17touch ~/_firejail_test_dir/test1/b
18echo "TESTING: read/write (test/fs/read-write.exp)"
19./read-write.exp
11rm -fr ~/_firejail_test_* 20rm -fr ~/_firejail_test_*
12 21
13echo "TESTING: /sys/fs access (test/fs/sys_fs.exp)" 22echo "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
6set timeout 10
7spawn $env(SHELL)
8match_max 100000
9
10
11send -- "firejail --read-only=~/_firejail_test_dir --read-write=~/_firejail_test_dir/test1\r"
12expect {
13 timeout {puts "TESTING ERROR 0\n";exit}
14 "Child process initialized"
15}
16sleep 1
17
18send -- "echo mytest >~/_firejail_test_dir/a;echo done\r"
19expect {
20 timeout {puts "TESTING ERROR 1\n";exit}
21 "done"
22}
23
24send -- "echo mytest >~/_firejail_test_dir/test1/b;echo done\r"
25expect {
26 timeout {puts "TESTING ERROR 2\n";exit}
27 "done"
28}
29
30send -- "cat ~/_firejail_test_dir/a;echo done\r"
31expect {
32 timeout {puts "TESTING ERROR 3\n";exit}
33 "mytest" {puts "TESTING ERROR 4\n";exit}
34 "done"
35}
36
37
38send -- "cat ~/_firejail_test_dir/test1/b;echo done\r"
39expect {
40 timeout {puts "TESTING ERROR 5\n";exit}
41 "mytest"
42}
43expect {
44 timeout {puts "TESTING ERROR 6\n";exit}
45 "done"
46}
47
48after 100
49puts "\nall done\n"