Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
json
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
json
Commits
1b3df3a6
Unverified
Commit
1b3df3a6
authored
Oct 04, 2017
by
Niels Lohmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
🔨
trying to use Coveralls with CMake #698
parent
99ee4c1e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
18 deletions
+27
-18
.travis.yml
.travis.yml
+3
-13
test/CMakeLists.txt
test/CMakeLists.txt
+24
-5
No files found.
.travis.yml
View file @
1b3df3a6
...
...
@@ -81,24 +81,14 @@ matrix:
addons
:
apt
:
sources
:
[
'
ubuntu-toolchain-r-test'
]
packages
:
[
'
g++-4.9'
,
'
ruby'
,
'
ninja-build'
]
packages
:
[
'
g++-4.9'
,
'
ninja-build'
]
before_script
:
-
wget http://ftp.de.debian.org/debian/pool/main/l/lcov/lcov_1.11.orig.tar.gz
-
tar xf lcov_1.11.orig.tar.gz
-
sudo make -C lcov-1.11/ install
-
gem install coveralls-lcov
-
pip install --user cpp-coveralls
after_success
:
-
make clean
-
CXXFLAGS="--coverage -g -O0" CPPFLAGS="-DNDEBUG" make json_unit
-
test/json_unit "*"
-
coveralls --build-root test --exclude src/catch.hpp --exclude src/unit-algorithms.cpp --exclude src/unit-allocator.cpp --exclude src/unit-capacity.cpp --exclude src/unit-class_const_iterator.cpp --exclude src/unit-class_iterator.cpp --exclude src/unit-class_lexer.cpp --exclude src/unit-class_parser.cpp --exclude src/unit-comparison.cpp --exclude src/unit-concepts.cpp --exclude src/unit-constructor1.cpp --exclude src/unit-constructor2.cpp --exclude src/unit-convenience.cpp --exclude src/unit-conversions.cpp --exclude src/unit-deserialization.cpp --exclude src/unit-element_access1.cpp --exclude src/unit-element_access2.cpp --exclude src/unit-inspection.cpp --exclude src/unit-iterator_wrapper.cpp --exclude src/unit-iterators1.cpp --exclude src/unit-iterators2.cpp --exclude src/unit-json_patch.cpp --exclude src/unit-json_pointer.cpp --exclude src/unit-modifiers.cpp --exclude src/unit-pointer_access.cpp --exclude src/unit-readme.cpp --exclude src/unit-reference_access.cpp --exclude src/unit-regression.cpp --exclude src/unit-serialization.cpp --exclude src/unit-testsuites.cpp --exclude src/unit-unicode.cpp --include ../src/json.hpp --gcov-options '\-lp' --gcov 'gcov-4.9'
-
lcov --directory src --directory test/src --capture --output-file coverage.info --rc lcov_branch_coverage=1 --no-external
-
lcov --remove coverage.info 'test/src/*' --output-file coverage.info --rc lcov_branch_coverage=1
-
lcov --list coverage.info --rc lcov_branch_coverage=1
-
coveralls-lcov --repo-token F9bs4Nop10JRgqPQXRcifyQKYhb3FczkS coverage.info
-
coveralls --build-root test --include src --gcov 'gcov-4.9' --gcov-options '\-lp'
env
:
-
COMPILER=g++-4.9
-
CMAKE_OPTIONS=-DJSON_Coverage=ON
-
SPECIAL=coveralls
# Coverity (only for branch coverity_scan)
...
...
test/CMakeLists.txt
View file @
1b3df3a6
option
(
JSON_Sanitizer
"Build test suite with Clang sanitizer"
OFF
)
option
(
JSON_Valgrind
"Execute test suite with Valgrind"
OFF
)
option
(
JSON_NoExceptions
"Build test suite without exceptions"
OFF
)
option
(
JSON_Coverage
"Build test suite with coverage information"
OFF
)
if
(
JSON_Sanitizer
)
message
(
STATUS
"Building test suite with Clang sanitizer"
)
...
...
@@ -25,6 +26,29 @@ if(JSON_NoExceptions)
set
(
CATCH_TEST_FILTER -e
)
endif
()
if
(
JSON_Coverage
)
message
(
STATUS
"Building test suite with coverage information"
)
if
(
NOT
"
${
CMAKE_CXX_COMPILER_ID
}
"
STREQUAL
"GNU"
)
message
(
FATAL_ERROR
"JSON_Coverage requires GCC."
)
endif
()
# enable profiling
set
(
CMAKE_CXX_FLAGS
"--coverage -g -O0 -fprofile-arcs -ftest-coverage"
)
# from https://github.com/RWTH-HPC/CMake-codecov/blob/master/cmake/FindGcov.cmake
get_filename_component
(
COMPILER_PATH
"
${
CMAKE_CXX_COMPILER
}
"
PATH
)
string
(
REGEX MATCH
"^[0-9]+"
GCC_VERSION
"
${
CMAKE_CXX_COMPILER_VERSION
}
"
)
find_program
(
GCOV_BIN NAMES gcov-
${
GCC_VERSION
}
gcov HINTS
${
COMPILER_PATH
}
)
# add target to collect coverage information and generate HTML file
add_custom_target
(
lcov_html
COMMAND lcov --directory . --capture --output-file json.info --gcov-tool
${
GCOV_BIN
}
--rc lcov_branch_coverage=1
COMMAND lcov -e json.info
${
CMAKE_SOURCE_DIR
}
/src/json.hpp --output-file json.info.filtered --rc lcov_branch_coverage=1
COMMAND genhtml --title
"JSON for Modern C++"
--legend --demangle-cpp --output-directory html --show-details --branch-coverage json.info.filtered
COMMENT
"Generating HTML report test/html/index.html"
)
endif
()
#############################################################################
# Catch library with the main function to speed up build
#############################################################################
...
...
@@ -65,11 +89,6 @@ foreach(file ${files})
set_target_properties
(
${
testcase
}
PROPERTIES COMPILE_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-Wno-deprecated -Wno-float-equal"
)
endif
()
include
(
cotire OPTIONAL
)
if
(
COMMAND cotire
)
cotire
(
${
testcase
}
)
endif
()
add_test
(
NAME
"
${
testcase
}
_default"
COMMAND
${
testcase
}
${
CATCH_TEST_FILTER
}
WORKING_DIRECTORY
${
CMAKE_SOURCE_DIR
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment