]> granicus.if.org Git - php/commitdiff
LTP/gcov/lcov
authorMichael Wallner <mike@php.net>
Mon, 23 Jan 2012 09:48:18 +0000 (09:48 +0000)
committerMichael Wallner <mike@php.net>
Mon, 23 Jan 2012 09:48:18 +0000 (09:48 +0000)
- 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

Makefile.gcov
configure.in

index e499c833bbeaec8ad6d97f389205b7cf944e8f4e..db9169b89643a4073513be166c2705f370787ec4 100644 (file)
@@ -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 $@"
index a64a500220d9e60099c45e656188787e4fba48e0..8e599aa1c77d5041d1610bef0f23e1a7f796224f 100644 (file)
@@ -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)