diff options
| -rw-r--r-- | .travis.yml | 18 | ||||
| -rw-r--r-- | Makefile | 8 | ||||
| -rw-r--r-- | src/config.m4 | 6 |
3 files changed, 23 insertions, 9 deletions
diff --git a/.travis.yml b/.travis.yml index 833ed97..b9b7c87 100644 --- a/.travis.yml +++ b/.travis.yml | |||
| @@ -9,6 +9,10 @@ php: | |||
| 9 | before_install: | 9 | before_install: |
| 10 | - pip install --user cpp-coveralls | 10 | - pip install --user cpp-coveralls |
| 11 | 11 | ||
| 12 | env: | ||
| 13 | - CC=clang | ||
| 14 | - CC=gcc | ||
| 15 | |||
| 12 | script: | 16 | script: |
| 13 | - cd src | 17 | - cd src |
| 14 | - phpize | 18 | - phpize |
| @@ -17,12 +21,14 @@ script: | |||
| 17 | - TEST_PHP_ARGS='-q' REPORT_EXIT_STATUS=1 make test | 21 | - TEST_PHP_ARGS='-q' REPORT_EXIT_STATUS=1 make test |
| 18 | 22 | ||
| 19 | after_success: | 23 | after_success: |
| 20 | - git clone https://github.com/linux-test-project/lcov.git --depth 1 | 24 | - 'if [ ${CC} = "gcc" ]; then |
| 21 | - rm -rf ./lcov/examples/ ./lcov/test/ | 25 | git clone https://github.com/linux-test-project/lcov.git --depth 1 ; |
| 22 | - ./lcov/bin/lcov -c -o ./COV.info --rc lcov_branch_coverage=1 --base-directory . --directory . | 26 | rm -rf ./lcov/examples/ ./lcov/test/ ; |
| 23 | - ./lcov/bin/lcov --remove ./COV.info '/usr/*' --remove ./COV.info '*tweetnacl.c' -o ./COV.info --rc lcov_branch_coverage=1 | 27 | ./lcov/bin/lcov -c -o ./COV.info --rc lcov_branch_coverage=1 --base-directory . --directory . ; |
| 24 | - ./lcov/bin/genhtml -o ./COV.html ./COV.info --branch-coverage | 28 | ./lcov/bin/lcov --remove ./COV.info "/usr/*" --remove ./COV.info "*tweetnacl.c" -o ./COV.info --rc lcov_branch_coverage=1 ; |
| 25 | - coveralls --exclude 'tweetnacl.c' | 29 | ./lcov/bin/genhtml -o ./COV.html ./COV.info --branch-coverage ; |
| 30 | coveralls --exclude "tweetnacl.c" ; | ||
| 31 | fi' | ||
| 26 | - cd .. | 32 | - cd .. |
| 27 | - make joomla | 33 | - make joomla |
| 28 | 34 | ||
| @@ -21,6 +21,13 @@ debug: ## compile a debug build | |||
| 21 | 21 | ||
| 22 | coverage: ## compile snuffleugpaus, and run the testsuite with coverage | 22 | coverage: ## compile snuffleugpaus, and run the testsuite with coverage |
| 23 | cd src; phpize | 23 | cd src; phpize |
| 24 | ifeq ($(CC),clang) | ||
| 25 | cd src; CFLAGS="-fprofile-instr-generate -fcoverage-mapping" ./configure --enable-snuffleupagus | ||
| 26 | make -C src | ||
| 27 | LLVM_PROFILE_FILE="sp_%p_%m.profraw" TEST_PHP_ARGS='-q' REPORT_EXIT_STATUS=1 make -C src test | ||
| 28 | llvm-profdata-4.0 merge ./src/*.profraw -o ./src/sp.profdata | ||
| 29 | llvm-cov report -instr-profile=./src/sp.profdata ./src/modules/snuffleupagus.so | ||
| 30 | else | ||
| 24 | cd src; ./configure --enable-snuffleupagus --enable-coverage | 31 | cd src; ./configure --enable-snuffleupagus --enable-coverage |
| 25 | make -C src | 32 | make -C src |
| 26 | rm -Rf src/COV.html | 33 | rm -Rf src/COV.html |
| @@ -28,6 +35,7 @@ coverage: ## compile snuffleugpaus, and run the testsuite with coverage | |||
| 28 | lcov --base-directory ./src --directory ./src -c -o ./src/COV.info --rc lcov_branch_coverage=1 | 35 | lcov --base-directory ./src --directory ./src -c -o ./src/COV.info --rc lcov_branch_coverage=1 |
| 29 | lcov --remove src/COV.info '/usr/*' --remove src/COV.info '*tweetnacl.c' -o src/COV.info --rc lcov_branch_coverage=1 | 36 | lcov --remove src/COV.info '/usr/*' --remove src/COV.info '*tweetnacl.c' -o src/COV.info --rc lcov_branch_coverage=1 |
| 30 | genhtml -o src/COV.html ./src/COV.info --branch-coverage | 37 | genhtml -o src/COV.html ./src/COV.info --branch-coverage |
| 38 | endif | ||
| 31 | 39 | ||
| 32 | bench: joomla ## run the benchmark | 40 | bench: joomla ## run the benchmark |
| 33 | 41 | ||
diff --git a/src/config.m4 b/src/config.m4 index 04eefa2..a0409de 100644 --- a/src/config.m4 +++ b/src/config.m4 | |||
| @@ -11,10 +11,10 @@ PHP_ARG_ENABLE(snuffleupagus, whether to enable snuffleupagus support, | |||
| 11 | [ --enable-snuffleupagus Enable snuffleupagus support]) | 11 | [ --enable-snuffleupagus Enable snuffleupagus support]) |
| 12 | 12 | ||
| 13 | PHP_ARG_ENABLE(coverage, whether to enable coverage support, | 13 | PHP_ARG_ENABLE(coverage, whether to enable coverage support, |
| 14 | [ --enable-coverage Enable coverage support]) | 14 | [ --enable-coverage Enable coverage support], no, no) |
| 15 | 15 | ||
| 16 | PHP_ARG_ENABLE(debug, whether to enable debug messages, | 16 | PHP_ARG_ENABLE(debug, whether to enable debug messages, |
| 17 | [ --enable-debug Enable debug messages]) | 17 | [ --enable-debug Enable debug messages], no, no) |
| 18 | 18 | ||
| 19 | CFLAGS="$CFLAGS" | 19 | CFLAGS="$CFLAGS" |
| 20 | CFLAGS="$CFLAGS -D_DEFAULT_SOURCE=1 -std=c99" | 20 | CFLAGS="$CFLAGS -D_DEFAULT_SOURCE=1 -std=c99" |
| @@ -33,7 +33,7 @@ AC_CHECK_LIB(pcre, pcre_compile, AC_DEFINE(HAVE_PCRE, 1, [have pcre])) | |||
| 33 | 33 | ||
| 34 | if test "$PHP_SNUFFLEUPAGUS" = "yes"; then | 34 | if test "$PHP_SNUFFLEUPAGUS" = "yes"; then |
| 35 | if test "$PHP_COVERAGE" = "yes"; then | 35 | if test "$PHP_COVERAGE" = "yes"; then |
| 36 | CFLAGS="$CFLAGS --coverage -lgcov -O1 -g" | 36 | CFLAGS="$CFLAGS --coverage -O0 -g" |
| 37 | fi | 37 | fi |
| 38 | PHP_NEW_EXTENSION(snuffleupagus, $sources, $ext_shared,-DZEND_ENABLE_STATIC_TSRMLS_CACHE=1) | 38 | PHP_NEW_EXTENSION(snuffleupagus, $sources, $ext_shared,-DZEND_ENABLE_STATIC_TSRMLS_CACHE=1) |
| 39 | fi | 39 | fi |
