From 752d9be5652a8ffb9fe8d6eed759d7384a83f674 Mon Sep 17 00:00:00 2001 From: Daniel Arndt Date: Tue, 24 Apr 2018 16:58:50 +0200 Subject: [PATCH] Add codecov support --- tests/run_testsuite.cmake | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/tests/run_testsuite.cmake b/tests/run_testsuite.cmake index 6d628af11b..51deed64e8 100644 --- a/tests/run_testsuite.cmake +++ b/tests/run_testsuite.cmake @@ -412,13 +412,20 @@ COVERAGE=TRUE. ) ENDIF() - FIND_PROGRAM(GCOV_COMMAND NAMES gcov) - IF(GCOV_COMMAND MATCHES "-NOTFOUND") - MESSAGE(FATAL_ERROR " -Coverage enabled but could not find the gcov executable. Please install -gcov, which is part of the GNU Compiler Collection. -" - ) + IF(CMAKE_CXX_COMPILER_ID MATCHES "Clang") + FIND_PROGRAM(GCOV_COMMAND NAMES llvm-cov) + SET(GCOV_COMMAND "${GCOV_COMMAND} gcov") + IF(GCOV_COMMAND MATCHES "-NOTFOUND") + MESSAGE(FATAL_ERROR "Coverage enabled but could not find the + llvm-cov executable, which is part of LLVM.") + ENDIF() + ELSE() + FIND_PROGRAM(GCOV_COMMAND NAMES gcov) + IF(GCOV_COMMAND MATCHES "-NOTFOUND") + MESSAGE(FATAL_ERROR "Coverage enabled but could not find the + gcov executable, which is part of the + GNU Compiler Collection.") + ENDIF() ENDIF() SET(CTEST_COVERAGE_COMMAND "${GCOV_COMMAND}") @@ -540,7 +547,10 @@ IF("${_res}" STREQUAL "0") IF(COVERAGE) CREATE_TARGETDIRECTORIES_TXT() MESSAGE("-- Running CTEST_COVERAGE()") - CTEST_COVERAGE() + #CTEST_COVERAGE() + FILE(DOWNLOAD "https://codecov.io/bash" "${CMAKE_CURRENT_BINARY_DIR}/tests/codecov-bash") + EXECUTE_PROCESS(COMMAND bash "${CMAKE_CURRENT_BINARY_DIR}/tests/codecov-bash" + "-t ac85e7ce-5316-4bc1-a237-2fe724028c7b" "-x '${GCOV_COMMAND}'") CLEAR_TARGETDIRECTORIES_TXT() ENDIF(COVERAGE) @@ -583,4 +593,4 @@ IF("${_res}" STREQUAL "0") MESSAGE("-- Submission successful. Goodbye!") ENDIF() -# .oO( This script is freaky 584 lines long... ) +# .oO( This script is freaky 596 lines long... ) -- 2.39.5