* commit 'a862c7d3368241e72a465ab944afa38ea62a6640': Integrate lcov/gcov into Libav Conflicts: Makefile common.mak Merged-by: Michael Niedermayer <michaelni@gmx.at>tags/n2.0
@@ -6,6 +6,8 @@ | |||||
*.dylib | *.dylib | ||||
*.exe | *.exe | ||||
*.exp | *.exp | ||||
*.gcda | |||||
*.gcno | |||||
*.h.c | *.h.c | ||||
*.ilk | *.ilk | ||||
*.lib | *.lib | ||||
@@ -24,6 +26,7 @@ | |||||
/ffprobe | /ffprobe | ||||
/ffserver | /ffserver | ||||
/config.* | /config.* | ||||
/coverage.info | |||||
/version.h | /version.h | ||||
/doc/*.1 | /doc/*.1 | ||||
/doc/*.3 | /doc/*.3 | ||||
@@ -44,6 +47,7 @@ | |||||
/doc/fate.txt | /doc/fate.txt | ||||
/doc/doxy/html/ | /doc/doxy/html/ | ||||
/doc/print_options | /doc/print_options | ||||
/lcov/ | |||||
/libavcodec/*_tablegen | /libavcodec/*_tablegen | ||||
/libavcodec/*_tables.c | /libavcodec/*_tables.c | ||||
/libavcodec/*_tables.h | /libavcodec/*_tables.h | ||||
@@ -154,8 +154,8 @@ clean:: | |||||
$(RM) $(ALLPROGS) $(ALLPROGS_G) | $(RM) $(ALLPROGS) $(ALLPROGS_G) | ||||
$(RM) $(CLEANSUFFIXES) | $(RM) $(CLEANSUFFIXES) | ||||
$(RM) $(CLEANSUFFIXES:%=tools/%) | $(RM) $(CLEANSUFFIXES:%=tools/%) | ||||
$(RM) coverage.info | |||||
$(RM) -r coverage-html | $(RM) -r coverage-html | ||||
$(RM) -rf coverage.info lcov | |||||
distclean:: | distclean:: | ||||
$(RM) $(DISTCLEANSUFFIXES) | $(RM) $(DISTCLEANSUFFIXES) | ||||
@@ -164,15 +164,6 @@ 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 $@ | |||||
check: all alltools examples testprogs fate | check: all alltools examples testprogs fate | ||||
include $(SRC_PATH)/doc/Makefile | include $(SRC_PATH)/doc/Makefile | ||||
@@ -316,7 +316,6 @@ Optimization options (experts only): | |||||
--disable-fast-unaligned consider unaligned accesses slow | --disable-fast-unaligned consider unaligned accesses slow | ||||
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 | ||||
@@ -1560,7 +1559,6 @@ CMDLINE_SELECT=" | |||||
$HAVE_LIST_CMDLINE | $HAVE_LIST_CMDLINE | ||||
$THREADS_LIST | $THREADS_LIST | ||||
asm | asm | ||||
coverage | |||||
cross_compile | cross_compile | ||||
debug | debug | ||||
extra_warnings | extra_warnings | ||||
@@ -2481,6 +2479,10 @@ case "$toolchain" in | |||||
ar_default="lib" | ar_default="lib" | ||||
target_os_default="win32" | target_os_default="win32" | ||||
;; | ;; | ||||
gcov) | |||||
add_cflags -fprofile-arcs -ftest-coverage | |||||
add_ldflags -fprofile-arcs -ftest-coverage | |||||
;; | |||||
?*) | ?*) | ||||
die "Unknown toolchain $toolchain" | die "Unknown toolchain $toolchain" | ||||
;; | ;; | ||||
@@ -4117,7 +4119,6 @@ enabled vdpau && | |||||
disabled iconv || check_func_headers iconv.h iconv || check_lib2 iconv.h iconv -liconv || disable iconv | disabled iconv || check_func_headers iconv.h iconv || check_lib2 iconv.h iconv -liconv || disable iconv | ||||
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" | |||||
test -n "$valgrind" && target_exec="$valgrind --error-exitcode=1 --malloc-fill=0x2a --track-origins=yes --leak-check=full --gen-suppressions=all --suppressions=$source_path/tests/fate-valgrind.supp" | test -n "$valgrind" && target_exec="$valgrind --error-exitcode=1 --malloc-fill=0x2a --track-origins=yes --leak-check=full --gen-suppressions=all --suppressions=$source_path/tests/fate-valgrind.supp" | ||||
# add some useful compiler flags if supported | # add some useful compiler flags if supported | ||||
@@ -580,6 +580,30 @@ message or introductionary message for the patch series that you post to | |||||
the ffmpeg-devel mailing list, a direct link to download the sample media. | the ffmpeg-devel mailing list, a direct link to download the sample media. | ||||
@subsection Visualizing Test Coverage | |||||
The FFmpeg build system allows visualizing the test coverage in an easy | |||||
manner with the coverage tools @code{gcov}/@code{lcov}. This involves | |||||
the following steps: | |||||
@enumerate | |||||
@item | |||||
Configure to compile with instrumentation enabled: | |||||
@code{configure --toolchain=gcov}. | |||||
@item | |||||
Run your test case, either manually or via FATE. This can be either | |||||
the full FATE regression suite, or any arbitrary invocation of any | |||||
front-end tool provided by FFmpeg, in any combination. | |||||
@item | |||||
Run @code{make lcov} to generate coverage data in HTML format. | |||||
@item | |||||
View @code{lcov/index.html} in your preferred HTML viewer. | |||||
@end enumerate | |||||
You can use the command @code{make lcov-reset} to reset the coverage | |||||
measurements. You will need to rerun @code{make lcov} after running a | |||||
new test. | |||||
@anchor{Release process} | @anchor{Release process} | ||||
@section Release process | @section Release process | ||||
@@ -160,6 +160,19 @@ $(FATE) $(FATE_TESTS-no): $(FATE_UTILS:%=tests/%$(HOSTEXESUF)) | |||||
fate-list: | fate-list: | ||||
@printf '%s\n' $(sort $(FATE)) | @printf '%s\n' $(sort $(FATE)) | ||||
coverage.info: TAG = LCOV | |||||
coverage.info: | |||||
$(M)lcov -d $(CURDIR) -b $(SRC_PATH) --capture | sed -e 's#/./#/#g' > $@ | |||||
lcov: TAG = GENHTML | |||||
lcov: coverage.info | |||||
$(M)genhtml -o $(CURDIR)/lcov $< | |||||
lcov-reset: TAG = LCOV | |||||
lcov-reset: | |||||
$(M)lcov -d $(CURDIR) --zerocounters | |||||
$(Q)$(RM) -f coverage.info | |||||
clean:: testclean | clean:: testclean | ||||
testclean: | testclean: | ||||
@@ -169,4 +182,5 @@ testclean: | |||||
-include $(wildcard tests/*.d) | -include $(wildcard tests/*.d) | ||||
.PHONY: fate* | |||||
.PHONY: fate* lcov lcov-reset | |||||
.INTERMEDIATE: coverage.info |