mike                                     Mon, 23 Jan 2012 09:48:18 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=322616

Log:
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

Changed paths:
    U   php/php-src/trunk/Makefile.gcov
    U   php/php-src/trunk/configure.in

Modified: php/php-src/trunk/Makefile.gcov
===================================================================
--- php/php-src/trunk/Makefile.gcov     2012-01-23 09:26:27 UTC (rev 322615)
+++ php/php-src/trunk/Makefile.gcov     2012-01-23 09:48:18 UTC (rev 322616)
@@ -3,6 +3,8 @@
 # LCOV
 #

+LCOV_INCLUDE="."
+
 lcov: lcov-html

 lcov-test: lcov-clean-data test
@@ -12,7 +14,7 @@
        @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 @@
                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 $@"

Modified: php/php-src/trunk/configure.in
===================================================================
--- php/php-src/trunk/configure.in      2012-01-23 09:26:27 UTC (rev 322615)
+++ php/php-src/trunk/configure.in      2012-01-23 09:48:18 UTC (rev 322616)
@@ -784,7 +784,7 @@
     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)

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to