aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Yong Tang <yongtang@users.noreply.github.com> 2016-09-26 14:22:48 +0800
committerGravatar Miek Gieben <miek@miek.nl> 2016-09-26 07:22:48 +0100
commit6a7db541fa6fcd742d0e00cf47182adcdc6957e2 (patch)
tree21fb72db6bb20ee5eecdb548b68b1384ce50afa5
parented1a4eed2e7f560d801546917131ae0d6031fd70 (diff)
downloadcoredns-6a7db541fa6fcd742d0e00cf47182adcdc6957e2.tar.gz
coredns-6a7db541fa6fcd742d0e00cf47182adcdc6957e2.tar.zst
coredns-6a7db541fa6fcd742d0e00cf47182adcdc6957e2.zip
Move `.coverage.sh` to `make coverage` (#301)
This fix moves the content of `.coverage.sh` to the Makefile and creates a target of `make coverage`. This cleans up as there is really no need to have a redundant script for simple coverage test. Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
-rwxr-xr-x.coverage.sh12
-rw-r--r--.travis.yml3
-rw-r--r--Makefile12
3 files changed, 13 insertions, 14 deletions
diff --git a/.coverage.sh b/.coverage.sh
deleted file mode 100755
index f038955fe..000000000
--- a/.coverage.sh
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/usr/bin/env bash
-
-set -e -x
-echo "" > coverage.txt
-
-for d in $(go list ./... | grep -v vendor); do
- go test -race -coverprofile=profile.out -covermode=atomic $d
- if [ -f profile.out ]; then
- cat profile.out >> coverage.txt
- rm profile.out
- fi
-done
diff --git a/.travis.yml b/.travis.yml
index 7020ec5d4..a407e618e 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -42,8 +42,7 @@ script:
- go test -tags etcd -race -bench=. ./...
# Run kubernetes integration tests only if kubectl is available. i.e. If kubernetes was launched
- ./contrib/kubernetes/testscripts/kubectl version && go test -v -tags k8s -race -bench=. -run 'TestK8sIntegration' ./test
- # go cannot use test profile flag with multiple packages so we have to iterate, the following might be consolidated with the above steps.
- - ./.coverage.sh
+ - make coverage
after_success:
- bash <(curl -s https://codecov.io/bash)
diff --git a/Makefile b/Makefile
index 4a388a05d..d73915acd 100644
--- a/Makefile
+++ b/Makefile
@@ -38,6 +38,18 @@ testk8s: deps
testk8s-setup: deps
go test -v ./middleware/kubernetes/... -run TestKubernetes
+.PHONY: coverage
+coverage: deps
+ set -e -x
+ echo "" > coverage.txt
+ for d in `go list ./... | grep -v vendor`; do \
+ go test -race -coverprofile=profile.out -covermode=atomic $$d; \
+ if [ -f profile.out ]; then \
+ cat profile.out >> coverage.txt; \
+ rm profile.out; \
+ fi; \
+ done
+
.PHONY: clean
clean:
go clean