You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

79 lines
3.0 KiB

20 years ago
20 years ago
20 years ago
  1. #
  2. # LCOV
  3. #
  4. lcov: lcov-html
  5. lcov-test: all
  6. @echo "Running test suite"
  7. @find . -name \*.gcda -o -name \*.da -o -name \*.bbg? | xargs rm -f
  8. -@if test ! -z "$(PHP_EXECUTABLE)" && test -x "$(PHP_EXECUTABLE)"; then \
  9. NO_INTERACTION=1 \
  10. TEST_PHP_EXECUTABLE=$(PHP_EXECUTABLE) \
  11. TEST_PHP_SRCDIR=$(top_srcdir) \
  12. CC="$(CC)" \
  13. $(PHP_EXECUTABLE) -d 'open_basedir=' -d 'safe_mode=0' -d 'output_buffering=0' -d 'memory_limit=-1' $(top_srcdir)/run-tests.php -d 'extension_dir=modules/' -d `( . $(PHP_MODULES) ; echo extension=$$dlname)` tests/; \
  14. elif test ! -z "$(SAPI_CLI_PATH)" && test -x "$(SAPI_CLI_PATH)"; then \
  15. NO_INTERACTION=1 \
  16. TEST_PHP_EXECUTABLE=$(top_builddir)/$(SAPI_CLI_PATH) \
  17. TEST_PHP_SRCDIR=$(top_srcdir) \
  18. CC="$(CC)" \
  19. $(top_builddir)/$(SAPI_CLI_PATH) -d 'open_basedir=' -d 'safe_mode=0' -d 'output_buffering=0' -d 'memory_limit=-1' $(top_srcdir)/run-tests.php $(TESTS); \
  20. else \
  21. echo "ERROR: Cannot run tests without CLI sapi."; \
  22. fi
  23. php_lcov.info: lcov-test
  24. @echo "Generating data for $@"
  25. @rm -rf lcov_data/
  26. @$(mkinstalldirs) lcov_data/
  27. @echo
  28. -@find . -name \*.gcda -o -name \*.gcno -o -name \*.da -o -name \*.h | sed -e 's/^\.\///' | sed -e 's/\.gcda//g' -e 's/\.gcno//g' -e 's/\.da//g' | uniq | while read x; do \
  29. echo -n . ;\
  30. y=`echo $$x | sed -e 's!\.libs/!!'`; \
  31. dir=lcov_data/`dirname $$x`; \
  32. test -d "$$dir" || $(mkinstalldirs) "$$dir"; \
  33. if test -f "$(top_srcdir)/$$y.c"; then \
  34. ln -f -s $(top_srcdir)/$$y.c lcov_data/$$y.c; \
  35. fi; \
  36. if test -f "$(top_srcdir)/$$y.h"; then \
  37. ln -f -s $(top_srcdir)/$$y.h lcov_data/$$y.h; \
  38. fi; \
  39. if test -f "$(top_srcdir)/$$y.re"; then \
  40. ln -f -s $(top_srcdir)/$$y.re lcov_data/$$y.re; \
  41. fi; \
  42. if test -f "$(top_srcdir)/$$y.y"; then \
  43. ln -f -s $(top_srcdir)/$$y.y lcov_data/$$y.y; \
  44. fi; \
  45. if test -f "$(top_srcdir)/$$y.l"; then \
  46. ln -f -s $(top_srcdir)/$$y.l lcov_data/$$y.l; \
  47. fi; \
  48. if test -f "$(top_srcdir)/$$y"; then \
  49. ln -f -s $(top_srcdir)/$$y lcov_data/$$y; \
  50. fi; \
  51. if test -f "$(top_builddir)/$$y.c"; then \
  52. ln -f -s $(top_builddir)/$$y.c lcov_data/$$y.c; \
  53. fi; \
  54. test -f "$$x.gcno" && cp $$x.gcno lcov_data/$$y.gcno ; \
  55. test -f "$$x.gcda" && cp $$x.gcda lcov_data/$$y.gcda ; \
  56. test -f "$$x.da" && cp $$x.da lcov_data/$$y.da ; \
  57. test -f "$$x.bb" && cp $$x.bb lcov_data/$$y.bb ; \
  58. test -f "$$x.bbg" && cp $$x.bbg lcov_data/$$y.bbg ; \
  59. done
  60. for dir in ext/bcmath/libbcmath ext/date/lib ext/fileinfo/libmagic ext/gd/libgd ext/mbstring/libmbfl ext/mbstring/oniguruma ext/pcre/pcrelib ext/pdo_sqlite/libsqlite ext/sqlite/libsqlite ext/sqlite3/libsqlite ext/xmlrpc/libxmlrpc ext/zip/lib; do \
  61. test -d lcov_data/$$dir && rm -rf lcov_data/$$dir ; \
  62. done
  63. @echo
  64. @echo "Generating $@"
  65. @$(LTP) --directory lcov_data/ --capture --base-directory=lcov_data --output-file $@
  66. lcov-html: php_lcov.info
  67. @echo "Generating lcov HTML"
  68. @$(LTP_GENHTML) --legend --output-directory lcov_html/ --title "PHP Code Coverage" php_lcov.info
  69. lcov-clean:
  70. rm -f php_lcov.info
  71. rm -rf lcov_data/
  72. rm -rf lcov_html/