mirror of
https://github.com/coredns/coredns.git
synced 2025-10-27 08:14:18 -04:00
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>
This commit is contained in:
12
.coverage.sh
12
.coverage.sh
@@ -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
|
||||
@@ -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)
|
||||
|
||||
12
Makefile
12
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
|
||||
|
||||
Reference in New Issue
Block a user