👷 added option to switch off exceptions
This commit is contained in:
parent
839681ff9f
commit
268f5a3d0a
2 changed files with 14 additions and 9 deletions
|
@ -64,19 +64,15 @@ matrix:
|
||||||
- make cppcheck
|
- make cppcheck
|
||||||
|
|
||||||
# no exceptions
|
# no exceptions
|
||||||
|
|
||||||
- os: linux
|
- os: linux
|
||||||
compiler: gcc
|
compiler: gcc
|
||||||
env:
|
env:
|
||||||
- COMPILER=g++-4.9
|
- COMPILER=g++-4.9
|
||||||
- SPECIAL=no_exceptions
|
- CMAKE_OPTIONS=-DJSON_NoExceptions=ON
|
||||||
addons:
|
addons:
|
||||||
apt:
|
apt:
|
||||||
sources: ['ubuntu-toolchain-r-test']
|
sources: ['ubuntu-toolchain-r-test']
|
||||||
packages: ['g++-4.9', 'cppcheck', 'ninja-build']
|
packages: ['g++-4.9', 'ninja-build']
|
||||||
after_success:
|
|
||||||
- make clean
|
|
||||||
- CPPFLAGS="-DJSON_NOEXCEPTION" make check TEST_PATTERN="-e \"*\""
|
|
||||||
|
|
||||||
# Coveralls (http://gronlier.fr/blog/2015/01/adding-code-coverage-to-your-c-project/)
|
# Coveralls (http://gronlier.fr/blog/2015/01/adding-code-coverage-to-your-c-project/)
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
option(JSON_Sanitizer "Build test suite with Clang sanitizer" OFF)
|
option(JSON_Sanitizer "Build test suite with Clang sanitizer" OFF)
|
||||||
option(JSON_Valgrind "Execute test suite with Valgrind" OFF)
|
option(JSON_Valgrind "Execute test suite with Valgrind" OFF)
|
||||||
|
option(JSON_NoExceptions "Build test suite without exceptions" OFF)
|
||||||
|
|
||||||
if(JSON_Sanitizer)
|
if(JSON_Sanitizer)
|
||||||
message(STATUS "Building test suite with Clang sanitizer")
|
message(STATUS "Building test suite with Clang sanitizer")
|
||||||
|
@ -16,6 +17,14 @@ if(JSON_Valgrind)
|
||||||
separate_arguments(memcheck_command)
|
separate_arguments(memcheck_command)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(JSON_NoExceptions)
|
||||||
|
message(STATUS "Building test suite without exceptions")
|
||||||
|
if(NOT MSVC)
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DJSON_NOEXCEPTION")
|
||||||
|
endif()
|
||||||
|
set(CATCH_TEST_FILTER -e)
|
||||||
|
endif()
|
||||||
|
|
||||||
#############################################################################
|
#############################################################################
|
||||||
# Catch library with the main function to speed up build
|
# Catch library with the main function to speed up build
|
||||||
#############################################################################
|
#############################################################################
|
||||||
|
@ -62,20 +71,20 @@ foreach(file ${files})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_test(NAME "${testcase}_default"
|
add_test(NAME "${testcase}_default"
|
||||||
COMMAND ${testcase}
|
COMMAND ${testcase} ${CATCH_TEST_FILTER}
|
||||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||||
)
|
)
|
||||||
set_tests_properties("${testcase}_default" PROPERTIES LABELS "default")
|
set_tests_properties("${testcase}_default" PROPERTIES LABELS "default")
|
||||||
|
|
||||||
add_test(NAME "${testcase}_all"
|
add_test(NAME "${testcase}_all"
|
||||||
COMMAND ${testcase} "*"
|
COMMAND ${testcase} ${CATCH_TEST_FILTER} "*"
|
||||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||||
)
|
)
|
||||||
set_tests_properties("${testcase}_all" PROPERTIES LABELS "all")
|
set_tests_properties("${testcase}_all" PROPERTIES LABELS "all")
|
||||||
|
|
||||||
if(JSON_Valgrind)
|
if(JSON_Valgrind)
|
||||||
add_test(NAME "${testcase}_valgrind"
|
add_test(NAME "${testcase}_valgrind"
|
||||||
COMMAND ${memcheck_command} ${CMAKE_CURRENT_BINARY_DIR}/${testcase}
|
COMMAND ${memcheck_command} ${CMAKE_CURRENT_BINARY_DIR}/${testcase} ${CATCH_TEST_FILTER}
|
||||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||||
)
|
)
|
||||||
set_tests_properties("${testcase}_valgrind" PROPERTIES LABELS "valgrind")
|
set_tests_properties("${testcase}_valgrind" PROPERTIES LABELS "valgrind")
|
||||||
|
|
Loading…
Reference in a new issue