diff --git a/.travis.yml b/.travis.yml index e0a47f22c2..8f1fe6e03f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,6 +10,7 @@ addons: - check - doxygen - cmake + - lcov - gradle - libgmp-dev @@ -62,7 +63,18 @@ matrix: - sudo pip install --upgrade Sphinx - npm install -g mocha - npm install - script: make test-c test-haskell test-java test-javascript + script: + - make test-c + - make test-haskell + - make test-java + - make test-javascript + - env: + - TRAVIS_TARGET=codecov + - CMAKEFLAGS="-DCODE_COVERAGE=ON -DCMAKE_BUILD_TYPE=Debug" + script: + - make test-c + after_success: + bash <(curl -s https://codecov.io/bash) -s c/build || echo "Codecov did not collect coverage reports"; deploy: provider: releases diff --git a/Makefile b/Makefile index 6e1cb3f344..c27c0fa654 100644 --- a/Makefile +++ b/Makefile @@ -18,7 +18,7 @@ SBP_PATCH_VERSION := $(word 3, $(subst ., , $(SBP_VERSION))) CHANGELOG_MAX_ISSUES := 100 -.PHONY: help test release dist silly all docs pdf html c deps-c gen-c test-c python deps-python gen-python test-python javascript deps-javascript gen-javascript test-javascript java deps-java gen-java test-java haskell deps-haskell gen-haskell test-haskell haskell deps-protobuf gen-protobuf test-protobuf verify-prereq-generator verify-prereq-c verify-prereq-javascript verify-prereq-python verify-prereq-java verify-prereq-haskell verify-prereq-protobuf mapping +.PHONY: help test release dist clean all docs pdf html c deps-c gen-c test-c python deps-python gen-python test-python javascript deps-javascript gen-javascript test-javascript java deps-java gen-java test-java haskell deps-haskell gen-haskell test-haskell haskell deps-protobuf gen-protobuf test-protobuf verify-prereq-generator verify-prereq-c verify-prereq-javascript verify-prereq-python verify-prereq-java verify-prereq-haskell verify-prereq-protobuf mapping # Functions define announce-begin @@ -43,6 +43,7 @@ help: @echo "Please use \`make ' where is one of" @echo " help to display this help message" @echo " all to make SBP clients across all languages" + @echo " clean to remove any output files" @echo " c to make C headers" @echo " dist to distribute packages" @echo " docs to make HTML and pdf documentation" @@ -58,6 +59,9 @@ help: @echo all: c python pythonNG javascript java docs haskell protobuf +clean: + @echo "Removing the ./c/build directory..." + rm -r $(SWIFTNAV_ROOT)/c/build docs: verify-prereq-docs pdf html c: deps-c gen-c test-c @@ -212,7 +216,7 @@ test-c: $(call announce-begin,"Running C tests") cd $(SWIFTNAV_ROOT)/c; \ mkdir -p build/ && cd build/; \ - cmake ../; \ + cmake $(CMAKEFLAGS) ../; \ make $(call announce-end,"Finished running C tests") @@ -247,7 +251,7 @@ test-protobuf: dist-python: $(call announce-begin,"Deploying Python package") - make -C $(SWIFTNAV_ROOT)/python SBP_VERSION="$(SBP_MAJOR_VERSION).$(SBP_MINOR_VERSION).$(SBP_PATCH_VERSION)" deploy + make -C $(SWIFTNAV_ROOT)/python SBP_VERSION="$(SBP_MAJOR_VERSION).$(SBP_MINOR_VERSION).$(SBP_PATCH_VERSION)" deploy $(call announce-end,"Finished deploying Python package") dist-javascript: diff --git a/c/CMakeLists.txt b/c/CMakeLists.txt index 3e4f3499fd..dbfaa74752 100644 --- a/c/CMakeLists.txt +++ b/c/CMakeLists.txt @@ -11,6 +11,8 @@ swift_create_project_options( HAS_DOCS TEST_PACKAGES "Check" ) +include(CodeCoverage) +add_code_coverage_all_targets() ########################################################## # Set some reasonable default compiler flags. diff --git a/c/cmake/common b/c/cmake/common index ed44946e1a..0616a352eb 160000 --- a/c/cmake/common +++ b/c/cmake/common @@ -1 +1 @@ -Subproject commit ed44946e1acf06acea6963393a56879caea600de +Subproject commit 0616a352eb7b3141393efb65614fdae90f4d7e6a diff --git a/c/src/CMakeLists.txt b/c/src/CMakeLists.txt index 1568255e2f..c58749f3c0 100644 --- a/c/src/CMakeLists.txt +++ b/c/src/CMakeLists.txt @@ -46,6 +46,7 @@ set_target_properties(sbp PROPERTIES POSITION_INDEPENDENT_CODE ON C_STANDARD 99 C_STANDARD_REQUIRED ON) +target_code_coverage(sbp AUTO ALL) install(TARGETS sbp EXPORT sbp-export diff --git a/c/test/CMakeLists.txt b/c/test/CMakeLists.txt index 71300d8d33..4dcd99f225 100644 --- a/c/test/CMakeLists.txt +++ b/c/test/CMakeLists.txt @@ -30,6 +30,7 @@ else() target_link_libraries(test_libsbp PRIVATE "-L/usr/local/lib") endif() endif() +target_code_coverage(test_libsbp AUTO ALL) add_custom_command( TARGET test_libsbp POST_BUILD diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 0000000000..878c974688 --- /dev/null +++ b/codecov.yml @@ -0,0 +1,13 @@ +coverage: + status: + project: + tests: + target: 30% + paths: + - c/test/ + libsbp: + paths: + - c/include/ + - c/src/ + +comment: off