1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00
moby--moby/project/make/.go-compile-test-dir
Solomon Hykes 32e61b8f5c Move 'hack' to the less confusing 'project'
We might want to break it up into smaller pieces (eg. tools in one
place, documents in another) but let's worry about that later.

Signed-off-by: Solomon Hykes <solomon@docker.com>
2014-11-09 21:50:28 +00:00

26 lines
766 B
Bash
Executable file

#!/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#.}"