Browse Source

fix coveralls on travis

Julius Pfrommer 10 years ago
parent
commit
0858982a0f
2 changed files with 11 additions and 11 deletions
  1. 3 4
      .travis.yml
  2. 8 7
      CMakeLists.txt

+ 3 - 4
.travis.yml

@@ -35,7 +35,7 @@ script:
    - make doc
    - echo "Debug build and unit tests"
    - make clean
-   - cmake -DCMAKE_BUILD_TYPE=Debug -DUNIT_TESTS=ON -DUSE_GCOV=ON .. 
+   - cmake -DCMAKE_BUILD_TYPE=Debug -DUNIT_TESTS=ON -DENABLE_COVERAGE=ON .. 
    - make && make test
 after_success:
    - git clone --depth=50 -b gh-pages https://$GITAUTH@github.com/acplt/open62541
@@ -48,9 +48,8 @@ after_success:
    - git add *
    - git commit -am "doxygen updated by travis-ci"
    - git push https://$GITAUTH@github.com/acplt/open62541
-   - cd ..
-   - cd ..
+   - cd .. && cd ..
    - rm -rf open62541
+   - coveralls -r ./CMakeFiles/open62541.dir 
    - cd ..
    - ./tools/.coverity.sh
-   - coveralls -b src --exclude doc --exclude examples --exclude tests --exclude wrappers -E '.*\.h' 

+ 8 - 7
CMakeLists.txt

@@ -44,14 +44,15 @@ if(UA_ENCODING_JSON)
     MATH(EXPR UA_ENCODING_AMOUNT "${UA_ENCODING_AMOUNT}+1")
 endif(UA_ENCODING_JSON)
 
-# gcov
-option(USE_GCOV "Enable gcov support" OFF)
-if(USE_GCOV)
+# coverage
+option(ENABLE_COVERAGE "Enable gcov coverage" OFF)
+if(ENABLE_COVERAGE)
     message(STATUS "Enabling gcov support")
-    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --coverage")
-    set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --coverage")
-    set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} --coverage")
-endif()
+	set(CMAKE_BUILD_TYPE DEBUG)
+    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fprofile-arcs -ftest-coverage")
+    set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fprofile-arcs -ftest-coverage")
+    set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fprofile-arcs -ftest-coverage")
+endif(ENABLE_COVERAGE)
 
 # directory for generated source files
 file(MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/src_generated")