Makefile.gcov 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. #
  2. # GCOV
  3. #
  4. LTP = lcov
  5. LTP_GENHTML = genhtml
  6. LCOV_EXCLUDES = \
  7. '$(top_srcdir)/ext/bcmath/libbcmath/*' \
  8. '$(top_srcdir)/ext/date/lib/*' \
  9. '$(top_srcdir)/ext/fileinfo/libmagic/*' \
  10. '$(top_srcdir)/ext/gd/libgd/*' \
  11. '$(top_srcdir)/ext/hash/sha3/*' \
  12. '$(top_srcdir)/ext/mbstring/libmbfl/*' \
  13. '$(top_srcdir)/ext/opcache/jit/libudis86/*' \
  14. '$(top_srcdir)/ext/pcre/pcre2lib/*' \
  15. '$(top_srcdir)/parse_date.re' \
  16. '$(top_srcdir)/parse_iso_intervals.re'
  17. GCOVR_EXCLUDES = \
  18. 'ext/bcmath/libbcmath/.*' \
  19. 'ext/date/lib/.*' \
  20. 'ext/fileinfo/libmagic/.*' \
  21. 'ext/gd/libgd/.*' \
  22. 'ext/hash/sha3/.*' \
  23. 'ext/mbstring/libmbfl/.*' \
  24. 'ext/opcache/jit/libudis86/.*' \
  25. 'ext/pcre/pcre2lib/.*'
  26. lcov: lcov-html
  27. php_lcov.info:
  28. @echo "Generating lcov data for $@"
  29. $(LTP) --capture --no-external --directory . --output-file $@
  30. @echo "Stripping bundled libraries from $@"
  31. $(LTP) --output-file $@ --remove $@ '*/<stdout>' $(LCOV_EXCLUDES)
  32. lcov-html: php_lcov.info
  33. @echo "Generating lcov HTML"
  34. $(LTP_GENHTML) --legend --output-directory lcov_html/ --title "PHP Code Coverage" php_lcov.info
  35. lcov-clean:
  36. rm -f php_lcov.info
  37. rm -rf lcov_html/
  38. lcov-clean-data:
  39. @find . -name \*.gcda -o -name \*.da -o -name \*.bbg? | xargs rm -f
  40. gcovr-html:
  41. @echo "Generating gcovr HTML"
  42. @rm -rf gcovr_html/
  43. @mkdir gcovr_html
  44. gcovr -sr . -o gcovr_html/index.html --html --html-details \
  45. --exclude-directories 'ext/date/lib$$' \
  46. $(foreach lib, $(GCOVR_EXCLUDES), -e $(lib))
  47. gcovr-xml:
  48. @echo "Generating gcovr XML"
  49. @rm -f gcovr.xml
  50. gcovr -sr . -o gcovr.xml --xml \
  51. --exclude-directories 'ext/date/lib$$' \
  52. $(foreach lib, $(GCOVR_EXCLUDES), -e $(lib))
  53. .PHONY: gcovr-html lcov-html php_lcov.info