Package coverage when running integration tests
If coverpkg is missing on `go test` command, only the current package will be covered. That's the case of unit tests. For integration tests we need to explicitly declare each package. Docker-DCO-1.1-Signed-off-by: Fabio Falci <fabiofalci@gmail.com> (github: fabiofalci) Upstream-commit: b3d5e9527a050a0c7252f0125a8a26a6fc5175f1 Component: engine
This commit is contained in:
@ -16,7 +16,7 @@ set -e
|
||||
# in the Dockerfile at the root of the source. In other words:
|
||||
# DO NOT CALL THIS SCRIPT DIRECTLY.
|
||||
# - The right way to call this script is to invoke "make" from
|
||||
# your checkout of the Docker repository.
|
||||
# your checkout of the Docker repository.
|
||||
# the Makefile will do a "docker build -t docker ." and then
|
||||
# "docker run hack/make.sh" in the resulting container image.
|
||||
#
|
||||
@ -101,13 +101,14 @@ fi
|
||||
#
|
||||
go_test_dir() {
|
||||
dir=$1
|
||||
coverpkg=$2
|
||||
testcover=()
|
||||
if [ "$HAVE_GO_TEST_COVER" ]; then
|
||||
# if our current go install has -cover, we want to use it :)
|
||||
mkdir -p "$DEST/coverprofiles"
|
||||
coverprofile="docker${dir#.}"
|
||||
coverprofile="$DEST/coverprofiles/${coverprofile//\//-}"
|
||||
testcover=( -cover -coverprofile "$coverprofile" )
|
||||
testcover=( -cover -coverprofile "$coverprofile" $coverpkg )
|
||||
fi
|
||||
(
|
||||
set -x
|
||||
@ -116,6 +117,16 @@ go_test_dir() {
|
||||
)
|
||||
}
|
||||
|
||||
# This helper function walks the current directory looking for directories
|
||||
# holding certain files ($1 parameter), and prints their paths on standard
|
||||
# output, one per line.
|
||||
find_dirs() {
|
||||
find -not \( \
|
||||
\( -wholename './vendor' -o -wholename './integration' -o -wholename './contrib' -o -wholename './pkg/mflag/example' \) \
|
||||
-prune \
|
||||
\) -name "$1" -print0 | xargs -0n1 dirname | sort -u
|
||||
}
|
||||
|
||||
bundle() {
|
||||
bundlescript=$1
|
||||
bundle=$(basename $bundlescript)
|
||||
|
||||
Reference in New Issue
Block a user