From 9c632e4eb7d47e712cb0acdf7c8ad4a10ca68486 Mon Sep 17 00:00:00 2001 From: Frank Schroeder Date: Wed, 26 Apr 2017 15:47:57 -0700 Subject: [PATCH] build: Simplify make test and log output --- .gitignore | 1 + GNUmakefile | 21 ++++++++------------- scripts/test.sh | 24 ------------------------ scripts/verify_no_uuid.sh | 13 ------------- 4 files changed, 9 insertions(+), 50 deletions(-) delete mode 100755 scripts/test.sh delete mode 100755 scripts/verify_no_uuid.sh diff --git a/.gitignore b/.gitignore index 5fb798fabb..a9377f133c 100644 --- a/.gitignore +++ b/.gitignore @@ -30,6 +30,7 @@ website/build/ website/npm-debug.log *.old *.attr +*.log ui/.sass-cache ui/static/base.css diff --git a/GNUmakefile b/GNUmakefile index 55faa4a6ef..4a667fe75a 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -4,9 +4,8 @@ GOTOOLS = \ github.com/mitchellh/gox \ golang.org/x/tools/cmd/cover \ golang.org/x/tools/cmd/stringer -TEST ?= ./... GOTAGS ?= consul -GOFILES ?= $(shell go list $(TEST) | grep -v /vendor/) +GOFILES ?= $(shell go list ./... | grep -v /vendor/) GOOS=$(shell go env GOOS) GOARCH=$(shell go env GOARCH) @@ -38,27 +37,23 @@ dist: @GOTAGS='$(GOTAGS)' sh -c "'$(CURDIR)/scripts/dist.sh'" cov: - gocov test ${GOFILES} | gocov-html > /tmp/coverage.html + gocov test $(GOFILES) | gocov-html > /tmp/coverage.html open /tmp/coverage.html -test: - @./scripts/verify_no_uuid.sh - @env \ - GOTAGS="${GOTAGS}" \ - GOFILES="${GOFILES}" \ - TESTARGS="${TESTARGS}" \ - sh -c "'$(CURDIR)/scripts/test.sh'" +test: dev + go test -tags "$(GOTAGS)" -i -run '^$$' ./... + go test -tags "$(GOTAGS)" -v $(GOFILES) | tee test.log 2>&1 cover: - go test ${GOFILES} --cover + go test $(GOFILES) --cover format: @echo "--> Running go fmt" - @go fmt ${GOFILES} + @go fmt $(GOFILES) vet: @echo "--> Running go vet" - @go vet ${GOFILES}; if [ $$? -eq 1 ]; then \ + @go vet $(GOFILES); if [ $$? -eq 1 ]; then \ echo ""; \ echo "Vet found suspicious constructs. Please check the reported constructs"; \ echo "and fix them if necessary before submitting the code for review."; \ diff --git a/scripts/test.sh b/scripts/test.sh deleted file mode 100755 index 241d64da01..0000000000 --- a/scripts/test.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/env bash -set -e - -if [ -n "$TRAVIS" ]; then - # Install all packages - this will make running the suite faster - echo "--> Installing packages for faster tests" - go install -tags="${GOTAGS}" -a ./... -fi - -# If we are testing the API, build and install consul -if grep -q "/consul/api" <<< "${GOFILES}"; then - # Create a temp dir and clean it up on exit - TEMPDIR=`mktemp -d -t consul-test.XXX` - trap "rm -rf ${TEMPDIR}" EXIT HUP INT QUIT TERM - - # Build the Consul binary for the API tests - echo "--> Building consul" - go build -tags="${GOTAGS}" -o $TEMPDIR/consul - PATH="${TEMPDIR}:${PATH}" -fi - -# Run the tests -echo "--> Running tests" -go test -timeout=360s -tags="${GOTAGS}" ${GOFILES} ${TESTARGS} diff --git a/scripts/verify_no_uuid.sh b/scripts/verify_no_uuid.sh deleted file mode 100755 index ed42ee52af..0000000000 --- a/scripts/verify_no_uuid.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env bash - -grep GenerateUUID consul/state/state_store.go -RESULT=$? -if [ $RESULT -eq 0 ]; then - exit 1 -fi - -grep GenerateUUID consul/fsm.go -RESULT=$? -if [ $RESULT -eq 0 ]; then - exit 1 -fi