From 1d917c56582564ab62c4d7b6417bcf335fd0bdca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucas=20K=C3=A4ldstr=C3=B6m?= Date: Sun, 1 May 2016 20:42:32 +0300 Subject: [PATCH] Add a testing script --- .travis.yml | 2 +- README.md | 2 +- build.sh | 17 ++++++++++++++++- test.sh | 24 ++++++++++++++++++++++++ 4 files changed, 42 insertions(+), 3 deletions(-) create mode 100755 test.sh diff --git a/.travis.yml b/.travis.yml index 4691322b1..e149e0811 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,4 +7,4 @@ install: - echo "Don't run anything." # Don't test vendored code. -script: go test $(go list ./... | grep -v /vendor/) +script: ./test.sh diff --git a/README.md b/README.md index a5da19636..95dbf3726 100644 --- a/README.md +++ b/README.md @@ -72,7 +72,7 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for an overview of how to send pull reque Unit tests are run on Travis before code is merged. To run as part of a development cycle: ```shell -go test $(go list ./... | grep -v /vendor/) +./test.sh ``` #### Integration Tests diff --git a/build.sh b/build.sh index 146d4260a..604c08afc 100755 --- a/build.sh +++ b/build.sh @@ -1,8 +1,23 @@ #!/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. + +cd "$( dirname "${BASH_SOURCE[0]}" )" REPO_PATH="k8s.io/minikube" -export GOPATH=${PWD}/gopath +export GOPATH=${PWD}/.gopath export GO15VENDOREXPERIMENT=1 export OS=${OS:-$(go env GOOS)} export ARCH=${ARCH:-$(go env GOARCH)} diff --git a/test.sh b/test.sh new file mode 100755 index 000000000..3b667b6ca --- /dev/null +++ b/test.sh @@ -0,0 +1,24 @@ +#!/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. + +# First, build the binary +source ./build.sh + +# Then 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 + -- GitLab