From a0494de7cdaa9213358d495010e77e8cf658ce31 Mon Sep 17 00:00:00 2001 From: Sergey Yakubov <sergey.yakubov@desy.de> Date: Fri, 3 Apr 2020 12:45:33 +0200 Subject: [PATCH] update coverage --- CMakeModules/coverage_go.sh | 11 ++++++----- CMakeModules/testing_go.cmake | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/CMakeModules/coverage_go.sh b/CMakeModules/coverage_go.sh index 6a92bc970..ace5908a6 100755 --- a/CMakeModules/coverage_go.sh +++ b/CMakeModules/coverage_go.sh @@ -1,20 +1,21 @@ #!/bin/bash -OUT_DIR=$1 -ASAPO_MINIMUM_COVERAGE=$2 +SOURCE_DIR=$1 +OUT_DIR=$2 +ASAPO_MINIMUM_COVERAGE=$3 -export GOPATH=$GOPATH:$3 +export GOPATH=$GOPATH:$4 echo $OUT_DIR -mapfile -t PACKAGES < <( find ./src -type d -not -path '*/\.*' ) +mapfile -t PACKAGES < <( find $SOURCE_DIR -type d -not -path '*/\.*' ) echo "mode: count" > $OUT_DIR/coverage-all.out for pkg in ${PACKAGES[@]} do # echo $pkg go test -coverprofile=$OUT_DIR/coverage.out -tags test $pkg #>/dev/null 2>&1 - tail -n +2 $OUT_DIR/coverage.out >> $OUT_DIR/coverage-all.out #2>/dev/null + tail -n +2 $OUT_DIR/coverage.out | grep -v kubernetes >> $OUT_DIR/coverage-all.out #2>/dev/null done coverage=`go tool cover -func=$OUT_DIR/coverage-all.out | grep total | cut -d ")" -f 2 | cut -d "." -f 1` diff --git a/CMakeModules/testing_go.cmake b/CMakeModules/testing_go.cmake index 52d2035c2..bab217b8f 100644 --- a/CMakeModules/testing_go.cmake +++ b/CMakeModules/testing_go.cmake @@ -21,7 +21,7 @@ function(gotest target source_dir test_source_files) message(STATUS "Added test 'test-${target}'") if (CMAKE_COMPILER_IS_GNUCXX) add_test(NAME coveragetest-${target} - COMMAND ${CMAKE_MODULE_PATH}/coverage_go.sh + COMMAND ${CMAKE_MODULE_PATH}/coverage_go.sh ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${ASAPO_MINIMUM_COVERAGE} ${gopath} WORKING_DIRECTORY ${source_dir}) set_tests_properties(coveragetest-${target} PROPERTIES LABELS "coverage;all") -- GitLab