Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More tests + test coverage #1307

Merged
merged 9 commits into from Sep 29, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
496 changes: 30 additions & 466 deletions .gitignore

Large diffs are not rendered by default.

32 changes: 32 additions & 0 deletions build/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
.deps
.libs/
*~
.DS_Store
*.gcno
*.gcda
*.o
*.lo
*.la
*.so
*.loT
*.in
*.log
.libs
.coverage
Makefile
Makefile.fragments
Makefile.global
Makefile.objects
*.m4
autom4te.cache/
build/
config.*
configure
install-sh
libtool
ltmain.sh
missing
mkinstalldirs
modules/
run-tests.php
coverage/
17 changes: 17 additions & 0 deletions build/32bits/Makefile.frag
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
%.c : %.y

clean-coverage:
-rm -rf .coverage coverage

unit-tests: all
-@if test ! -z "$(PHP_EXECUTABLE)" && test -x "$(PHP_EXECUTABLE)"; then \
NO_INTERACTION=1 TEST_PHP_USER="$(srcdir)/tests/" $(MAKE) test && \
$(MAKE) install && \
(cd "$(top_srcdir)/../../"; $(PHP_EXECUTABLE) unit-tests/manual-unit.php) \
else \
echo "ERROR: Cannot run tests without CLI sapi."; \
fi

coverage: unit-tests clean-coverage
$(LCOV) --directory . --capture --base-directory=. --output-file .coverage
$(GENHTML) --legend --output-directory coverage/ --title "Phalcon code coverage" .coverage
62 changes: 62 additions & 0 deletions build/32bits/config.m4
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,66 @@ if test "$PHP_PHALCON" = "yes"; then

CPPFLAGS=$old_CPPFLAGS

PHP_ADD_MAKEFILE_FRAGMENT
fi

PHP_ARG_ENABLE(coverage, whether to include code coverage symbols,
[ --enable-coverage Enable code coverage symbols, maintainers only!], no, no)

if test "$PHP_COVERAGE" = "yes"; then
if test "$GCC" != "yes"; then
AC_MSG_ERROR([GCC is required for --enable-coverage])
fi

case `$php_shtool path $CC` in
*ccache*[)] gcc_ccache=yes;;
*[)] gcc_ccache=no;;
esac

if test "$gcc_ccache" = "yes" && (test -z "$CCACHE_DISABLE" || test "$CCACHE_DISABLE" != "1"); then
AC_MSG_ERROR([ccache must be disabled when --enable-coverage option is used. You can disable ccache by setting environment variable CCACHE_DISABLE=1.])
fi

lcov_version_list="1.5 1.6 1.7 1.9 1.10"

AC_CHECK_PROG(LCOV, lcov, lcov)
AC_CHECK_PROG(GENHTML, genhtml, genhtml)
PHP_SUBST(LCOV)
PHP_SUBST(GENHTML)

if test "$LCOV"; then
AC_CACHE_CHECK([for lcov version], php_cv_lcov_version, [
php_cv_lcov_version=invalid
lcov_version=`$LCOV -v 2>/dev/null | $SED -e 's/^.* //'` #'
for lcov_check_version in $lcov_version_list; do
if test "$lcov_version" = "$lcov_check_version"; then
php_cv_lcov_version="$lcov_check_version (ok)"
fi
done
])
else
lcov_msg="To enable code coverage reporting you must have one of the following LCOV versions installed: $lcov_version_list"
AC_MSG_ERROR([$lcov_msg])
fi

case $php_cv_lcov_version in
""|invalid[)]
lcov_msg="You must have one of the following versions of LCOV: $lcov_version_list (found: $lcov_version)."
AC_MSG_ERROR([$lcov_msg])
LCOV="exit 0;"
;;
esac

if test -z "$GENHTML"; then
AC_MSG_ERROR([Could not find genhtml from the LCOV package])
fi

changequote({,})
CFLAGS=`echo "$CFLAGS" | $SED -e 's/-O[0-9s]*//g'`
CXXFLAGS=`echo "$CXXFLAGS" | $SED -e 's/-O[0-9s]*//g'`
changequote([,])

CFLAGS="$CFLAGS -O0 --coverage"
CXXFLAGS="$CXXFLAGS -O0 --coverage"
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -precious-files-regex \.gcno\\\$$"
fi
Loading