* Benchmark stuff

Signed-off-by: Miek Gieben <miek@miek.nl>

* Makefile changes

Signed-off-by: Miek Gieben <miek@miek.nl>

* Fixes

Signed-off-by: Miek Gieben <miek@miek.nl>

* fix

Signed-off-by: Miek Gieben <miek@miek.nl>

* Add benchmark test

Signed-off-by: Miek Gieben <miek@miek.nl>

* Add master branch

Signed-off-by: Miek Gieben <miek@miek.nl>
This commit is contained in:
Miek Gieben
2018-09-22 15:17:17 +01:00
committed by Yong Tang
parent 9546b606cb
commit 7b40b14e96
2 changed files with 25 additions and 11 deletions

View File

@@ -1,5 +1,4 @@
sudo: required sudo: required
# Trusty distribution is much faster when sudo is required
dist: trusty dist: trusty
services: services:
@@ -14,11 +13,16 @@ go_import_path: github.com/coredns/coredns
git: git:
depth: 3 depth: 3
branches:
only:
- master
env: env:
- TEST_TYPE=coverage ETCD_VERSION=3.3.8 - TEST_TYPE=coverage ETCD_VERSION=3.3.8
- TEST_TYPE=integration ETCD_VERSION=3.3.8 - TEST_TYPE=integration ETCD_VERSION=3.3.8
- TEST_TYPE=core ETCD_VERSION=3.3.8 - TEST_TYPE=core ETCD_VERSION=3.3.8
- TEST_TYPE=plugin ETCD_VERSION=3.3.8 - TEST_TYPE=plugin ETCD_VERSION=3.3.8
- TEST_TYPE=benchmark ETCD_VERSION=3.3.8
# In the Travis VM-based build environment, IPv6 networking is not # In the Travis VM-based build environment, IPv6 networking is not
# enabled by default. The sysctl operations below enable IPv6. # enabled by default. The sysctl operations below enable IPv6.
@@ -35,6 +39,7 @@ before_install:
before_script: before_script:
- docker run -d --net=host --name=etcd quay.io/coreos/etcd:v$ETCD_VERSION - docker run -d --net=host --name=etcd quay.io/coreos/etcd:v$ETCD_VERSION
- make godeps
script: script:
- make TEST_TYPE=$TEST_TYPE travis - make TEST_TYPE=$TEST_TYPE travis

View File

@@ -17,14 +17,6 @@ coredns: $(CHECKS)
.PHONY: check .PHONY: check
check: presubmit core/zplugin.go core/dnsserver/zdirectives.go godeps check: presubmit core/zplugin.go core/dnsserver/zdirectives.go godeps
.PHONY: test
test: check
go test -race $(VERBOSE) ./test ./plugin/...
.PHONY: testk8s
testk8s: check
go test -race $(VERBOSE) -tags=k8s -run 'TestKubernetes' ./test ./plugin/kubernetes/...
.PHONY: godeps .PHONY: godeps
godeps: godeps:
@ # Not vendoring these, so external plugins compile, avoiding: @ # Not vendoring these, so external plugins compile, avoiding:
@@ -40,13 +32,15 @@ godeps:
(cd $(GOPATH)/src/github.com/mholt/caddy && git checkout -q v0.10.11) (cd $(GOPATH)/src/github.com/mholt/caddy && git checkout -q v0.10.11)
(cd $(GOPATH)/src/github.com/miekg/dns && git checkout -q v1.0.8) (cd $(GOPATH)/src/github.com/miekg/dns && git checkout -q v1.0.8)
(cd $(GOPATH)/src/github.com/prometheus/client_golang && git checkout -q v0.8.0) (cd $(GOPATH)/src/github.com/prometheus/client_golang && git checkout -q v0.8.0)
@ # for travis only, if this fails we don't care, but don't see benchmarks
go get -u golang.org/x/tools/cmd/benchcmp || true
.PHONY: travis .PHONY: travis
travis: check travis:
ifeq ($(TEST_TYPE),core) ifeq ($(TEST_TYPE),core)
( cd request ; go test -v -tags 'etcd' -race ./... ) ( cd request ; go test -v -tags 'etcd' -race ./... )
( cd core ; go test -v -tags 'etcd' -race ./... ) ( cd core ; go test -v -tags 'etcd' -race ./... )
( cd coremain go test -v -tags 'etcd' -race ./... ) ( cd coremain ; go test -v -tags 'etcd' -race ./... )
endif endif
ifeq ($(TEST_TYPE),integration) ifeq ($(TEST_TYPE),integration)
( cd test ; go test -v -tags 'etcd' -race ./... ) ( cd test ; go test -v -tags 'etcd' -race ./... )
@@ -66,6 +60,21 @@ ifeq ($(TEST_TYPE),coverage)
fi; \ fi; \
done done
endif endif
ifeq ($(TEST_TYPE),benchmark)
> new
( cd plugin; go test -run=NONE -bench=. -benchmem=true -tags 'etcd' ./... ) >> new
( cd request; go test -run=NONE -bench=. -benchmem=true -tags 'etcd' ./... ) >> new
( cd core; go test -run=NONE -bench=. -benchmem=true -tags 'etcd' ./... ) >> new
( cd coremain; go test -run=NONE -bench=. -benchmem=true -tags 'etcd' ./... ) >> new
git checkout master
> old
( cd plugin; go test -run=NONE -bench=. -benchmem=true -tags 'etcd' ./... ) >> old
( cd request; go test -run=NONE -bench=. -benchmem=true -tags 'etcd' ./... ) >> old
( cd core; go test -run=NONE -bench=. -benchmem=true -tags 'etcd' ./... ) >> old
( cd coremain; go test -run=NONE -bench=. -benchmem=true -tags 'etcd' ./... ) >> old
if command -v benchcmp; then benchcmp old new ; fi
git checkout -
endif
core/zplugin.go core/dnsserver/zdirectives.go: plugin.cfg core/zplugin.go core/dnsserver/zdirectives.go: plugin.cfg
go generate coredns.go go generate coredns.go