From 10910929b8ab930ad47b3f0ecd4a2c64d77e5199 Mon Sep 17 00:00:00 2001 From: Derek Parker Date: Fri, 9 Oct 2015 17:56:09 -0700 Subject: [PATCH] all: Use -exec flag to codesign test binary on OSX Replaces a lot of ugly Makefile nonsense with a script that codesigns the test binary before it runs. Only applicable to OSX test runs. --- Makefile | 22 ++++------------------ scripts/testsign | 3 +++ 2 files changed, 7 insertions(+), 18 deletions(-) create mode 100755 scripts/testsign diff --git a/Makefile b/Makefile index 8f52947b..6e30cb90 100644 --- a/Makefile +++ b/Makefile @@ -13,7 +13,7 @@ ALL_PACKAGES=$(shell go list ./... | grep -v /vendor/) # unable to execute. # See https://github.com/golang/go/issues/11887#issuecomment-126117692. ifeq "$(UNAME)" "Darwin" - FLAGS=-ldflags="-s" + FLAGS=-ldflags="-s" -exec=$(shell pwd)/scripts/testsign DARWIN="true" endif @@ -40,28 +40,14 @@ ifdef DARWIN endif test: check-cert -ifdef DARWIN ifeq "$(TRAVIS)" "true" sudo -E go test -v $(ALL_PACKAGES) else - go test $(PREFIX)/terminal $(PREFIX)/dwarf/frame $(PREFIX)/dwarf/op $(PREFIX)/dwarf/util $(PREFIX)/source $(PREFIX)/dwarf/line - go test -c $(FLAGS) $(PREFIX)/proc && codesign -s $(CERT) ./proc.test && ./proc.test $(TESTFLAGS) -test.v && rm ./proc.test - go test -c $(FLAGS) $(PREFIX)/service/test && codesign -s $(CERT) ./test.test && ./test.test $(TESTFLAGS) -test.v && rm ./test.test -endif -else - go test -v $(ALL_PACKAGES) + go test $(FLAGS) $(ALL_PACKAGES) endif test-proc-run: -ifdef DARWIN - go test -c $(FLAGS) $(PREFIX)/proc && codesign -s $(CERT) ./proc.test && ./proc.test -test.run $(RUN) && rm ./proc.test -else - go test $(PREFIX) -run $(RUN) -endif + go test $(FLAGS) $(PREFIX)/proc -run $(RUN) test-integration-run: -ifdef DARWIN - go test -c $(FLAGS) $(PREFIX)/service/test && codesign -s $(CERT) ./test.test && ./test.test -test.run $(RUN) && rm ./test.test -else - go test $(PREFIX)/service/rest -run $(RUN) -endif + go test $(FLAGS) $(PREFIX)/service/test -run $(RUN) diff --git a/scripts/testsign b/scripts/testsign new file mode 100755 index 00000000..10cdab9c --- /dev/null +++ b/scripts/testsign @@ -0,0 +1,3 @@ +#!/usr/bin/env bash +codesign -s $CERT $1 +exec $1