From dcb31670d63235cdd0ff0de03fe283980ce4e543 Mon Sep 17 00:00:00 2001 From: Matt Layher Date: Tue, 13 Feb 2018 12:04:03 -0500 Subject: Makefile: add checkmetrics target, use in CI (#797) --- Makefile | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 93c5b6c..1bbb136 100644 --- a/Makefile +++ b/Makefile @@ -16,6 +16,7 @@ GOPATH := $(firstword $(subst :, ,$(shell $(GO) env GOPATH))) GOARCH := $(shell $(GO) env GOARCH) GOHOSTARCH := $(shell $(GO) env GOHOSTARCH) +PROMTOOL ?= $(GOPATH)/bin/promtool PROMU ?= $(GOPATH)/bin/promu STATICCHECK ?= $(GOPATH)/bin/staticcheck pkgs = $(shell $(GO) list ./... | grep -v /vendor/) @@ -48,6 +49,12 @@ else test-e2e := skip-test-e2e endif +ifeq ($(MACH), ppc64le) + e2e-out = collector/fixtures/e2e-ppc64le-output.txt +else + e2e-out = collector/fixtures/e2e-output.txt +endif + # 64bit -> 32bit mapping for cross-checking. At least for amd64/386, the 64bit CPU can execute 32bit code but not the other way around, so we don't support cross-testing upwards. cross-test = skip-test-32bit define goarch_pair @@ -65,7 +72,7 @@ $(eval $(call goarch_pair,arm64,arm)) $(eval $(call goarch_pair,mips64,mips)) $(eval $(call goarch_pair,mips64el,mipsel)) -all: format vet staticcheck build test $(cross-test) $(test-e2e) +all: format vet staticcheck checkmetrics build test $(cross-test) $(test-e2e) style: @echo ">> checking code style" @@ -93,6 +100,10 @@ test-e2e: build collector/fixtures/sys/.unpacked skip-test-e2e: @echo ">> SKIP running end-to-end tests on $(OS_detected)" +checkmetrics: $(PROMTOOL) + @echo ">> checking metrics for correctness" + ./checkmetrics.sh $(PROMTOOL) $(e2e-out) + format: @echo ">> formatting code" @$(GO) fmt $(pkgs) @@ -124,6 +135,9 @@ test-docker: @echo ">> testing docker image" ./test_image.sh "$(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_TAG)" 9100 +$(GOPATH)/bin/promtool promtool: + @GOOS= GOARCH= $(GO) get -u github.com/prometheus/prometheus/cmd/promtool + $(GOPATH)/bin/promu promu: @GOOS= GOARCH= $(GO) get -u github.com/prometheus/promu @@ -131,10 +145,10 @@ $(GOPATH)/bin/staticcheck: @GOOS= GOARCH= $(GO) get -u honnef.co/go/tools/cmd/staticcheck -.PHONY: all style format build test test-e2e vet tarball docker promu staticcheck +.PHONY: all style format build test test-e2e vet tarball docker promtool promu staticcheck checkmetrics # Declaring the binaries at their default locations as PHONY targets is a hack # to ensure the latest version is downloaded on every make execution. # If this is not desired, copy/symlink these binaries to a different path and # set the respective environment variables. -.PHONY: $(GOPATH)/bin/promu $(GOPATH)/bin/staticcheck +.PHONY: $(GOPATH)/bin/promtool $(GOPATH)/bin/promu $(GOPATH)/bin/staticcheck -- cgit v1.2.3