Browse code

hack: TIMEOUT (for controlling test timeout) and forwarding of BUILDFLAGS to binary/dynbinary.

Docker-DCO-1.1-Signed-off-by: Erik Hollensbe <github@hollensbe.org> (github: erikh)

Erik Hollensbe authored on 2014/09/26 03:22:24
Showing 3 changed files
... ...
@@ -12,7 +12,7 @@ DOCKER_IMAGE := docker$(if $(GIT_BRANCH),:$(GIT_BRANCH))
12 12
 DOCKER_DOCS_IMAGE := docker-docs$(if $(GIT_BRANCH),:$(GIT_BRANCH))
13 13
 DOCKER_MOUNT := $(if $(BINDDIR),-v "$(CURDIR)/$(BINDDIR):/go/src/github.com/docker/docker/$(BINDDIR)")
14 14
 
15
-DOCKER_RUN_DOCKER := docker run --rm -it --privileged -e TESTFLAGS -e TESTDIRS -e DOCKER_GRAPHDRIVER -e DOCKER_EXECDRIVER $(DOCKER_MOUNT) "$(DOCKER_IMAGE)"
15
+DOCKER_RUN_DOCKER := docker run --rm -it --privileged -e TIMEOUT -e BUILDFLAGS -e TESTFLAGS -e TESTDIRS -e DOCKER_GRAPHDRIVER -e DOCKER_EXECDRIVER $(DOCKER_MOUNT) "$(DOCKER_IMAGE)"
16 16
 # to allow `make DOCSDIR=docs docs-shell`
17 17
 DOCKER_RUN_DOCS := docker run --rm -it $(if $(DOCSDIR),-v $(CURDIR)/$(DOCSDIR):/$(DOCSDIR)) -e AWS_S3_BUCKET
18 18
 
... ...
@@ -102,7 +102,13 @@ LDFLAGS='
102 102
 '
103 103
 LDFLAGS_STATIC='-linkmode external'
104 104
 EXTLDFLAGS_STATIC='-static'
105
-BUILDFLAGS=( -a -tags "netgo static_build $DOCKER_BUILDTAGS" )
105
+# ORIG_BUILDFLAGS is necessary for the cross target which cannot always build
106
+# with options like -race.
107
+ORIG_BUILDFLAGS=( -a -tags "netgo static_build $DOCKER_BUILDTAGS" )
108
+BUILDFLAGS=( $BUILDFLAGS "${ORIG_BUILDFLAGS[@]}" )
109
+# Test timeout.
110
+: ${TIMEOUT:=30m}
111
+TESTFLAGS+=" -test.timeout=${TIMEOUT}"
106 112
 
107 113
 # A few more flags that are specific just to building a completely-static binary (see hack/make/binary)
108 114
 # PLEASE do not use these anywhere else.
... ...
@@ -26,7 +26,7 @@ for platform in $DOCKER_CROSSPLATFORMS; do
26 26
 		export GOARCH=${platform##*/}
27 27
 		if [ -z "${daemonSupporting[$platform]}" ]; then
28 28
 			export LDFLAGS_STATIC_DOCKER="" # we just need a simple client for these platforms
29
-			export BUILDFLAGS=( "${BUILDFLAGS[@]/ daemon/}" ) # remove the "daemon" build tag from platforms that aren't supported
29
+			export BUILDFLAGS=( "${ORIG_BUILDFLAGS[@]/ daemon/}" ) # remove the "daemon" build tag from platforms that aren't supported
30 30
 		fi
31 31
 		source "$(dirname "$BASH_SOURCE")/binary" "$DEST/$platform"
32 32
 	)