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
Tianon Gravi d43f0b9fc5 Fix a few minor issues with building/running inside msysGit
Signed-off-by: Andrew "Tianon" Page <admwiggin@gmail.com>
2015-01-09 17:28:40 -07:00

35 lines
972 B
Bash
Executable file

#!/bin/bash
set -e
# Compile phase run by parallel in test-unit. No support for coverpkg
dir=$1
in_file="$dir/$(basename "$dir").test"
out_file="$DEST/precompiled/$dir.test"
# we want to use binary_extension() here, but we can't because it's in main.sh and this file gets re-execed
if [ "$(go env GOOS)" = 'windows' ]; then
in_file+='.exe'
out_file+='.exe'
fi
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
if ! (
cd "$dir"
go test "${testcover[@]}" -ldflags "$LDFLAGS" "${BUILDFLAGS[@]}" $TESTFLAGS -c
); then
exit 1
fi
mkdir -p "$(dirname "$out_file")"
mv "$in_file" "$out_file"
echo "Precompiled: ${DOCKER_PKG}${dir#.}"