aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar netblue30 <netblue30@yahoo.com>2017-09-05 10:56:40 -0400
committerLibravatar netblue30 <netblue30@yahoo.com>2017-09-05 10:56:40 -0400
commit362d290bacf90a9bb29d6c25ca395117e4da838e (patch)
tree8522b67cdfa1692cef8f676f72fb0d609fe6514f
parentfix caps.keep/dac-overwrite (diff)
downloadfirejail-362d290bacf90a9bb29d6c25ca395117e4da838e.tar.gz
firejail-362d290bacf90a9bb29d6c25ca395117e4da838e.tar.zst
firejail-362d290bacf90a9bb29d6c25ca395117e4da838e.zip
testing
-rwxr-xr-xgcov.sh5
-rw-r--r--src/fldd/main.c5
-rwxr-xr-xtest/fs/fs.sh3
-rwxr-xr-xtest/fs/private-lib.exp44
-rwxr-xr-xtest/utils/seccomp-print.exp4
5 files changed, 57 insertions, 4 deletions
diff --git a/gcov.sh b/gcov.sh
index 092b755af..df1fcb51b 100755
--- a/gcov.sh
+++ b/gcov.sh
@@ -8,12 +8,13 @@ gcov_init() {
8 /usr/lib/firejail/fseccomp --help > /dev/null 8 /usr/lib/firejail/fseccomp --help > /dev/null
9 /usr/lib/firejail/ftee --help > /dev/null 9 /usr/lib/firejail/ftee --help > /dev/null
10 /usr/lib/firejail/fcopy --help > /dev/null 10 /usr/lib/firejail/fcopy --help > /dev/null
11 /usr/lib/firejail/fldd --help > /dev/null
11 firecfg --help > /dev/null 12 firecfg --help > /dev/null
12 sudo chown $USER:$USER `find .` 13 sudo chown $USER:$USER `find .`
13} 14}
14 15
15generate() { 16generate() {
16 lcov -q --capture -d src/firejail -d src/firemon -d src/fcopy -d src/fseccomp -d src/fnet -d src/ftee -d src/lib -d src/firecfg --output-file gcov-file-new 17 lcov -q --capture -d src/firejail -d src/firemon -d src/fcopy -d src/fseccomp -d src/fnet -d src/ftee -d src/lib -d src/firecfg -d src/fldd --output-file gcov-file-new
17 lcov --add-tracefile gcov-file-old --add-tracefile gcov-file-new --output-file gcov-file 18 lcov --add-tracefile gcov-file-old --add-tracefile gcov-file-new --output-file gcov-file
18 rm -fr gcov-dir 19 rm -fr gcov-dir
19 genhtml -q gcov-file --output-directory gcov-dir 20 genhtml -q gcov-file --output-directory gcov-dir
@@ -24,7 +25,7 @@ generate() {
24 25
25 26
26gcov_init 27gcov_init
27lcov -q --capture -d src/firejail -d src/firemon -d src/fcopy -d src/fseccomp -d src/fnet -d src/ftee -d src/lib -d src/firecfg --output-file gcov-file-old 28lcov -q --capture -d src/firejail -d src/firemon -d src/fcopy -d src/fseccomp -d src/fnet -d src/ftee -d src/lib -d src/firecfg -d src/fldd --output-file gcov-file-old
28 29
29#make test-environment 30#make test-environment
30#generate 31#generate
diff --git a/src/fldd/main.c b/src/fldd/main.c
index 947c6b4ae..5fda45266 100644
--- a/src/fldd/main.c
+++ b/src/fldd/main.c
@@ -265,6 +265,11 @@ printf("\n");
265 } 265 }
266 266
267 267
268 if (strcmp(argv[1], "--help") == 0) {
269 usage();
270 return 0;
271 }
272
268 // check program access 273 // check program access
269 if (access(argv[1], R_OK)) { 274 if (access(argv[1], R_OK)) {
270 fprintf(stderr, "Error fldd: cannot access %s\n", argv[1]); 275 fprintf(stderr, "Error fldd: cannot access %s\n", argv[1]);
diff --git a/test/fs/fs.sh b/test/fs/fs.sh
index 9e7ead3c9..e67ccc476 100755
--- a/test/fs/fs.sh
+++ b/test/fs/fs.sh
@@ -28,6 +28,9 @@ echo "TESTING: kmsg access (test/fs/kmsg.exp)"
28echo "TESTING: read/write /var/tmp (test/fs/fs_var_tmp.exp)" 28echo "TESTING: read/write /var/tmp (test/fs/fs_var_tmp.exp)"
29./fs_var_tmp.exp 29./fs_var_tmp.exp
30 30
31echo "TESTING: private-lib (test/fs/private-lib.exp)"
32./private-lib.exp
33
31echo "TESTING: read/write /var/lock (test/fs/fs_var_lock.exp)" 34echo "TESTING: read/write /var/lock (test/fs/fs_var_lock.exp)"
32./fs_var_lock.exp 35./fs_var_lock.exp
33 36
diff --git a/test/fs/private-lib.exp b/test/fs/private-lib.exp
new file mode 100755
index 000000000..dd418da0f
--- /dev/null
+++ b/test/fs/private-lib.exp
@@ -0,0 +1,44 @@
1#!/usr/bin/expect -f
2# This file is part of Firejail project
3# Copyright (C) 2014-2017 Firejail Authors
4# License GPL v2
5
6set timeout 10
7spawn $env(SHELL)
8match_max 100000
9
10send -- "firejail --private-lib --private-bin=sh,bash,dash,ps,grep,ls,find,echo \r"
11expect {
12 timeout {puts "TESTING ERROR 1\n";exit}
13 "Child process initialized"
14}
15after 100
16
17send -- "find /bin; echo done\r"
18expect {
19 timeout {puts "TESTING ERROR 2\n";exit}
20 "rm" {puts "TESTING ERROR 3\n";exit}
21 "cp" {puts "TESTING ERROR 4\n";exit}
22 "done"
23}
24after 100
25
26send -- "find /lib; echo done\r"
27expect {
28 timeout {puts "TESTING ERROR 5\n";exit}
29 "modules" {puts "TESTING ERROR 6\n";exit}
30 "firmware" {puts "TESTING ERROR 7\n";exit}
31 "libc.so"
32}
33after 100
34
35send -- "find /usr/lib; echo done\r"
36expect {
37 timeout {puts "TESTING ERROR 8\n";exit}
38 "grub" {puts "TESTING ERROR 9\n";exit}
39 "mozilla" {puts "TESTING ERROR 10\n";exit}
40 "libdl.so"
41}
42after 100
43
44puts "\nall done\n"
diff --git a/test/utils/seccomp-print.exp b/test/utils/seccomp-print.exp
index 5a76d7fcc..b3ab5e13c 100755
--- a/test/utils/seccomp-print.exp
+++ b/test/utils/seccomp-print.exp
@@ -22,11 +22,11 @@ expect {
22} 22}
23expect { 23expect {
24 timeout {puts "TESTING ERROR 2\n";exit} 24 timeout {puts "TESTING ERROR 2\n";exit}
25 "init_module" 25 "delete_module"
26} 26}
27expect { 27expect {
28 timeout {puts "TESTING ERROR 3\n";exit} 28 timeout {puts "TESTING ERROR 3\n";exit}
29 "delete_module" 29 "init_module"
30} 30}
31expect { 31expect {
32 timeout {puts "TESTING ERROR 4\n";exit} 32 timeout {puts "TESTING ERROR 4\n";exit}