Skip to content
Snippets Groups Projects
Commit a0494de7 authored by Sergey Yakubov's avatar Sergey Yakubov
Browse files

update coverage

parent 68ef225f
No related branches found
No related tags found
No related merge requests found
#!/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`
......
......@@ -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")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment