Browse Source

Integrate lcov/gcov into Libav

The gcov/lcov are a common toolchain for visualizing code coverage with
the GNU/Toolchain. The documentation and implementation of this
integration was heavily inspired from the blog entry by Mike Melanson:
http://multimedia.cx/eggs/using-lcov-with-ffmpeg/
tags/n2.0
Reinhard Tartler 12 years ago
parent
commit
a862c7d336
6 changed files with 49 additions and 2 deletions
  1. +4
    -0
      .gitignore
  2. +1
    -0
      Makefile
  3. +1
    -1
      common.mak
  4. +4
    -0
      configure
  5. +24
    -0
      doc/developer.texi
  6. +15
    -1
      tests/Makefile

+ 4
- 0
.gitignore View File

@@ -5,6 +5,8 @@
*.dll *.dll
*.exe *.exe
*.exp *.exp
*.gcda
*.gcno
*.h.c *.h.c
*.ilk *.ilk
*.lib *.lib
@@ -22,6 +24,7 @@
/avprobe /avprobe
/avserver /avserver
/config.* /config.*
/coverage.info
/version.h /version.h
/doc/*.1 /doc/*.1
/doc/*.html /doc/*.html
@@ -30,6 +33,7 @@
/doc/avoptions_format.texi /doc/avoptions_format.texi
/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


+ 1
- 0
Makefile View File

@@ -188,6 +188,7 @@ clean::
$(RM) $(ALLPROGS) $(RM) $(ALLPROGS)
$(RM) $(CLEANSUFFIXES) $(RM) $(CLEANSUFFIXES)
$(RM) $(CLEANSUFFIXES:%=tools/%) $(RM) $(CLEANSUFFIXES:%=tools/%)
$(RM) -rf coverage.info lcov


distclean:: distclean::
$(RM) $(DISTCLEANSUFFIXES) $(RM) $(DISTCLEANSUFFIXES)


+ 1
- 1
common.mak View File

@@ -51,7 +51,7 @@ $(TOOLOBJS): | tools


OBJDIRS := $(OBJDIRS) $(dir $(OBJS) $(HOBJS) $(HOSTOBJS) $(TESTOBJS)) OBJDIRS := $(OBJDIRS) $(dir $(OBJS) $(HOBJS) $(HOSTOBJS) $(TESTOBJS))


CLEANSUFFIXES = *.d *.o *~ *.h.c *.map *.ver
CLEANSUFFIXES = *.d *.o *~ *.h.c *.map *.ver *.gcno *.gcda
DISTCLEANSUFFIXES = *.pc DISTCLEANSUFFIXES = *.pc
LIBSUFFIXES = *.a *.lib *.so *.so.* *.dylib *.dll *.def *.dll.a LIBSUFFIXES = *.a *.lib *.so *.so.* *.dylib *.dll *.def *.dll.a




+ 4
- 0
configure View File

@@ -2173,6 +2173,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"
;; ;;


+ 24
- 0
doc/developer.texi View File

@@ -550,6 +550,30 @@ why the expected result changed.


Please refer to @url{fate.html}. Please refer to @url{fate.html}.


@subsection Visualizing Test Coverage

The Libav 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 Libav, 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




+ 15
- 1
tests/Makefile View File

@@ -123,6 +123,19 @@ $(FATE): $(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 -o $@

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:
@@ -132,4 +145,5 @@ testclean:


-include $(wildcard tests/*.d) -include $(wildcard tests/*.d)


.PHONY: fate*
.PHONY: fate* lcov lcov-reset
.INTERMEDIATE: coverage.info

Loading…
Cancel
Save