1
0
mirror of https://github.com/catchorg/Catch2.git synced 2025-01-15 14:48:00 +00:00

Compare commits

...

3 Commits

Author SHA1 Message Date
Martin Hořeňovský
ebeeaaeec6
Reenable appveyor for CI 2019-12-16 00:15:30 +01:00
Martin Hořeňovský
69bd213c40
Reenable travis for CI 2019-12-16 00:15:10 +01:00
Martin Hořeňovský
5fbf04cd59
Redo how the separate compilation tests are handled 2019-12-15 20:33:39 +01:00
8 changed files with 32 additions and 36 deletions

View File

@ -158,24 +158,22 @@ matrix:
# Special builds, e.g. conan
- language: python
python:
- "3.7"
install:
- pip install conan-package-tools
env:
- CONAN_GCC_VERSIONS=8
- CONAN_DOCKER_IMAGE=conanio/gcc8
- CPP14=1
script:
- python .conan/build.py
# # Special builds, e.g. conan
# - language: python
# python:
# - "3.7"
# install:
# - pip install conan-package-tools
# env:
# - CONAN_GCC_VERSIONS=8
# - CONAN_DOCKER_IMAGE=conanio/gcc8
# - CPP14=1
# script:
# - python .conan/build.py
before_script:
- export CXX=${COMPILER}
- cd ${TRAVIS_BUILD_DIR}
# Regenerate single header file, so it is tested in the examples...
- python tools/scripts/generateSingleHeader.py
- |
if [[ ${CPP17} -eq 1 ]]; then

View File

@ -36,7 +36,7 @@ set(BENCHMARK_DIR ${CATCH_DIR}/tests/Benchmark)
set(EXAMPLES_DIR ${CATCH_DIR}/examples)
# We need to bring-in the variables defined there to this scope
include(src/CMakeLists.txt)
add_subdirectory(src)
# Build tests only if requested
if (BUILD_TESTING AND CATCH_BUILD_TESTING AND NOT_SUBPROJECT)

View File

@ -26,7 +26,7 @@ before_build:
# Indirection because appveyor doesn't handle multiline batch scripts properly
# https://stackoverflow.com/questions/37627248/how-to-split-a-command-over-multiple-lines-in-appveyor-yml/37647169#37647169
# https://help.appveyor.com/discussions/questions/3888-multi-line-cmd-or-powershell-warning-ignore
- cmd: .\misc\appveyorBuildConfigurationScript.bat
- cmd: .\tools\misc\appveyorBuildConfigurationScript.bat
# build with MSBuild
@ -37,7 +37,7 @@ build:
test_script:
- set CTEST_OUTPUT_ON_FAILURE=1
- cmd: .\misc\appveyorTestRunScript.bat
- cmd: .\tools\misc\appveyorTestRunScript.bat
# Sadly we cannot use the standard "dimensions" based approach towards

View File

