From b648926ff4434e1f27d10dc661946fb3d16898fa Mon Sep 17 00:00:00 2001 From: Dominik Holland Date: Tue, 27 Feb 2024 10:37:10 +0100 Subject: coin: Improve the code coverage setup * Set AM_TIMEOUT_FACTOR * Retry tests up to 3 times if they fail * Create a zip of the coverage-report folder * Exclude some more files Change-Id: I23d2e67bf4e7c192ce024e4c6602d531823d9ed4 Reviewed-by: Robert Griebl --- CMakeLists.txt | 5 +++-- coin/instructions/cmake_module_lcov_code_coverage.yaml | 15 ++++++++++++++- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c2c90733..e1dca564 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -86,9 +86,10 @@ if(AM_COVERAGE) ) if(QT_BUILD_STANDALONE_TESTS) - # this is currently hard-coded for Coin's standalone tests + # Coin splits the build into two separate directories, so we need to merge the coverage info set(GCOV_EXTRA_FOLDER "../qtapplicationmanager_build") set(LCOV_EXTRA_ARGS -d ${GCOV_EXTRA_FOLDER}) + list(APPEND GCOV_EXCLUDE '/home/qt/work/qt/qtapplicationmanager_build/*') endif() set(COVERAGE_DEPENDS all) if(QT_WILL_INSTALL) @@ -100,7 +101,7 @@ if(AM_COVERAGE) COMMAND sh -c 'which genhtml >/dev/null || { echo "The genhtml tool is not available." && exit 2 \; }' COMMAND find . \\\( -name \"*.gcov-info\" -o -name \"*.gcda\" \\\) -print0 | xargs -0 rm -f COMMAND lcov -keep-going -c -i -d . ${LCOV_EXTRA_ARGS} --rc branch_coverage=1 --rc geninfo_auto_base=1 -o "${CMAKE_CURRENT_BINARY_DIR}/base.gcov-info" - COMMAND ctest --test-dir tests/auto --verbose + COMMAND ctest --test-dir tests/auto --verbose --repeat until-pass:3 COMMAND lcov -keep-going -c -d . ${LCOV_EXTRA_ARGS} --rc branch_coverage=1 --rc geninfo_auto_base=1 -o "${CMAKE_CURRENT_BINARY_DIR}/test.gcov-info" COMMAND lcov -keep-going --rc branch_coverage=1 -o "${CMAKE_CURRENT_BINARY_DIR}/temp.gcov-info" `find . ${GCOV_EXTRA_FOLDER} -name \"*.gcov-info\" | xargs -n1 echo -a` COMMAND lcov -keep-going --rc branch_coverage=1 -o "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.gcov-info" -r temp.gcov-info ${GCOV_EXCLUDE} diff --git a/coin/instructions/cmake_module_lcov_code_coverage.yaml b/coin/instructions/cmake_module_lcov_code_coverage.yaml index a8c63e3c..1b86e123 100644 --- a/coin/instructions/cmake_module_lcov_code_coverage.yaml +++ b/coin/instructions/cmake_module_lcov_code_coverage.yaml @@ -17,6 +17,9 @@ instructions: condition: runtime env_var: CMAKE_BUILD_OUTPUT_TIMEOUT equals_value: null + - type: EnvironmentVariable + variableName: AM_TIMEOUT_FACTOR + variableValue: 4 - type: ExecuteCommand command: "{{.Env.CONFIGURE_ENV_PREFIX}} ninja check_coverage" executeCommandArgumentSplitingBehavior: SplitAfterVariableSubstitution @@ -26,7 +29,17 @@ instructions: userMessageOnFailure: > Failed to run tests. + - type: MakeDirectory + directory: "upload" + - type: ExecuteCommand + command: "zip -r upload/coverage-report.zip coverage-report" + ignoreExitCode: false + maxTimeInSeconds: 10800 + maxTimeBetweenOutput: 900 + userMessageOnFailure: > + Failed to zip the coverage-report. + - type: ScheduleUploadTestResults - type: EnvironmentVariable variableName: COIN_CTEST_RESULTSDIR - variableValue: "{{.SourceDir}}_standalone_tests/coverage-report" + variableValue: "{{.SourceDir}}_standalone_tests/upload" -- cgit v1.2.3