diff --git a/Makefile b/Makefile index 9d3ff9ccf..9dbafd103 100644 --- a/Makefile +++ b/Makefile @@ -21,10 +21,12 @@ # - all (default) - builds all targets and runs all tests # - license - check all go files for license headers # - cop - builds the cop executable -# - tests - runs all the cop tests -# - unit-tests - runs the go-test based unit tests +# - unit-tests - Performs checks first and runs the go-test based unit tests +# - checks - runs all check conditions (license, format, imports, lint and vet) -all: license vet lint format imports cop tests unit-tests +all: checks cop unit-tests + +checks: license vet lint format imports license: .FORCE @scripts/check_license @@ -46,9 +48,7 @@ cop: @mkdir -p bin && cd cli && go build -o ../bin/cop @echo "Built bin/cop" -tests: cop unit-tests - -unit-tests: cop +unit-tests: checks cop @scripts/run_tests .FORCE: diff --git a/scripts/run_tests b/scripts/run_tests index fdee5d7aa..7b5d67b56 100755 --- a/scripts/run_tests +++ b/scripts/run_tests @@ -6,12 +6,9 @@ echo "Running all tests ..." go get github.com/axw/gocov/... go get github.com/AlekSi/gocov-xml -for file in `find . | egrep -v "vendor|.git|bin|scripts|testdata|idp"` -do - if [ -d $file ]; then - gocov test $file | gocov-xml > coverage.xml - fi -done +PKGS=`go list github.com/hyperledger/fabric-cop/... | grep -v /vendor/` + +gocov test $PKGS | gocov-xml > coverage.xml } | tee /tmp/test.results echo "Finished running all tests" SC=0