1
0
mirror of https://github.com/rwengine/openrw.git synced 2024-10-06 09:07:19 +02:00

ci: use ctest scripts to run the tests

This commit is contained in:
Anonymous Maarten 2017-10-27 05:40:58 +02:00 committed by Daniel Evans
parent 55f910cfa2
commit aa1bbb0b57
2 changed files with 65 additions and 4 deletions

View File

@ -25,10 +25,8 @@ addons:
git:
depth: 3
script:
- mkdir build
- cd build
- cmake .. -DBUILD_TESTS=1 -DTESTS_NODATA=1 -DBUILD_VIEWER=1 && make
- tests/run_tests
- ctest -S cmake/ctest/travis_script.cmake -VV -DSRC_DIR=. -DBIN_DIR=build
- if [ -f FATAL_ERROR ]; then printf "Fatal failure detected.\nExiting with non-zero result code.\n"; exit 1; fi
notifications:
email: false
# irc:

View File

@ -0,0 +1,63 @@
cmake_minimum_required(VERSION 3.2.2)
set(TRAVIS "$ENV{TRAVIS}")
if(TRAVIS)
message("travis_script: Travis detected")
set(CTEST_SITE "Travis")
string(SUBSTRING "$ENV{TRAVIS_COMMIT}" 0 8 SHORT_COMMIT)
set(CTEST_BUILD_NAME "$ENV{TRAVIS_EVENT_TYPE}-$ENV{TRAVIS_REPO_SLUG}-$ENV{TRAVIS_BRANCH}-${SHORT_COMMIT}")
else()
message("travis_script: Travis NOT detected")
endif()
get_filename_component(SRC_DIR "${SRC_DIR}" ABSOLUTE)
get_filename_component(BIN_DIR "${BIN_DIR}" ABSOLUTE)
set(CTEST_SOURCE_DIRECTORY "${SRC_DIR}")
set(CTEST_BINARY_DIRECTORY "${BIN_DIR}")
set(CTEST_CMAKE_GENERATOR "Unix Makefiles")
ctest_empty_binary_directory("${BIN_DIR}")
ctest_start("Continuous")
ctest_configure(
OPTIONS
"-DBUILD_VIEWER=1;-DBUILD_TESTS=1;-DTESTS_NODATA=1"
RETURN_VALUE
CONFIGURE_RESULT
)
ctest_build(
NUMBER_ERRORS BUILD_NB_ERRORS
NUMBER_WARNINGS BUILD_NB_WARNINGS
)
ctest_test(
RETURN_VALUE TEST_RESULT
)
file(REMOVE FATAL_ERROR)
if(NOT CONFIGURE_RESULT EQUAL "0")
message(WARNING "Configure error detected!")
file(APPEND "FATAL_ERROR" "configure error\n")
endif()
if(NOT BUILD_NB_ERRORS EQUAL "0")
message(WARNING "Build failure detected!")
file(APPEND "FATAL_ERROR" "build error\n")
endif()
if(NOT TEST_RESULT EQUAL "0")
message(WARNING "Test failure detected!")
file(WRITE "FATAL_ERROR" "test(s) error\n")
endif()
if(TRAVIS)
ctest_submit(
RETURN_VALUE SUBMIT_RESULT
)
if(NOT SUBMIT_RESULT EQUAL "0")
message(WARNING "Submit failure detected!")
endif()
endif()