1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00
moby--moby/hack/make/.go-compile-test-dir
Srini Brahmaroutu 2c53643b33 adding a Dockerfile.gccgo to use gccgo compiler instead of go compiler.
temporarily disabling registry builds as crypto package is broken with gccgo.

Signed-off-by: Srini Brahmaroutu <srbrahma@us.ibm.com>
2015-09-16 18:56:01 +00:00

39 lines
1.1 KiB
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 [[ "$(go version)" =~ "gccgo" ]]; then
GCCGOFLAGS="-gccgoflags= -lpthread -ldl "
fi
if ! (
cd "$dir"
go test "${testcover[@]}" "$GCCGOFLAGS" -ldflags "$LDFLAGS" "${BUILDFLAGS[@]}" $TESTFLAGS -c
); then
exit 1
fi
mkdir -p "$(dirname "$out_file")"
mv "$in_file" "$out_file"
echo "Precompiled: ${DOCKER_PKG}${dir#.}"