* commit 'a862c7d3368241e72a465ab944afa38ea62a6640':
Integrate lcov/gcov into Libav
Conflicts:
Makefile
common.mak
Merged-by: Michael Niedermayer <michaelni@gmx.at>
... | ... |
@@ -6,6 +6,8 @@ |
6 | 6 |
*.dylib |
7 | 7 |
*.exe |
8 | 8 |
*.exp |
9 |
+*.gcda |
|
10 |
+*.gcno |
|
9 | 11 |
*.h.c |
10 | 12 |
*.ilk |
11 | 13 |
*.lib |
... | ... |
@@ -24,6 +26,7 @@ |
24 | 24 |
/ffprobe |
25 | 25 |
/ffserver |
26 | 26 |
/config.* |
27 |
+/coverage.info |
|
27 | 28 |
/version.h |
28 | 29 |
/doc/*.1 |
29 | 30 |
/doc/*.3 |
... | ... |
@@ -44,6 +47,7 @@ |
44 | 44 |
/doc/fate.txt |
45 | 45 |
/doc/doxy/html/ |
46 | 46 |
/doc/print_options |
47 |
+/lcov/ |
|
47 | 48 |
/libavcodec/*_tablegen |
48 | 49 |
/libavcodec/*_tables.c |
49 | 50 |
/libavcodec/*_tables.h |
... | ... |
@@ -154,8 +154,8 @@ clean:: |
154 | 154 |
$(RM) $(ALLPROGS) $(ALLPROGS_G) |
155 | 155 |
$(RM) $(CLEANSUFFIXES) |
156 | 156 |
$(RM) $(CLEANSUFFIXES:%=tools/%) |
157 |
- $(RM) coverage.info |
|
158 | 157 |
$(RM) -r coverage-html |
158 |
+ $(RM) -rf coverage.info lcov |
|
159 | 159 |
|
160 | 160 |
distclean:: |
161 | 161 |
$(RM) $(DISTCLEANSUFFIXES) |
... | ... |
@@ -164,15 +164,6 @@ distclean:: |
164 | 164 |
config: |
165 | 165 |
$(SRC_PATH)/configure $(value FFMPEG_CONFIGURATION) |
166 | 166 |
|
167 |
-# Without the sed genthml thinks "libavutil" and "./libavutil" are two different things |
|
168 |
-coverage.info: $(wildcard *.gcda *.gcno */*.gcda */*.gcno */*/*.gcda */*/*.gcno) |
|
169 |
- $(Q)lcov -c -d . -b . | sed -e 's#/./#/#g' > $@ |
|
170 |
- |
|
171 |
-coverage-html: coverage.info |
|
172 |
- $(Q)mkdir -p $@ |
|
173 |
- $(Q)genhtml -o $@ $< |
|
174 |
- $(Q)touch $@ |
|
175 |
- |
|
176 | 167 |
check: all alltools examples testprogs fate |
177 | 168 |
|
178 | 169 |
include $(SRC_PATH)/doc/Makefile |
... | ... |
@@ -316,7 +316,6 @@ Optimization options (experts only): |
316 | 316 |
--disable-fast-unaligned consider unaligned accesses slow |
317 | 317 |
|
318 | 318 |
Developer options (useful when working on FFmpeg itself): |
319 |
- --enable-coverage build with test coverage instrumentation |
|
320 | 319 |
--disable-debug disable debugging symbols |
321 | 320 |
--enable-debug=LEVEL set the debug level [$debuglevel] |
322 | 321 |
--disable-optimizations disable compiler optimizations |
... | ... |
@@ -1560,7 +1559,6 @@ CMDLINE_SELECT=" |
1560 | 1560 |
$HAVE_LIST_CMDLINE |
1561 | 1561 |
$THREADS_LIST |
1562 | 1562 |
asm |
1563 |
- coverage |
|
1564 | 1563 |
cross_compile |
1565 | 1564 |
debug |
1566 | 1565 |
extra_warnings |
... | ... |
@@ -2481,6 +2479,10 @@ case "$toolchain" in |
2481 | 2481 |
ar_default="lib" |
2482 | 2482 |
target_os_default="win32" |
2483 | 2483 |
;; |
2484 |
+ gcov) |
|
2485 |
+ add_cflags -fprofile-arcs -ftest-coverage |
|
2486 |
+ add_ldflags -fprofile-arcs -ftest-coverage |
|
2487 |
+ ;; |
|
2484 | 2488 |
?*) |
2485 | 2489 |
die "Unknown toolchain $toolchain" |
2486 | 2490 |
;; |
... | ... |
@@ -4117,7 +4119,6 @@ enabled vdpau && |
4117 | 4117 |
disabled iconv || check_func_headers iconv.h iconv || check_lib2 iconv.h iconv -liconv || disable iconv |
4118 | 4118 |
|
4119 | 4119 |
enabled debug && add_cflags -g"$debuglevel" && add_asflags -g"$debuglevel" |
4120 |
-enabled coverage && add_cflags "-fprofile-arcs -ftest-coverage" && add_ldflags "-fprofile-arcs -ftest-coverage" |
|
4121 | 4120 |
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" |
4122 | 4121 |
|
4123 | 4122 |
# add some useful compiler flags if supported |
... | ... |
@@ -580,6 +580,30 @@ message or introductionary message for the patch series that you post to |
580 | 580 |
the ffmpeg-devel mailing list, a direct link to download the sample media. |
581 | 581 |
|
582 | 582 |
|
583 |
+@subsection Visualizing Test Coverage |
|
584 |
+ |
|
585 |
+The FFmpeg build system allows visualizing the test coverage in an easy |
|
586 |
+manner with the coverage tools @code{gcov}/@code{lcov}. This involves |
|
587 |
+the following steps: |
|
588 |
+ |
|
589 |
+@enumerate |
|
590 |
+@item |
|
591 |
+ Configure to compile with instrumentation enabled: |
|
592 |
+ @code{configure --toolchain=gcov}. |
|
593 |
+@item |
|
594 |
+ Run your test case, either manually or via FATE. This can be either |
|
595 |
+ the full FATE regression suite, or any arbitrary invocation of any |
|
596 |
+ front-end tool provided by FFmpeg, in any combination. |
|
597 |
+@item |
|
598 |
+ Run @code{make lcov} to generate coverage data in HTML format. |
|
599 |
+@item |
|
600 |
+ View @code{lcov/index.html} in your preferred HTML viewer. |
|
601 |
+@end enumerate |
|
602 |
+ |
|
603 |
+You can use the command @code{make lcov-reset} to reset the coverage |
|
604 |
+measurements. You will need to rerun @code{make lcov} after running a |
|
605 |
+new test. |
|
606 |
+ |
|
583 | 607 |
@anchor{Release process} |
584 | 608 |
@section Release process |
585 | 609 |
|
... | ... |
@@ -160,6 +160,19 @@ $(FATE) $(FATE_TESTS-no): $(FATE_UTILS:%=tests/%$(HOSTEXESUF)) |
160 | 160 |
fate-list: |
161 | 161 |
@printf '%s\n' $(sort $(FATE)) |
162 | 162 |
|
163 |
+coverage.info: TAG = LCOV |
|
164 |
+coverage.info: |
|
165 |
+ $(M)lcov -d $(CURDIR) -b $(SRC_PATH) --capture | sed -e 's#/./#/#g' > $@ |
|
166 |
+ |
|
167 |
+lcov: TAG = GENHTML |
|
168 |
+lcov: coverage.info |
|
169 |
+ $(M)genhtml -o $(CURDIR)/lcov $< |
|
170 |
+ |
|
171 |
+lcov-reset: TAG = LCOV |
|
172 |
+lcov-reset: |
|
173 |
+ $(M)lcov -d $(CURDIR) --zerocounters |
|
174 |
+ $(Q)$(RM) -f coverage.info |
|
175 |
+ |
|
163 | 176 |
clean:: testclean |
164 | 177 |
|
165 | 178 |
testclean: |
... | ... |
@@ -169,4 +182,5 @@ testclean: |
169 | 169 |
|
170 | 170 |
-include $(wildcard tests/*.d) |
171 | 171 |
|
172 |
-.PHONY: fate* |
|
172 |
+.PHONY: fate* lcov lcov-reset |
|
173 |
+.INTERMEDIATE: coverage.info |