aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorJoshua Sjoding <joshua.sjoding@scjalliance.com>2016-02-01 21:16:31 -0800
committerJoshua Sjoding <joshua.sjoding@scjalliance.com>2016-02-01 21:16:31 -0800
commitf26d06d8b3dafae8b849bb0b812f2ce58df92423 (patch)
tree8623788650232bc0bcb91dab5eee19b99e15c2c5 /Makefile
parentd5696c0b75a115001e67025181663b8952b02691 (diff)
parent1cad23e71e4db887700ef6d192ade463904261fd (diff)
downloadgo-git-f26d06d8b3dafae8b849bb0b812f2ce58df92423.tar.gz
Merge remote-tracking branch 'upstream/master' into generic-object-storage
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile36
1 files changed, 36 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..18e9991
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,36 @@
+# Default shell
+SHELL := /bin/bash
+
+# General
+WORKDIR = $(PWD)
+
+# Go parameters
+GOCMD = go
+GOTEST = $(GOCMD) test -v
+
+# Coverage
+COVERAGE_REPORT = coverage.txt
+COVERAGE_PROFILE = profile.out
+COVERAGE_MODE = atomic
+
+ifneq ($(origin CI), undefined)
+ WORKDIR := $(TRAVIS_BUILD_DIR)
+endif
+
+
+test:
+ $(GOTEST) ./...
+
+test-coverage:
+ cd $(WORKDIR); \
+ echo "" > $(COVERAGE_REPORT); \
+ for dir in `find . -name "*.go" | grep -o '.*/' | sort | uniq`; do \
+ $(GOTEST) $$dir -coverprofile=$(COVERAGE_PROFILE) -covermode=$(COVERAGE_MODE); \
+ if [ $$? != 0 ]; then \
+ exit 2; \
+ fi; \
+ if [ -f $(COVERAGE_PROFILE) ]; then \
+ cat $(COVERAGE_PROFILE) >> $(COVERAGE_REPORT); \
+ rm $(COVERAGE_PROFILE); \
+ fi; \
+ done; \