diff options
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 20 |
1 files changed, 17 insertions, 3 deletions
@@ -16,6 +16,7 @@ GOPATH := $(firstword $(subst :, ,$(shell $(GO) env GOPATH))) | |||
16 | GOARCH := $(shell $(GO) env GOARCH) | 16 | GOARCH := $(shell $(GO) env GOARCH) |
17 | GOHOSTARCH := $(shell $(GO) env GOHOSTARCH) | 17 | GOHOSTARCH := $(shell $(GO) env GOHOSTARCH) |
18 | 18 | ||
19 | PROMTOOL ?= $(GOPATH)/bin/promtool | ||
19 | PROMU ?= $(GOPATH)/bin/promu | 20 | PROMU ?= $(GOPATH)/bin/promu |
20 | STATICCHECK ?= $(GOPATH)/bin/staticcheck | 21 | STATICCHECK ?= $(GOPATH)/bin/staticcheck |
21 | pkgs = $(shell $(GO) list ./... | grep -v /vendor/) | 22 | pkgs = $(shell $(GO) list ./... | grep -v /vendor/) |
@@ -48,6 +49,12 @@ else | |||
48 | test-e2e := skip-test-e2e | 49 | test-e2e := skip-test-e2e |
49 | endif | 50 | endif |
50 | 51 | ||
52 | ifeq ($(MACH), ppc64le) | ||
53 | e2e-out = collector/fixtures/e2e-ppc64le-output.txt | ||
54 | else | ||
55 | e2e-out = collector/fixtures/e2e-output.txt | ||
56 | endif | ||
57 | |||
51 | # 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. | 58 | # 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. |
52 | cross-test = skip-test-32bit | 59 | cross-test = skip-test-32bit |
53 | define goarch_pair | 60 | define goarch_pair |
@@ -65,7 +72,7 @@ $(eval $(call goarch_pair,arm64,arm)) | |||
65 | $(eval $(call goarch_pair,mips64,mips)) | 72 | $(eval $(call goarch_pair,mips64,mips)) |
66 | $(eval $(call goarch_pair,mips64el,mipsel)) | 73 | $(eval $(call goarch_pair,mips64el,mipsel)) |
67 | 74 | ||
68 | all: format vet staticcheck build test $(cross-test) $(test-e2e) | 75 | all: format vet staticcheck checkmetrics build test $(cross-test) $(test-e2e) |
69 | 76 | ||
70 | style: | 77 | style: |
71 | @echo ">> checking code style" | 78 | @echo ">> checking code style" |
@@ -93,6 +100,10 @@ test-e2e: build collector/fixtures/sys/.unpacked | |||
93 | skip-test-e2e: | 100 | skip-test-e2e: |
94 | @echo ">> SKIP running end-to-end tests on $(OS_detected)" | 101 | @echo ">> SKIP running end-to-end tests on $(OS_detected)" |
95 | 102 | ||
103 | checkmetrics: $(PROMTOOL) | ||
104 | @echo ">> checking metrics for correctness" | ||
105 | ./checkmetrics.sh $(PROMTOOL) $(e2e-out) | ||
106 | |||
96 | format: | 107 | format: |
97 | @echo ">> formatting code" | 108 | @echo ">> formatting code" |
98 | @$(GO) fmt $(pkgs) | 109 | @$(GO) fmt $(pkgs) |
@@ -124,6 +135,9 @@ test-docker: | |||
124 | @echo ">> testing docker image" | 135 | @echo ">> testing docker image" |
125 | ./test_image.sh "$(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_TAG)" 9100 | 136 | ./test_image.sh "$(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_TAG)" 9100 |
126 | 137 | ||
138 | $(GOPATH)/bin/promtool promtool: | ||
139 | @GOOS= GOARCH= $(GO) get -u github.com/prometheus/prometheus/cmd/promtool | ||
140 | |||
127 | $(GOPATH)/bin/promu promu: | 141 | $(GOPATH)/bin/promu promu: |
128 | @GOOS= GOARCH= $(GO) get -u github.com/prometheus/promu | 142 | @GOOS= GOARCH= $(GO) get -u github.com/prometheus/promu |
129 | 143 | ||
@@ -131,10 +145,10 @@ $(GOPATH)/bin/staticcheck: | |||
131 | @GOOS= GOARCH= $(GO) get -u honnef.co/go/tools/cmd/staticcheck | 145 | @GOOS= GOARCH= $(GO) get -u honnef.co/go/tools/cmd/staticcheck |
132 | 146 | ||
133 | 147 | ||
134 | .PHONY: all style format build test test-e2e vet tarball docker promu staticcheck | 148 | .PHONY: all style format build test test-e2e vet tarball docker promtool promu staticcheck checkmetrics |
135 | 149 | ||
136 | # Declaring the binaries at their default locations as PHONY targets is a hack | 150 | # Declaring the binaries at their default locations as PHONY targets is a hack |
137 | # to ensure the latest version is downloaded on every make execution. | 151 | # to ensure the latest version is downloaded on every make execution. |
138 | # If this is not desired, copy/symlink these binaries to a different path and | 152 | # If this is not desired, copy/symlink these binaries to a different path and |
139 | # set the respective environment variables. | 153 | # set the respective environment variables. |
140 | .PHONY: $(GOPATH)/bin/promu $(GOPATH)/bin/staticcheck | 154 | .PHONY: $(GOPATH)/bin/promtool $(GOPATH)/bin/promu $(GOPATH)/bin/staticcheck |