Commit 66a47641 authored by netblue30's avatar netblue30

gcov support

parent de5b5360
......@@ -39,6 +39,7 @@ clean:
for dir in $(APPS) $(MYLIBS); do \
$(MAKE) -C $$dir clean; \
done
rm -fr gcov-file gcov-dir
rm -f $(MANPAGES) $(MANPAGES:%=%.gz) firejail*.rpm
rm -f test/utils/index.html*
rm -f test/utils/wget-log
......@@ -222,3 +223,10 @@ test-fs:
test: test-profiles test-fs test-utils test-environment test-apps test-apps-x11 test-apps-x11-xorg test-filters
echo "TEST COMPLETE"
gcov:;
lcov --capture -d src/firejail -d src/firemon -d src/fseccomp -d src/fnet -d src/ftee --output-file gcov-file
rm -fr gcov-dir
genhtml gcov-file --output-directory gcov-dir
\ No newline at end of file
......@@ -625,6 +625,7 @@ ac_includes_default="\
ac_subst_vars='LTLIBOBJS
LIBOBJS
HAVE_SECCOMP_H
HAVE_GCOV
BUSYBOX_WORKAROUND
HAVE_FATAL_WARNINGS
HAVE_WHITELIST
......@@ -709,6 +710,7 @@ enable_file_transfer
enable_whitelist
enable_fatal_warnings
enable_busybox_workaround
enable_gcov
'
ac_precious_vars='build_alias
host_alias
......@@ -1346,6 +1348,7 @@ Optional Features:
--enable-fatal-warnings -W -Wall -Werror
--enable-busybox-workaround
enable busybox workaround
--enable-gcov Gcov instrumentation
Some influential environment variables:
CC C compiler command
......@@ -3508,7 +3511,7 @@ fi
fi
if test "x$enable_apparmor" = "xyes"; then :
EXTRA_LDFLAGS="-lapparmor"
EXTRA_LDFLAGS+="-lapparmor "
fi
......@@ -3693,6 +3696,21 @@ if test "x$enable_busybox_workaround" = "xyes"; then :
fi
HAVE_GCOV=""
# Check whether --enable-gcov was given.
if test "${enable_gcov+set}" = set; then :
enableval=$enable_gcov;
fi
if test "x$enable_gcov" = "xyes"; then :
HAVE_GCOV="--coverage "
EXTRA_LDFLAGS+="-lgcov --coverage "
fi
# checking pthread library
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lpthread" >&5
......@@ -4954,7 +4972,8 @@ echo " file transfer support: $HAVE_FILE_TRANSFER"
echo " overlayfs support: $HAVE_OVERLAYFS"
echo " fatal warnings: $HAVE_FATAL_WARNINGS"
echo " busybox workaround: $BUSYBOX_WORKAROUND"
printf " EXTRA_LDFLAGS: $EXTRA_LDFLAGS"
echo " EXTRA_LDFLAGS: $EXTRA_LDFLAGS"
echo " Gcov instrumentation: $HAVE_GCOV"
echo
......
......@@ -22,7 +22,7 @@ AS_IF([test "x$enable_apparmor" = "xyes"], [
[Couldn't find sys/apparmor.h... please install apparmor user space library and development files] )])
])
AS_IF([test "x$enable_apparmor" = "xyes"], [
EXTRA_LDFLAGS="-lapparmor"
EXTRA_LDFLAGS+="-lapparmor "
])
AC_SUBST([EXTRA_LDFLAGS])
......@@ -136,6 +136,16 @@ AS_IF([test "x$enable_busybox_workaround" = "xyes"], [
])
HAVE_GCOV=""
AC_ARG_ENABLE([gcov],
AS_HELP_STRING([--enable-gcov], [Gcov instrumentation]))
AS_IF([test "x$enable_gcov" = "xyes"], [
HAVE_GCOV="--coverage "
EXTRA_LDFLAGS+="-lgcov --coverage "
AC_SUBST(HAVE_GCOV)
])
# checking pthread library
AC_CHECK_LIB([pthread], [main], [], AC_MSG_ERROR([*** POSIX thread support not installed ***]))
......@@ -170,7 +180,8 @@ echo " file transfer support: $HAVE_FILE_TRANSFER"
echo " overlayfs support: $HAVE_OVERLAYFS"
echo " fatal warnings: $HAVE_FATAL_WARNINGS"
echo " busybox workaround: $BUSYBOX_WORKAROUND"
printf " EXTRA_LDFLAGS: $EXTRA_LDFLAGS"
echo " EXTRA_LDFLAGS: $EXTRA_LDFLAGS"
echo " Gcov instrumentation: $HAVE_GCOV"
echo
......
......@@ -21,13 +21,14 @@ HAVE_GLOBALCFG=@HAVE_GLOBALCFG@
HAVE_APPARMOR=@HAVE_APPARMOR@
HAVE_OVERLAYFS=@HAVE_OVERLAYFS@
HAVE_PRIVATE_HOME=@HAVE_PRIVATE_HOME@
HAVE_GCOV=@HAVE_GCOV@
EXTRA_LDFLAGS +=@EXTRA_LDFLAGS@
H_FILE_LIST = $(sort $(wildcard *.[h]))
C_FILE_LIST = $(sort $(wildcard *.c))
OBJS = $(C_FILE_LIST:.c=.o)
BINOBJS = $(foreach file, $(OBJS), $file)
CFLAGS += -ggdb $(HAVE_FATAL_WARNINGS) -O2 -DVERSION='"$(VERSION)"' -DPREFIX='"$(prefix)"' -DSYSCONFDIR='"$(sysconfdir)/firejail"' -DLIBDIR='"$(libdir)"' $(HAVE_X11) $(HAVE_PRIVATE_HOME) $(HAVE_APPARMOR) $(HAVE_OVERLAYFS) $(HAVE_SECCOMP) $(HAVE_GLOBALCFG) $(HAVE_SECCOMP_H) $(HAVE_CHROOT) $(HAVE_NETWORK) $(HAVE_USERNS) $(HAVE_BIND) $(HAVE_FILE_TRANSFER) $(HAVE_WHITELIST) -fstack-protector-all -D_FORTIFY_SOURCE=2 -fPIE -pie -Wformat -Wformat-security
CFLAGS += -ggdb $(HAVE_FATAL_WARNINGS) -O2 -DVERSION='"$(VERSION)"' $(HAVE_GCOV) -DPREFIX='"$(prefix)"' -DSYSCONFDIR='"$(sysconfdir)/firejail"' -DLIBDIR='"$(libdir)"' $(HAVE_X11) $(HAVE_PRIVATE_HOME) $(HAVE_APPARMOR) $(HAVE_OVERLAYFS) $(HAVE_SECCOMP) $(HAVE_GLOBALCFG) $(HAVE_SECCOMP_H) $(HAVE_CHROOT) $(HAVE_NETWORK) $(HAVE_USERNS) $(HAVE_BIND) $(HAVE_FILE_TRANSFER) $(HAVE_WHITELIST) -fstack-protector-all -D_FORTIFY_SOURCE=2 -fPIE -pie -Wformat -Wformat-security
LDFLAGS += -pie -Wl,-z,relro -Wl,-z,now -lpthread
%.o : %.c $(H_FILE_LIST) ../include/common.h ../include/euid_common.h ../include/pid.h ../include/seccomp.h ../include/syscall.h
......@@ -36,7 +37,7 @@ LDFLAGS += -pie -Wl,-z,relro -Wl,-z,now -lpthread
firejail: $(OBJS) ../lib/libnetlink.o ../lib/common.o
$(CC) $(LDFLAGS) -o $@ $(OBJS) ../lib/common.o $(LIBS) $(EXTRA_LDFLAGS)
clean:; rm -f *.o firejail firejail.1 firejail.1.gz
clean:; rm -f *.o firejail firejail.1 firejail.1.gz *.gcov *.gcda *.gcno
distclean: clean
rm -fr Makefile
......
......@@ -4,21 +4,26 @@ PREFIX=@prefix@
VERSION=@PACKAGE_VERSION@
NAME=@PACKAGE_NAME@
HAVE_FATAL_WARNINGS=@HAVE_FATAL_WARNINGS@
HAVE_GCOV=@HAVE_GCOV@
EXTRA_LDFLAGS +=@EXTRA_LDFLAGS@
H_FILE_LIST = $(sort $(wildcard *.[h]))
C_FILE_LIST = $(sort $(wildcard *.c))
OBJS = $(C_FILE_LIST:.c=.o)
BINOBJS = $(foreach file, $(OBJS), $file)
CFLAGS += -ggdb $(HAVE_FATAL_WARNINGS) -O2 -DVERSION='"$(VERSION)"' -fstack-protector-all -D_FORTIFY_SOURCE=2 -fPIE -pie -Wformat -Wformat-security
CFLAGS += -ggdb $(HAVE_FATAL_WARNINGS) -O2 -DVERSION='"$(VERSION)"' $(HAVE_GCOV) -fstack-protector-all -D_FORTIFY_SOURCE=2 -fPIE -pie -Wformat -Wformat-security
LDFLAGS += -pie -Wl,-z,relro -Wl,-z,now
HAVE_GCOV=@HAVE_GCOV@
EXTRA_LDFLAGS +=@EXTRA_LDFLAGS@
%.o : %.c $(H_FILE_LIST)
$(CC) $(CFLAGS) $(INCLUDE) -c $< -o $@
firemon: $(OBJS) ../lib/common.o ../lib/pid.o
$(CC) $(LDFLAGS) -o $@ $(OBJS) ../lib/common.o ../lib/pid.o $(LIBS)
$(CC) $(LDFLAGS) -o $@ $(OBJS) ../lib/common.o ../lib/pid.o $(LIBS) $(EXTRA_LDFLAGS)
clean:; rm -f *.o firemon
clean:; rm -f *.o firemon *.gcov *.gcda *.gcno
distclean: clean
rm -fr Makefile
......
......@@ -22,21 +22,23 @@ HAVE_APPARMOR=@HAVE_APPARMOR@
HAVE_OVERLAYFS=@HAVE_OVERLAYFS@
HAVE_PRIVATE_HOME=@HAVE_PRIVATE_HOME@
EXTRA_LDFLAGS +=@EXTRA_LDFLAGS@
HAVE_GCOV=@HAVE_GCOV@
EXTRA_LDFLAGS +=@EXTRA_LDFLAGS@
H_FILE_LIST = $(sort $(wildcard *.[h]))
C_FILE_LIST = $(sort $(wildcard *.c))
OBJS = $(C_FILE_LIST:.c=.o)
BINOBJS = $(foreach file, $(OBJS), $file)
CFLAGS += -ggdb $(HAVE_FATAL_WARNINGS) -O2 -DVERSION='"$(VERSION)"' -DPREFIX='"$(prefix)"' -DSYSCONFDIR='"$(sysconfdir)/firejail"' -DLIBDIR='"$(libdir)"' $(HAVE_X11) $(HAVE_PRIVATE_HOME) $(HAVE_APPARMOR) $(HAVE_OVERLAYFS) $(HAVE_SECCOMP) $(HAVE_GLOBALCFG) $(HAVE_SECCOMP_H) $(HAVE_CHROOT) $(HAVE_NETWORK) $(HAVE_USERNS) $(HAVE_BIND) $(HAVE_FILE_TRANSFER) $(HAVE_WHITELIST) -fstack-protector-all -D_FORTIFY_SOURCE=2 -fPIE -pie -Wformat -Wformat-security
CFLAGS += -ggdb $(HAVE_FATAL_WARNINGS) -O2 -DVERSION='"$(VERSION)"' $(HAVE_GCOV) -DPREFIX='"$(prefix)"' -DSYSCONFDIR='"$(sysconfdir)/firejail"' -DLIBDIR='"$(libdir)"' $(HAVE_X11) $(HAVE_PRIVATE_HOME) $(HAVE_APPARMOR) $(HAVE_OVERLAYFS) $(HAVE_SECCOMP) $(HAVE_GLOBALCFG) $(HAVE_SECCOMP_H) $(HAVE_CHROOT) $(HAVE_NETWORK) $(HAVE_USERNS) $(HAVE_BIND) $(HAVE_FILE_TRANSFER) $(HAVE_WHITELIST) -fstack-protector-all -D_FORTIFY_SOURCE=2 -fPIE -pie -Wformat -Wformat-security
LDFLAGS += -pie -Wl,-z,relro -Wl,-z,now -lpthread
%.o : %.c $(H_FILE_LIST) ../include/common.h ../include/libnetlink.h
$(CC) $(CFLAGS) $(INCLUDE) -c $< -o $@
fnet: $(OBJS) ../lib/libnetlink.o
$(CC) $(LDFLAGS) -o $@ $(OBJS) ../lib/libnetlink.o $(LIBS)
$(CC) $(LDFLAGS) -o $@ $(OBJS) ../lib/libnetlink.o $(LIBS) $(EXTRA_LDFLAGS)
clean:; rm -f *.o fnet
clean:; rm -f *.o fnet *.gcov *.gcda *.gcno
distclean: clean
rm -fr Makefile
......
......@@ -22,21 +22,23 @@ HAVE_APPARMOR=@HAVE_APPARMOR@
HAVE_OVERLAYFS=@HAVE_OVERLAYFS@
HAVE_PRIVATE_HOME=@HAVE_PRIVATE_HOME@
EXTRA_LDFLAGS +=@EXTRA_LDFLAGS@
HAVE_GCOV=@HAVE_GCOV@
EXTRA_LDFLAGS +=@EXTRA_LDFLAGS@
H_FILE_LIST = $(sort $(wildcard *.[h]))
C_FILE_LIST = $(sort $(wildcard *.c))
OBJS = $(C_FILE_LIST:.c=.o)
BINOBJS = $(foreach file, $(OBJS), $file)
CFLAGS += -ggdb $(HAVE_FATAL_WARNINGS) -O2 -DVERSION='"$(VERSION)"' -DPREFIX='"$(prefix)"' -DSYSCONFDIR='"$(sysconfdir)/firejail"' -DLIBDIR='"$(libdir)"' $(HAVE_X11) $(HAVE_PRIVATE_HOME) $(HAVE_APPARMOR) $(HAVE_OVERLAYFS) $(HAVE_SECCOMP) $(HAVE_GLOBALCFG) $(HAVE_SECCOMP_H) $(HAVE_CHROOT) $(HAVE_NETWORK) $(HAVE_USERNS) $(HAVE_BIND) $(HAVE_FILE_TRANSFER) $(HAVE_WHITELIST) -fstack-protector-all -D_FORTIFY_SOURCE=2 -fPIE -pie -Wformat -Wformat-security
CFLAGS += -ggdb $(HAVE_FATAL_WARNINGS) -O2 -DVERSION='"$(VERSION)"' $(HAVE_GCOV) -DPREFIX='"$(prefix)"' -DSYSCONFDIR='"$(sysconfdir)/firejail"' -DLIBDIR='"$(libdir)"' $(HAVE_X11) $(HAVE_PRIVATE_HOME) $(HAVE_APPARMOR) $(HAVE_OVERLAYFS) $(HAVE_SECCOMP) $(HAVE_GLOBALCFG) $(HAVE_SECCOMP_H) $(HAVE_CHROOT) $(HAVE_NETWORK) $(HAVE_USERNS) $(HAVE_BIND) $(HAVE_FILE_TRANSFER) $(HAVE_WHITELIST) -fstack-protector-all -D_FORTIFY_SOURCE=2 -fPIE -pie -Wformat -Wformat-security
LDFLAGS += -pie -Wl,-z,relro -Wl,-z,now -lpthread
%.o : %.c $(H_FILE_LIST) ../include/common.h ../include/syscall.h
$(CC) $(CFLAGS) $(INCLUDE) -c $< -o $@
fseccomp: $(OBJS)
$(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
$(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS) $(EXTRA_LDFLAGS)
clean:; rm -f *.o fseccomp
clean:; rm -f *.o fseccomp *.gcov *.gcda *.gcno
distclean: clean
rm -fr Makefile
......
......@@ -4,21 +4,23 @@ PREFIX=@prefix@
VERSION=@PACKAGE_VERSION@
NAME=@PACKAGE_NAME@
HAVE_FATAL_WARNINGS=@HAVE_FATAL_WARNINGS@
HAVE_GCOV=@HAVE_GCOV@
EXTRA_LDFLAGS +=@EXTRA_LDFLAGS@
H_FILE_LIST = $(sort $(wildcard *.[h]))
C_FILE_LIST = $(sort $(wildcard *.c))
OBJS = $(C_FILE_LIST:.c=.o)
BINOBJS = $(foreach file, $(OBJS), $file)
CFLAGS += -ggdb $(HAVE_FATAL_WARNINGS) -O2 -DVERSION='"$(VERSION)"' -DPREFIX='"$(PREFIX)"' -fstack-protector-all -D_FORTIFY_SOURCE=2 -fPIE -pie -Wformat -Wformat-security
CFLAGS += -ggdb $(HAVE_FATAL_WARNINGS) -O2 -DVERSION='"$(VERSION)"' $(HAVE_GCOV) -DPREFIX='"$(PREFIX)"' -fstack-protector-all -D_FORTIFY_SOURCE=2 -fPIE -pie -Wformat -Wformat-security
LDFLAGS += -pie -Wl,-z,relro -Wl,-z,now -lpthread
%.o : %.c $(H_FILE_LIST)
$(CC) $(CFLAGS) $(INCLUDE) -c $< -o $@
ftee: $(OBJS)
$(CC) $(LDFLAGS) -o $@ $(OBJS)
$(CC) $(LDFLAGS) -o $@ $(OBJS) $(EXTRA_LDFLAGS)
clean:; rm -f *.o ftee
clean:; rm -f *.o ftee *.gcov *.gcda *.gcno
distclean: clean
rm -fr Makefile
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment