提交 c1ec8be3 编写于 作者: D dlorenc

Code review comments

Clean up PHONY's
Make localkube dynamic
Put test.sh script back
上级 d59fc4f9
GO ?= go
GOOS ?= $(shell go env GOOS)
GOARCH ?= $(shell go env GOARCH)
BUILD_DIR ?= ./out
......@@ -6,12 +5,10 @@ GOPATH := $(shell pwd)/.gopath
REPOPATH ?= k8s.io/minikube
GO15VENDOREXPERIMENT := 1
.PHONY: clean
clean:
rm -rf $(GOPATH)
rm -rf $(BUILD_DIR)
.PHONY: gopath
gopath: clean
rm -rf $(GOPATH)
mkdir -p $(shell dirname $(GOPATH)/src/$(REPOPATH))
......@@ -25,20 +22,16 @@ minikube: minikube-$(GOOS)-$(GOARCH)
localkube: localkube-$(GOOS)-$(GOARCH)
cp $(BUILD_DIR)/localkube-$(GOOS)-$(GOARCH) $(BUILD_DIR)/localkube
.PHONY: minikube-$(GOOS)-$(GOARCH)
minikube-$(GOOS)-$(GOARCH): gopath
GOPATH=$(GOPATH) CGO_ENABLED=0 GOARCH=$(GOARCH) GOOS=$(GOOS) $(GO) build --installsuffix cgo -a -o $(BUILD_DIR)/minikube-$(GOOS)-$(GOARCH) ./cmd/minikube
GOPATH=$(GOPATH) CGO_ENABLED=0 GOARCH=$(GOARCH) GOOS=$(GOOS) go build --installsuffix cgo -a -o $(BUILD_DIR)/minikube-$(GOOS)-$(GOARCH) ./cmd/minikube
.PHONY: localkube-$(GOOS)-$(GOARCH)
localkube-$(GOOS)-$(GOARCH): gopath
GOARCH=$(GOARCH) GOOS=$(GOOS) $(GO) build -o $(BUILD_DIR)/localkube-$(GOOS)-$(GOARCH) -i --ldflags '-extldflags "-static" --s -w' ./cmd/localkube
GOARCH=$(GOARCH) GOOS=$(GOOS) CGO_ENABLED=1 go build -o $(BUILD_DIR)/localkube-$(GOOS)-$(GOARCH) -i ./cmd/localkube
.PHONY: integration
integration: minikube
$(GO) test -v ./integration --tags=integration
go test -v ./integration --tags=integration
.PHONY: test
test: gopath
for TEST in $$(find -name "*.go" | grep -v vendor | grep -v integration | grep _test.go | cut -d/ -f2- | sed 's|/\w*.go||g' | uniq); do \
echo $$TEST; \
$(GO) test -v $(REPOPATH)/$${TEST}; \
done
./test.sh
#!/bin/bash
# Copyright 2016 The Kubernetes Authors All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
REPO_PATH="k8s.io/minikube"
# Run all test files.
for TEST in $(find -name "*.go" | grep -v vendor | grep -v integration | grep _test.go | cut -d/ -f2- | sed 's|/\w*.go||g' | uniq); do
echo $TEST
go test -v ${REPO_PATH}/${TEST}
done
# Check gofmt
diff -u <(echo -n) <(gofmt -l -s . | grep -v vendor)
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册