mirror of
https://github.com/SFML/SFML.git
synced 2024-11-24 20:31:05 +08:00
Don't automatically run tests after build
The runtests target must be used on Windows for the sake of code coverage. However we can't use that target on all other platforms because on some non-Windows platforms like Android, the tests don't even get configured. If you try to build a target that doesn't exist you get a hard failure. Using CTest is better because it will still return zero even if no tests are found as is the case on Android.
This commit is contained in:
parent
b6c54ac589
commit
0b62543942
12
.github/workflows/ci.yml
vendored
12
.github/workflows/ci.yml
vendored
@ -92,7 +92,17 @@ jobs:
|
||||
|
||||
- name: Build
|
||||
shell: bash
|
||||
run: ${{matrix.platform.prefix}} cmake --build $GITHUB_WORKSPACE/build --config ${{ matrix.type.name == 'Debug' && 'Debug' || 'Release' }} --target install
|
||||
run: cmake --build $GITHUB_WORKSPACE/build --config ${{ matrix.type.name == 'Debug' && 'Debug' || 'Release' }} --target install
|
||||
|
||||
- name: Test
|
||||
if: runner.os == 'Windows'
|
||||
shell: bash
|
||||
run: cmake --build $GITHUB_WORKSPACE/build --target runtests --config ${{ matrix.type.name == 'Debug' && 'Debug' || 'Release' }}
|
||||
|
||||
- name: Test
|
||||
if: runner.os != 'Windows'
|
||||
shell: bash
|
||||
run: ${{matrix.platform.prefix}} ctest --test-dir $GITHUB_WORKSPACE/build --output-on-failure --config ${{ matrix.type.name == 'Debug' && 'Debug' || 'Release' }}
|
||||
|
||||
- name: Generate Coverage Report
|
||||
if: matrix.type.name == 'Debug' && runner.os != 'Windows' # Coverage is already generated on Windows when running tests.
|
||||
|
@ -138,11 +138,6 @@ if(SFML_OS_WINDOWS AND NOT SFML_USE_SYSTEM_DEPS)
|
||||
VERBATIM)
|
||||
endif()
|
||||
|
||||
# Automatically run the tests at the end of the build
|
||||
add_custom_target(runtests ALL
|
||||
DEPENDS test-sfml-system test-sfml-window test-sfml-graphics test-sfml-network test-sfml-audio
|
||||
)
|
||||
|
||||
if(SFML_ENABLE_COVERAGE AND SFML_OS_WINDOWS)
|
||||
# Try to find and use OpenCppCoverage for coverage reporting when building with MSVC
|
||||
find_program(OpenCppCoverage_BINARY "OpenCppCoverage.exe")
|
||||
@ -174,6 +169,8 @@ if(SFML_ENABLE_COVERAGE AND OpenCppCoverage_FOUND)
|
||||
set(COVERAGE_PREFIX ${OpenCppCoverage_BINARY} ARGS --quiet --export_type cobertura:${PROJECT_BINARY_DIR}/coverage.out --cover_children --excluded_modules "${COVERAGE_EXCLUDE}" --sources "${COVERAGE_SRC}" --sources "${COVERAGE_INCLUDE}" --)
|
||||
endif()
|
||||
|
||||
# Convenience for building and running tests in a single command
|
||||
add_custom_target(runtests DEPENDS test-sfml-system test-sfml-window test-sfml-graphics test-sfml-network test-sfml-audio)
|
||||
add_custom_command(TARGET runtests
|
||||
COMMENT "Run tests"
|
||||
POST_BUILD COMMAND ${COVERAGE_PREFIX} ${CMAKE_CTEST_COMMAND} --output-on-failure -C $<CONFIG>
|
||||
|
Loading…
Reference in New Issue
Block a user