Browse Source

Merge pull request #481 from mrjana/bugs

Allow tests to be interrupted
Madhu Venugopal 9 years ago
parent
commit
94453a45cb
2 changed files with 20 additions and 9 deletions
  1. 9 9
      libnetwork/Makefile
  2. 11 0
      libnetwork/wrapmake.sh

+ 9 - 9
libnetwork/Makefile

@@ -3,12 +3,12 @@ SHELL=/bin/bash
 build_image=libnetwork-build
 build_image=libnetwork-build
 dockerargs = --privileged -v $(shell pwd):/go/src/github.com/docker/libnetwork -w /go/src/github.com/docker/libnetwork
 dockerargs = --privileged -v $(shell pwd):/go/src/github.com/docker/libnetwork -w /go/src/github.com/docker/libnetwork
 container_env = -e "INSIDECONTAINER=-incontainer=true"
 container_env = -e "INSIDECONTAINER=-incontainer=true"
-docker = docker run --rm ${dockerargs} ${container_env} ${build_image}
+docker = docker run --rm -it ${dockerargs} ${container_env} ${build_image}
 ciargs = -e "COVERALLS_TOKEN=$$COVERALLS_TOKEN" -e "INSIDECONTAINER=-incontainer=true"
 ciargs = -e "COVERALLS_TOKEN=$$COVERALLS_TOKEN" -e "INSIDECONTAINER=-incontainer=true"
 cidocker = docker run ${ciargs} ${dockerargs} golang:1.4
 cidocker = docker run ${ciargs} ${dockerargs} golang:1.4
 
 
 all: ${build_image}.created
 all: ${build_image}.created
-	${docker} make all-local
+	${docker} ./wrapmake.sh all-local
 
 
 all-local: check-local build-local
 all-local: check-local build-local
 
 
@@ -19,13 +19,13 @@ ${build_image}.created:
 	touch ${build_image}.created
 	touch ${build_image}.created
 
 
 build: ${build_image}.created
 build: ${build_image}.created
-	${docker} make build-local
+	${docker} ./wrapmake.sh build-local
 
 
 build-local:
 build-local:
 	$(shell which godep) go build -tags libnetwork_discovery ./...
 	$(shell which godep) go build -tags libnetwork_discovery ./...
 
 
 check: ${build_image}.created
 check: ${build_image}.created
-	${docker} make check-local
+	${docker} ./wrapmake.sh check-local
 
 
 check-code:
 check-code:
 	@echo "Checking code... "
 	@echo "Checking code... "
@@ -49,15 +49,15 @@ run-tests:
 		ret=$$? ;\
 		ret=$$? ;\
 		if [ $$ret -ne 0 ]; then exit $$ret; fi ;\
 		if [ $$ret -ne 0 ]; then exit $$ret; fi ;\
 		popd &> /dev/null; \
 		popd &> /dev/null; \
-	        if [ -f $$dir/profile.tmp ]; then \
-		        cat $$dir/profile.tmp | tail -n +2 >> coverage.coverprofile ; \
+		if [ -f $$dir/profile.tmp ]; then \
+			cat $$dir/profile.tmp | tail -n +2 >> coverage.coverprofile ; \
 				rm $$dir/profile.tmp ; \
 				rm $$dir/profile.tmp ; \
-            fi ; \
-        fi ; \
+	    fi ; \
+	fi ; \
 	done
 	done
 	@echo "Done running tests"
 	@echo "Done running tests"
 
 
-check-local: 	check-format check-code run-tests 
+check-local:	check-format check-code run-tests
 
 
 install-deps:
 install-deps:
 	apt-get update && apt-get -y install iptables
 	apt-get update && apt-get -y install iptables

+ 11 - 0
libnetwork/wrapmake.sh

@@ -0,0 +1,11 @@
+#!/usr/bin/env bash
+
+set -e
+
+function raise()
+{
+    kill -$1 0
+}
+
+trap "raise SIGINT" SIGINT
+make $1