From 718f63610989cb2503b74dfe640d1869e97095d0 Mon Sep 17 00:00:00 2001 From: Tom Wilkie Date: Fri, 8 Jan 2016 19:31:35 +0000 Subject: [PATCH 1/2] Squashed 'tools/' changes from 3ec519f..0c4636a 0c4636a Speed up tests by doing a go test -i before hand. git-subtree-dir: tools git-subtree-split: 0c4636a2b39a8547a8c51a2fc56da3c97d909b16 --- test | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test b/test index 73a5952ef..5b88d5270 100755 --- a/test +++ b/test @@ -57,6 +57,9 @@ fi PACKAGE_BASE=$(go list -e ./) +# Speed up the tests by compiling and installing their dependancies first. +go test -i $GO_TEST_ARGS $TESTDIRS + for dir in $TESTDIRS; do if [ -z "$NO_GO_GET" ]; then go get -t -tags netgo $dir From 4ea7453008f63e2e5dc8f32e4fee4bd20205b170 Mon Sep 17 00:00:00 2001 From: Tom Wilkie Date: Fri, 8 Jan 2016 19:35:56 +0000 Subject: [PATCH 2/2] Update Makefile inline with some comments from weave's build. --- Makefile | 28 +++++++++++----------------- backend/Dockerfile | 2 +- 2 files changed, 12 insertions(+), 18 deletions(-) diff --git a/Makefile b/Makefile index 14cf3b42c..718e7fb68 100644 --- a/Makefile +++ b/Makefile @@ -41,18 +41,18 @@ $(RUNSVINIT): vendor/runsvinit/*.go $(SCOPE_EXE): $(shell find ./ -path ./vendor -prune -o -type f -name *.go) prog/static.go ifeq ($(BUILD_IN_CONTAINER),true) -$(SCOPE_EXE) $(RUNSVINIT): $(SCOPE_BACKEND_BUILD_UPTODATE) + +$(SCOPE_EXE) $(RUNSVINIT) tests shell: $(SCOPE_BACKEND_BUILD_UPTODATE) @mkdir -p $(shell pwd)/.pkg - $(SUDO) docker run $(RM) $(RUN_FLAGS) -v $(shell pwd):/go/src/github.com/weaveworks/scope -e GOARCH -e GOOS \ + $(SUDO) docker run $(RM) $(RUN_FLAGS) \ + -v $(shell pwd):/go/src/github.com/weaveworks/scope \ -v $(shell pwd)/.pkg:/go/pkg \ + -e GOARCH -e GOOS -e CIRCLECI -e CIRCLE_BUILD_NUM -e CIRCLE_NODE_TOTAL \ + -e CIRCLE_NODE_INDEX -e COVERDIR -e SLOW \ $(SCOPE_BACKEND_BUILD_IMAGE) SCOPE_VERSION=$(SCOPE_VERSION) GO_BUILD_INSTALL_DEPS=$(GO_BUILD_INSTALL_DEPS) $@ -shell: - @mkdir -p $(shell pwd)/.pkg - $(SUDO) docker run $(RM) $(RUN_FLAGS) -v $(shell pwd):/go/src/github.com/weaveworks/scope -e GOARCH -e GOOS \ - -v $(shell pwd)/.pkg:/go/pkg \ - $(SCOPE_BACKEND_BUILD_IMAGE) SCOPE_VERSION=$(SCOPE_VERSION) GO_BUILD_INSTALL_DEPS=$(GO_BUILD_INSTALL_DEPS) $@ else + $(SCOPE_EXE): $(SCOPE_BACKEND_BUILD_UPTODATE) time go build $(GO_BUILD_FLAGS) -o $@ ./$(@D) @strings $@ | grep cgo_stub\\\.go >/dev/null || { \ @@ -69,6 +69,10 @@ $(RUNSVINIT): shell: /bin/bash + +tests: + ./tools/test -no-go-get + endif static: prog/static.go @@ -116,16 +120,6 @@ clean: rm -rf $(SCOPE_EXPORT) $(SCOPE_UI_BUILD_UPTODATE) $(SCOPE_BACKEND_BUILD_UPTODATE) \ $(SCOPE_EXE) $(RUNSVINIT) prog/static.go client/build/app.js docker/weave .pkg -ifeq ($(BUILD_IN_CONTAINER),true) -tests: $(SCOPE_BACKEND_BUILD_UPTODATE) - $(SUDO) docker run $(RM) $(RUN_FLAGS) -v $(shell pwd):/go/src/github.com/weaveworks/scope \ - -e GOARCH -e GOOS -e CIRCLECI -e CIRCLE_BUILD_NUM -e CIRCLE_NODE_TOTAL -e CIRCLE_NODE_INDEX -e COVERDIR\ - $(SCOPE_BACKEND_BUILD_IMAGE) tests -else -tests: - ./tools/test -no-go-get -endif - deps: go get -u -f -tags netgo \ github.com/golang/lint/golint \ diff --git a/backend/Dockerfile b/backend/Dockerfile index d3ecdea53..b7107b1c2 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -1,6 +1,6 @@ FROM golang:1.5.2 ENV GO15VENDOREXPERIMENT 1 RUN apt-get update && apt-get install -y libpcap-dev python-requests time -RUN go clean -i net && go install -tags netgo std +RUN go clean -i net && go install -tags netgo std && go install -race -tags netgo std COPY build.sh / ENTRYPOINT ["/build.sh"]