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>
| ... | ... |
@@ -137,6 +137,8 @@ clean:: |
| 137 | 137 |
$(RM) $(CLEANSUFFIXES) |
| 138 | 138 |
$(RM) $(TOOLS) |
| 139 | 139 |
$(RM) $(CLEANSUFFIXES:%=tools/%) |
| 140 |
+ $(RM) coverage.info |
|
| 141 |
+ $(RM) -r coverage-html |
|
| 140 | 142 |
|
| 141 | 143 |
distclean:: |
| 142 | 144 |
$(RM) $(DISTCLEANSUFFIXES) |
| ... | ... |
@@ -145,6 +147,15 @@ distclean:: |
| 145 | 145 |
config: |
| 146 | 146 |
$(SRC_PATH)/configure $(value FFMPEG_CONFIGURATION) |
| 147 | 147 |
|
| 148 |
+# Without the sed genthml thinks "libavutil" and "./libavutil" are two different things |
|
| 149 |
+coverage.info: $(wildcard *.gcda *.gcno */*.gcda */*.gcno */*/*.gcda */*/*.gcno) |
|
| 150 |
+ $(Q)lcov -c -d . -b . | sed -e 's#/./#/#g' > $@ |
|
| 151 |
+ |
|
| 152 |
+coverage-html: coverage.info |
|
| 153 |
+ $(Q)mkdir -p $@ |
|
| 154 |
+ $(Q)genhtml -o $@ $< |
|
| 155 |
+ $(Q)touch $@ |
|
| 156 |
+ |
|
| 148 | 157 |
include $(SRC_PATH)/doc/Makefile |
| 149 | 158 |
include $(SRC_PATH)/tests/Makefile |
| 150 | 159 |
|
| ... | ... |
@@ -113,7 +113,7 @@ $(TOOLOBJS): | tools |
| 113 | 113 |
|
| 114 | 114 |
OBJDIRS := $(OBJDIRS) $(dir $(OBJS) $(HOSTOBJS) $(TESTOBJS)) |
| 115 | 115 |
|
| 116 |
-CLEANSUFFIXES = *.d *.o *~ *.ho *.map *.ver |
|
| 116 |
+CLEANSUFFIXES = *.d *.o *~ *.ho *.map *.ver *.gcno *.gcda |
|
| 117 | 117 |
DISTCLEANSUFFIXES = *.pc |
| 118 | 118 |
LIBSUFFIXES = *.a *.lib *.so *.so.* *.dylib *.dll *.def *.dll.a *.exp |
| 119 | 119 |
|
| ... | ... |
@@ -260,6 +260,7 @@ Advanced options (experts only): |
| 260 | 260 |
--optflags override optimization-related compiler flags |
| 261 | 261 |
|
| 262 | 262 |
Developer options (useful when working on FFmpeg itself): |
| 263 |
+ --enable-coverage build with test coverage instrumentation |
|
| 263 | 264 |
--disable-debug disable debugging symbols |
| 264 | 265 |
--enable-debug=LEVEL set the debug level [$debuglevel] |
| 265 | 266 |
--disable-optimizations disable compiler optimizations |
| ... | ... |
@@ -1242,6 +1243,7 @@ CMDLINE_SELECT=" |
| 1242 | 1242 |
$CONFIG_LIST |
| 1243 | 1243 |
$THREADS_LIST |
| 1244 | 1244 |
asm |
| 1245 |
+ coverage |
|
| 1245 | 1246 |
cross_compile |
| 1246 | 1247 |
debug |
| 1247 | 1248 |
extra_warnings |
| ... | ... |
@@ -3194,6 +3196,7 @@ check_cpp_condition \ |
| 3194 | 3194 |
fi |
| 3195 | 3195 |
|
| 3196 | 3196 |
enabled debug && add_cflags -g"$debuglevel" && add_asflags -g"$debuglevel" |
| 3197 |
+enabled coverage && add_cflags "-fprofile-arcs -ftest-coverage" && add_ldflags "-fprofile-arcs -ftest-coverage" |
|
| 3197 | 3198 |
|
| 3198 | 3199 |
# add some useful compiler flags if supported |
| 3199 | 3200 |
check_cflags -Wdeclaration-after-statement |