Add coverage support.

Adds --enable-coverage to configure and a "coverage-html" make target.
The dependency stuff in the Makefile is a bit questionable, but the
best I could think of so far.

Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
pull/2/head
Reimar Döffinger 13 years ago
parent 51177b1fe9
commit 840ecc9e07
  1. 11
      Makefile
  2. 2
      common.mak
  3. 3
      configure

@ -137,6 +137,8 @@ clean::
$(RM) $(CLEANSUFFIXES) $(RM) $(CLEANSUFFIXES)
$(RM) $(TOOLS) $(RM) $(TOOLS)
$(RM) $(CLEANSUFFIXES:%=tools/%) $(RM) $(CLEANSUFFIXES:%=tools/%)
$(RM) coverage.info
$(RM) -r coverage-html
distclean:: distclean::
$(RM) $(DISTCLEANSUFFIXES) $(RM) $(DISTCLEANSUFFIXES)
@ -145,6 +147,15 @@ distclean::
config: config:
$(SRC_PATH)/configure $(value FFMPEG_CONFIGURATION) $(SRC_PATH)/configure $(value FFMPEG_CONFIGURATION)
# Without the sed genthml thinks "libavutil" and "./libavutil" are two different things
coverage.info: $(wildcard *.gcda *.gcno */*.gcda */*.gcno */*/*.gcda */*/*.gcno)
$(Q)lcov -c -d . -b . | sed -e 's#/./#/#g' > $@
coverage-html: coverage.info
$(Q)mkdir -p $@
$(Q)genhtml -o $@ $<
$(Q)touch $@
include $(SRC_PATH)/doc/Makefile include $(SRC_PATH)/doc/Makefile
include $(SRC_PATH)/tests/Makefile include $(SRC_PATH)/tests/Makefile

@ -113,7 +113,7 @@ $(TOOLOBJS): | tools
OBJDIRS := $(OBJDIRS) $(dir $(OBJS) $(HOSTOBJS) $(TESTOBJS)) OBJDIRS := $(OBJDIRS) $(dir $(OBJS) $(HOSTOBJS) $(TESTOBJS))
CLEANSUFFIXES = *.d *.o *~ *.ho *.map *.ver CLEANSUFFIXES = *.d *.o *~ *.ho *.map *.ver *.gcno *.gcda
DISTCLEANSUFFIXES = *.pc DISTCLEANSUFFIXES = *.pc
LIBSUFFIXES = *.a *.lib *.so *.so.* *.dylib *.dll *.def *.dll.a *.exp LIBSUFFIXES = *.a *.lib *.so *.so.* *.dylib *.dll *.def *.dll.a *.exp

3
configure vendored

@ -260,6 +260,7 @@ Advanced options (experts only):
--optflags override optimization-related compiler flags --optflags override optimization-related compiler flags
Developer options (useful when working on FFmpeg itself): Developer options (useful when working on FFmpeg itself):
--enable-coverage build with test coverage instrumentation
--disable-debug disable debugging symbols --disable-debug disable debugging symbols
--enable-debug=LEVEL set the debug level [$debuglevel] --enable-debug=LEVEL set the debug level [$debuglevel]
--disable-optimizations disable compiler optimizations --disable-optimizations disable compiler optimizations
@ -1242,6 +1243,7 @@ CMDLINE_SELECT="
$CONFIG_LIST $CONFIG_LIST
$THREADS_LIST $THREADS_LIST
asm asm
coverage
cross_compile cross_compile
debug debug
extra_warnings extra_warnings
@ -3194,6 +3196,7 @@ check_cpp_condition \
fi fi
enabled debug && add_cflags -g"$debuglevel" && add_asflags -g"$debuglevel" enabled debug && add_cflags -g"$debuglevel" && add_asflags -g"$debuglevel"
enabled coverage && add_cflags "-fprofile-arcs -ftest-coverage" && add_ldflags "-fprofile-arcs -ftest-coverage"
# add some useful compiler flags if supported # add some useful compiler flags if supported
check_cflags -Wdeclaration-after-statement check_cflags -Wdeclaration-after-statement

Loading…
Cancel
Save