@ -20,8 +20,8 @@ add_executable( 020-MultiFile
add_executable(231-Cfg_OutputStreams
231-Cfg-OutputStreams.cpp
)
StampOutLibrary(231-Cfg_OutputStreams)
target_compile_definitions(Catch2_231-Cfg_OutputStreams PUBLIC CATCH_CONFIG_NOSTDOUT)
target_link_libraries(231-Cfg_OutputStreams Catch2_buildall_interface)
target_compile_definitions(231-Cfg_OutputStreams PUBLIC CATCH_CONFIG_NOSTDOUT)
# These examples use the standard separate compilation
set( SOURCES_IDIOMATIC_EXAMPLES

View File

@ -230,19 +230,20 @@ target_include_directories(Catch2
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
)
function(StampOutLibrary target)
add_library(Catch2_${target} STATIC
# Some tests require a full recompilation of Catch2 lib with different
# compilation flags. They can link against this target to recompile all
# the sources into the binary.
if (CATCH_BUILD_EXAMPLES OR CATCH_BUILD_EXTRA_TESTS)
add_library(Catch2_buildall_interface INTERFACE)
target_sources(Catch2_buildall_interface INTERFACE
${REPORTER_FILES}
${INTERNAL_FILES}
${BENCHMARK_HEADERS}
${BENCHMARK_SOURCES}
)
target_include_directories(Catch2_${target}
PUBLIC
target_include_directories(Catch2_buildall_interface
INTERFACE
$<BUILD_INTERFACE:${SOURCES_DIR}/..>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
)
target_link_libraries(${target} Catch2_${target})
endfunction()
endif()

View File

@ -53,15 +53,14 @@ add_executable( DisabledExceptions-DefaultHandler ${TESTS_DIR}/X03-DisabledExcep
add_executable( DisabledExceptions-CustomHandler ${TESTS_DIR}/X04-DisabledExceptions-CustomHandler.cpp )
foreach(target DisabledExceptions-DefaultHandler DisabledExceptions-CustomHandler)
StampOutLibrary(${target})
target_compile_options( Catch2_${target}
target_compile_options( ${target}
PUBLIC
$<$<CXX_COMPILER_ID:MSVC>:/EHs-c-;/D_HAS_EXCEPTIONS=0>
$<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:GNU>,$<CXX_COMPILER_ID:AppleClang>>:-fno-exceptions>
)
target_link_libraries(${target} Catch2_${target})
target_link_libraries(${target} Catch2_buildall_interface)
endforeach()
target_compile_definitions( Catch2_DisabledExceptions-CustomHandler PUBLIC CATCH_CONFIG_DISABLE_EXCEPTIONS_CUSTOM_HANDLER )
target_compile_definitions( DisabledExceptions-CustomHandler PUBLIC CATCH_CONFIG_DISABLE_EXCEPTIONS_CUSTOM_HANDLER )
add_test(NAME CATCH_CONFIG_DISABLE_EXCEPTIONS-1 COMMAND DisabledExceptions-DefaultHandler "Tests that run")
@ -121,9 +120,8 @@ set_tests_properties(
add_executable(BenchmarkingMacros ${TESTS_DIR}/X20-BenchmarkingMacros.cpp)
StampOutLibrary(BenchmarkingMacros)
target_compile_definitions( Catch2_BenchmarkingMacros PUBLIC CATCH_CONFIG_ENABLE_BENCHMARKING )
target_link_libraries( BenchmarkingMacros Catch2_BenchmarkingMacros )
target_compile_definitions( BenchmarkingMacros PUBLIC CATCH_CONFIG_ENABLE_BENCHMARKING )
target_link_libraries( BenchmarkingMacros Catch2_buildall_interface )
add_test(NAME BenchmarkingMacros COMMAND BenchmarkingMacros -r console -s)
set_tests_properties(

View File

@ -13,7 +13,6 @@ if "%CONFIGURATION%"=="Debug" (
cmake -H. -BBuild -A%PLATFORM% -DUSE_WMAIN=%wmain% -DMEMORYCHECK_COMMAND=build-misc\Debug\CoverageHelper.exe -DMEMORYCHECK_COMMAND_OPTIONS=--sep-- -DMEMORYCHECK_TYPE=Valgrind || exit /b !ERRORLEVEL! || exit /b !ERRORLEVEL!
) else (
@REM # We know that coverage is 0
python scripts\generateSingleHeader.py || exit /b !ERRORLEVEL!
cmake -H. -BBuild -A%PLATFORM% -DUSE_WMAIN=%wmain% -DCATCH_BUILD_EXAMPLES=%examples% -DCATCH_BUILD_EXTRA_TESTS=%examples% || exit /b !ERRORLEVEL!
)
)

View File

@ -4,6 +4,6 @@ import glob
import subprocess
if __name__ == '__main__':
cov_files = list(glob.glob('projects/cov-report*.bin'))
cov_files = list(glob.glob('tests/cov-report*.bin'))
base_cmd = ['OpenCppCoverage', '--quiet', '--export_type=cobertura:cobertura.xml'] + ['--input_coverage={}'.format(f) for f in cov_files]
subprocess.check_call(base_cmd)