Skip to content

Commit

Permalink
testing
Browse files Browse the repository at this point in the history
  • Loading branch information
netblue30 committed Nov 14, 2016
1 parent 63e16bf commit 2f8688a
Show file tree
Hide file tree
Showing 16 changed files with 30 additions and 76 deletions.
16 changes: 5 additions & 11 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ clean:
for dir in $(APPS) $(MYLIBS); do \
$(MAKE) -C $$dir clean; \
done
rm -fr gcov-file gcov-dir gcov-test-initialized
rm -f $(MANPAGES) $(MANPAGES:%=%.gz) firejail*.rpm
rm -f test/utils/index.html*
rm -f test/utils/wget-log
Expand Down Expand Up @@ -146,7 +145,7 @@ uninstall:
rm -f $(DESTDIR)/$(datarootdir)/bash-completion/completions/firecfg

DISTFILES = "src etc platform configure configure.ac Makefile.in install.sh mkman.sh mketc.sh mkdeb.sh mkuid.sh COPYING README RELNOTES"
DISTFILES_TEST = "test/apps test/apps-x11 test/apps-x11-xorg test/root test/environment test/profiles test/utils test/compile test/filters test/network test/arguments test/fs test/sysutils"
DISTFILES_TEST = "test/rlimit test/apps test/apps-x11 test/apps-x11-xorg test/root test/environment test/profiles test/utils test/compile test/filters test/network test/arguments test/fs test/sysutils"

dist:
mv config.status config.status.old
Expand Down Expand Up @@ -188,14 +187,6 @@ cppcheck: clean
scan-build: clean
scan-build make

gcov-test-initialized:
./gcov-test-init.sh

gcov: gcov-test-initialized
lcov --capture -d src/firejail -d src/firemon -d src/fseccomp -d src/fnet -d src/ftee -d src/lib -d src/firecfg --output-file gcov-file
rm -fr gcov-dir
genhtml gcov-file --output-directory gcov-dir


#
# make test
Expand Down Expand Up @@ -232,7 +223,10 @@ test-arguments:
test-fs:
cd test/fs; ./fs.sh | grep TESTING

test: test-profiles test-fs test-utils test-environment test-apps test-apps-x11 test-apps-x11-xorg test-filters test-arguments
test-rlimit:
cd test/rlimit; ./rlimit.sh | grep TESTING

test: test-profiles test-fs test-utils test-environment test-apps test-apps-x11 test-apps-x11-xorg test-filters test-arguments test-rlimit
echo "TEST COMPLETE"

##########################################
Expand Down
11 changes: 0 additions & 11 deletions gcov-test-init.sh

This file was deleted.

