mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
27 lines
766 B
Text
27 lines
766 B
Text
|
#!/bin/bash
|
||
|
set -e
|
||
|
|
||
|
# Compile phase run by parallel in test-unit. No support for coverpkg
|
||
|
|
||
|
dir=$1
|
||
|
out_file="$DEST/precompiled/$dir.test"
|
||
|
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" ) # missing $coverpkg
|
||
|
fi
|
||
|
if [ "$BUILDFLAGS_FILE" ]; then
|
||
|
readarray -t BUILDFLAGS < "$BUILDFLAGS_FILE"
|
||
|
fi
|
||
|
(
|
||
|
cd "$dir"
|
||
|
go test "${testcover[@]}" -ldflags "$LDFLAGS" "${BUILDFLAGS[@]}" $TESTFLAGS -c
|
||
|
)
|
||
|
[ $? -ne 0 ] && return 1
|
||
|
mkdir -p "$(dirname "$out_file")"
|
||
|
mv "$dir/$(basename "$dir").test" "$out_file"
|
||
|
echo "Precompiled: ${DOCKER_PKG}${dir#.}"
|