diff options
| author | Michael Wallner <mike@php.net> | 2012-01-23 09:48:18 +0000 |
|---|---|---|
| committer | Michael Wallner <mike@php.net> | 2012-01-23 09:48:18 +0000 |
| commit | 65948ec3545bcec872a36f584fb2072a358aae1c (patch) | |
| tree | 6e00cfff82f1a61530ee028304fe059c25390eb8 | |
| parent | 7a7e14f502d661717a2931e92b866c2eb5137d93 (diff) | |
| download | php-git-65948ec3545bcec872a36f584fb2072a358aae1c.tar.gz | |
LTP/gcov/lcov
- allow ltp v1.9
- make sure `test`s are catched by `if`s
- introduce LCOV_INCLUDE make variable, simple coverage for your extension:
./configure --enable-gcov && make lcov TESTS=~/src/pecl/http/test LCOV_INCLUDE=/http/
coverage takes just a few seconds instead of a few minutes for the full source tree
| -rw-r--r-- | Makefile.gcov | 30 | ||||
| -rw-r--r-- | configure.in | 2 |
2 files changed, 23 insertions, 9 deletions
diff --git a/Makefile.gcov b/Makefile.gcov index e499c833bb..db9169b896 100644 --- a/Makefile.gcov +++ b/Makefile.gcov @@ -3,6 +3,8 @@ # LCOV # +LCOV_INCLUDE="." + lcov: lcov-html lcov-test: lcov-clean-data test @@ -12,7 +14,7 @@ php_lcov.info: lcov-test @rm -rf lcov_data/ @$(mkinstalldirs) lcov_data/ @echo - -@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 \ + -@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' | $(EGREP) $(LCOV_INCLUDE) | uniq | while read x; do \ echo -n . ;\ y=`echo $$x | sed -e 's!\.libs/!!'`; \ dir=lcov_data/`dirname $$x`; \ @@ -38,14 +40,26 @@ php_lcov.info: lcov-test if test -f "$(top_builddir)/$$y.c"; then \ ln -f -s $(top_builddir)/$$y.c lcov_data/$$y.c; \ fi; \ - test -f "$$x.gcno" && cp $$x.gcno lcov_data/$$y.gcno ; \ - test -f "$$x.gcda" && cp $$x.gcda lcov_data/$$y.gcda ; \ - test -f "$$x.da" && cp $$x.da lcov_data/$$y.da ; \ - test -f "$$x.bb" && cp $$x.bb lcov_data/$$y.bb ; \ - test -f "$$x.bbg" && cp $$x.bbg lcov_data/$$y.bbg ; \ - done + if test -f "$$x.gcno"; then \ + cp $$x.gcno lcov_data/$$y.gcno ; \ + fi; \ + if test -f "$$x.gcda"; then \ + cp $$x.gcda lcov_data/$$y.gcda ; \ + fi; \ + if test -f "$$x.da"; then \ + cp $$x.da lcov_data/$$y.da ; \ + fi; \ + if test -f "$$x.bb"; then \ + cp $$x.bb lcov_data/$$y.bb ; \ + fi; \ + if test -f "$$x.bbg"; then \ + cp $$x.bbg lcov_data/$$y.bbg ; \ + fi; \ + done; \ for dir in ext/bcmath/libbcmath 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 \ - test -d lcov_data/$$dir && rm -rf lcov_data/$$dir ; \ + if test -d lcov_data/$$dir; then \ + rm -rf lcov_data/$$dir ; \ + fi; \ done @echo @echo "Generating $@" diff --git a/configure.in b/configure.in index a64a500220..8e599aa1c7 100644 --- a/configure.in +++ b/configure.in @@ -784,7 +784,7 @@ if test "$PHP_GCOV" = "yes"; then AC_MSG_ERROR([ccache must be disabled when --enable-gcov option is used. You can disable ccache by setting environment variable CCACHE_DISABLE=1.]) fi - ltp_version_list="1.5 1.6 1.7" + ltp_version_list="1.5 1.6 1.7 1.9" AC_CHECK_PROG(LTP, lcov, lcov) AC_CHECK_PROG(LTP_GENHTML, genhtml, genhtml) |