3 changes: 3 additions & 0 deletions src/firejail/fs_home.c
Original file line number Diff line number Diff line change
Expand Up @@ -626,6 +626,9 @@ void fs_private_home_list(void) {

fs_logger_print(); // save the current log
free(dlist);
#ifdef HAVE_GCOV
__gcov_flush();
#endif
_exit(0);
}
// wait for the child to finish
Expand Down
12 changes: 2 additions & 10 deletions src/firejail/preproc.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,16 +104,8 @@ void preproc_build_cp_command(void) {
preproc_mount_mnt_dir();
if (stat(RUN_CP_COMMAND, &s)) {
char* fname = realpath("/bin/cp", NULL);
if (fname == NULL) {
fprintf(stderr, "Error: /bin/cp not found\n");
exit(1);
}
if (stat(fname, &s)) {
fprintf(stderr, "Error: /bin/cp not found\n");
exit(1);
}
if (is_link(fname)) {
fprintf(stderr, "Error: invalid /bin/cp file\n");
if (fname == NULL || stat(fname, &s) || is_link(fname)) {
fprintf(stderr, "Error: invalid /bin/cp\n");
exit(1);
}
int rv = copy_file(fname, RUN_CP_COMMAND, 0, 0, 0755);
Expand Down
4 changes: 2 additions & 2 deletions src/firejail/pulseaudio.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ void pulseaudio_init(void) {
int rv = mkdir(dir1, 0755);
if (rv == 0) {
if (set_perms(dir1, getuid(), getgid(), 0755))
; // do nothing
{;} // do nothing
}
}
free(dir1);
Expand All @@ -140,7 +140,7 @@ void pulseaudio_init(void) {
int rv = mkdir(dir1, 0700);
if (rv == 0) {
if (set_perms(dir1, getuid(), getgid(), 0700))
; // do nothing
{;} // do nothing
}
}
free(dir1);
Expand Down
12 changes: 12 additions & 0 deletions test/apps-x11/xterm-xpra.exp
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,18 @@ expect {
"name=blablabla"
}
sleep 1

send -- "firemon --x11\r"
expect {
timeout {puts "TESTING ERROR 7\n";exit}
"name=test xterm"
}
expect {
timeout {puts "TESTING ERROR 7.1\n";exit}
"DISPLAY"
}
sleep 1

send -- "firejail --shutdown=test\r"
sleep 3

Expand Down
6 changes: 0 additions & 6 deletions test/environment/environment.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,6 @@ else
echo "TESTING SKIP: zsh not found"
fi

echo "TESTING: rlimit (test/environment/rlimit.exp)"
./rlimit.exp

echo "TESTING: rlimit profile (test/environment/rlimit-profile.exp)"
./rlimit-profile.exp

echo "TESTING: firejail in firejail - single sandbox (test/environment/firejail-in-firejail.exp)"
./firejail-in-firejail.exp

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 0 additions & 4 deletions test/root/apache2.exp
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@ set timeout 5
spawn $env(SHELL)
match_max 100000

send -- "pkill apache\r"
sleep 2


send -- "firejail --name=apache /etc/init.d/apache2 start\r"
expect {
timeout {puts "TESTING ERROR 0\n";exit}
Expand Down
9 changes: 0 additions & 9 deletions test/root/isc-dhcp.exp
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,6 @@ set timeout 5
spawn $env(SHELL)
match_max 100000

send -- "sudo ls; sudo whoami; sudo pwd\r"
expect {
timeout {puts "TESTING ERROR: you need to root run this test as root\n";exit}
"root"
}

send -- "pkill dhcpd\r"
sleep 2

send -- "firejail --name=dhcpd /etc/init.d/isc-dhcp-server start\r"
expect {
timeout {puts "TESTING ERROR 0\n";exit}
Expand Down
4 changes: 0 additions & 4 deletions test/root/nginx.exp
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@ set timeout 5
spawn $env(SHELL)
match_max 100000

send -- "pkill nginx\r"
sleep 2


send -- "firejail --name=nginx /etc/init.d/nginx start\r"
expect {
timeout {puts "TESTING ERROR 0\n";exit}
Expand Down
6 changes: 6 additions & 0 deletions test/root/root.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ else
echo "TESTING SKIP: nginx not found"
fi

#********************************
# filesystem
#********************************
echo "TESTING: fs private (test/root/private.exp)"
./private.exp

#********************************
# seccomp
#********************************
Expand Down
10 changes: 0 additions & 10 deletions test/root/snmpd.exp
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,6 @@ set timeout 5
spawn $env(SHELL)
match_max 100000

send -- "sudo ls; sudo whoami; sudo pwd\r"
expect {
timeout {puts "TESTING ERROR: you need to root run this test as root\n";exit}
"root"
}

send -- "pkill snmpd\r"
sleep 2


send -- "firejail --name=snmpd /etc/init.d/snmpd start\r"
expect {
timeout {puts "TESTING ERROR 0\n";exit}
Expand Down
9 changes: 0 additions & 9 deletions test/root/unbound.exp
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,6 @@ set timeout 5
spawn $env(SHELL)
match_max 100000

send -- "sudo ls; sudo whoami; sudo pwd\r"
expect {
timeout {puts "TESTING ERROR: you need to root run this test as root\n";exit}
"root"
}

send -- "pkill unbound\r"
sleep 2

send -- "firejail --name=unbound unbound\r"
expect {
timeout {puts "TESTING ERROR 0\n";exit}
Expand Down

0 comments on commit 2f8688a

Please sign in to comment.