Permalink
Browse files

testing

1 parent 667de2f commit 4d0797b12c8163e9e94ae0f0c7f4178bff9bdd4a @netblue30 committed Dec 6, 2016
Showing with 38 additions and 7 deletions.
  1. +14 −7 gcov.sh
  2. +3 −0 src/firejail/profile.c
  3. +12 −0 src/firejail/rlimit.c
  4. +9 −0 src/firejail/sandbox.c
View
@@ -2,13 +2,13 @@
gcov_init() {
USER=`whoami`
- firejail --help
- firemon --help
- /usr/lib/firejail/fnet --help
- /usr/lib/firejail/fseccomp --help
- /usr/lib/firejail/ftee --help
- /usr/lib/firejail/fcopy --help
- firecfg --help
+ firejail --help > /dev/null
+ firemon --help > /dev/null
+ /usr/lib/firejail/fnet --help > /dev/null
+ /usr/lib/firejail/fseccomp --help > /dev/null
+ /usr/lib/firejail/ftee --help > /dev/null
+ /usr/lib/firejail/fcopy --help > /dev/null
+ firecfg --help > /dev/null
sudo chown $USER:$USER `find .`
}
@@ -24,6 +24,13 @@ generate() {
gcov_init
+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-old
+
+#make test-environment
+#generate
+#sleep 2
+#exit
+
# running tests
make test-root
@@ -1053,6 +1053,9 @@ void profile_read(const char *fname) {
// else {
// free(ptr);
// }
+#ifdef HAVE_GCOV
+ __gcov_flush();
+#endif
}
fclose(fp);
}
View
@@ -27,6 +27,9 @@ void set_rlimits(void) {
if (arg_rlimit_nofile) {
rl.rlim_cur = (rlim_t) cfg.rlimit_nofile;
rl.rlim_max = (rlim_t) cfg.rlimit_nofile;
+#ifdef HAVE_GCOV // gcov-instrumented programs might crash at this point
+ __gcov_dump();
+#endif
if (setrlimit(RLIMIT_NOFILE, &rl) == -1)
errExit("setrlimit");
if (arg_debug)
@@ -36,6 +39,9 @@ void set_rlimits(void) {
if (arg_rlimit_nproc) {
rl.rlim_cur = (rlim_t) cfg.rlimit_nproc;
rl.rlim_max = (rlim_t) cfg.rlimit_nproc;
+#ifdef HAVE_GCOV
+ __gcov_dump();
+#endif
if (setrlimit(RLIMIT_NPROC, &rl) == -1)
errExit("setrlimit");
if (arg_debug)
@@ -45,6 +51,9 @@ void set_rlimits(void) {
if (arg_rlimit_fsize) {
rl.rlim_cur = (rlim_t) cfg.rlimit_fsize;
rl.rlim_max = (rlim_t) cfg.rlimit_fsize;
+#ifdef HAVE_GCOV
+ __gcov_dump();
+#endif
if (setrlimit(RLIMIT_FSIZE, &rl) == -1)
errExit("setrlimit");
if (arg_debug)
@@ -54,6 +63,9 @@ void set_rlimits(void) {
if (arg_rlimit_sigpending) {
rl.rlim_cur = (rlim_t) cfg.rlimit_sigpending;
rl.rlim_max = (rlim_t) cfg.rlimit_sigpending;
+#ifdef HAVE_GCOV
+ __gcov_dump();
+#endif
if (setrlimit(RLIMIT_SIGPENDING, &rl) == -1)
errExit("setrlimit");
if (arg_debug)
@@ -286,6 +286,9 @@ void start_application(void) {
//****************************************
if (arg_audit) {
assert(arg_audit_prog);
+#ifdef HAVE_GCOV
+ __gcov_dump();
+#endif
execl(arg_audit_prog, arg_audit_prog, NULL);
}
//****************************************
@@ -309,6 +312,9 @@ void start_application(void) {
if (!arg_command && !arg_quiet)
printf("Child process initialized\n");
+#ifdef HAVE_GCOV
+ __gcov_dump();
+#endif
execvp(cfg.original_argv[cfg.original_program_index], &cfg.original_argv[cfg.original_program_index]);
exit(1);
}
@@ -356,6 +362,9 @@ void start_application(void) {
if (!arg_command && !arg_quiet)
printf("Child process initialized\n");
+#ifdef HAVE_GCOV
+ __gcov_dump();
+#endif
execvp(arg[0], arg);
}

0 comments on commit 4d0797b

Please sign in to comment.