mirror of https://github.com/status-im/op-geth.git
Use Makefile for Travis tests
This commit is contained in:
parent
c6b983e449
commit
aa03e53ca8
|
@ -30,3 +30,7 @@ deploy/osx/Mist\ Installer.dmg
|
|||
/build/_workspace/
|
||||
/build/bin/
|
||||
|
||||
# travis
|
||||
profile.tmp
|
||||
profile.cov
|
||||
|
||||
|
|
|
@ -4,13 +4,12 @@ go:
|
|||
before_install:
|
||||
- sudo add-apt-repository ppa:beineri/opt-qt541 -y
|
||||
- sudo apt-get update -qq
|
||||
- sudo apt-get install -yqq libgmp3-dev libreadline6-dev qt54quickcontrols qt54webengine
|
||||
- sudo apt-get install -yqq libgmp3-dev qt54quickcontrols qt54webengine
|
||||
install:
|
||||
# - go get code.google.com/p/go.tools/cmd/goimports
|
||||
# - go get github.com/golang/lint/golint
|
||||
# - go get golang.org/x/tools/cmd/vet
|
||||
- go get golang.org/x/tools/cmd/cover
|
||||
- go get github.com/mattn/goveralls
|
||||
- go get golang.org/x/tools/cmd/cover github.com/mattn/goveralls
|
||||
before_script:
|
||||
# - gofmt -l -w .
|
||||
# - goimports -l -w .
|
||||
|
@ -18,7 +17,7 @@ before_script:
|
|||
# - go vet ./...
|
||||
# - go test -race ./...
|
||||
script:
|
||||
- ./gocoverage.sh
|
||||
- make travis-test-with-coverage
|
||||
after_success:
|
||||
- if [ "$COVERALLS_TOKEN" ]; then goveralls -coverprofile=profile.cov -service=travis-ci -repotoken $COVERALLS_TOKEN; fi
|
||||
env:
|
||||
|
|
5
Makefile
5
Makefile
|
@ -2,7 +2,7 @@
|
|||
# with Go source code. If you know what GOPATH is then you probably
|
||||
# don't need to bother with make.
|
||||
|
||||
.PHONY: geth mist test clean
|
||||
.PHONY: geth mist all test travis-test-with-coverage clean
|
||||
GOBIN = build/bin
|
||||
|
||||
geth:
|
||||
|
@ -21,5 +21,8 @@ all:
|
|||
test: all
|
||||
build/env.sh go test ./...
|
||||
|
||||
travis-test-with-coverage: all
|
||||
build/env.sh build/test-global-coverage.sh
|
||||
|
||||
clean:
|
||||
rm -fr build/_workspace/pkg/ Godeps/_workspace/pkg $(GOBIN)/*
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
#!/bin/bash
|
||||
|
||||
# This script runs all package tests and merges the resulting coverage
|
||||
# profiles. Coverage is accounted per package under test.
|
||||
|
||||
set -e
|
||||
|
||||
if [ ! -f "build/env.sh" ]; then
|
||||
echo "$0 must be run from the root of the repository."
|
||||
exit 2
|
||||
fi
|
||||
|
||||
echo "mode: count" > profile.cov
|
||||
|
||||
for pkg in $(go list ./...); do
|
||||
# drop the namespace prefix.
|
||||
dir=${pkg##github.com/ethereum/go-ethereum/}
|
||||
|
||||
if [[ $dir != "tests/vm" ]]; then
|
||||
go test -covermode=count -coverprofile=$dir/profile.tmp $pkg
|
||||
fi
|
||||
if [[ -f $dir/profile.tmp ]]; then
|
||||
tail -n +2 $dir/profile.tmp >> profile.cov
|
||||
rm $dir/profile.tmp
|
||||
fi
|
||||
done
|
|
@ -1,31 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
# Add godep workspace to GOPATH. We do it manually instead of using
|
||||
# 'godep go test' or 'godep restore' so godep doesn't need to be installed.
|
||||
GOPATH="$PWD/Godeps/_workspace:$GOPATH"
|
||||
|
||||
# Install packages before testing. Not doing this would cause
|
||||
# 'go test' to recompile all package dependencies before testing each package.
|
||||
go install ./...
|
||||
|
||||
# Run test coverage on each subdirectories and merge the coverage profile.
|
||||
echo "mode: count" > profile.cov
|
||||
|
||||
# Standard go tooling behavior is to ignore dirs with leading underscors
|
||||
for dir in $(find . -maxdepth 10 -not -path './.git*' -not -path '*/_*' -type d);
|
||||
do
|
||||
if ls $dir/*.go &> /dev/null; then
|
||||
# echo $dir
|
||||
if [[ $dir != "./tests/vm" && $dir != "." ]]
|
||||
then
|
||||
go test -covermode=count -coverprofile=$dir/profile.tmp $dir
|
||||
fi
|
||||
if [ -f $dir/profile.tmp ]
|
||||
then
|
||||
cat $dir/profile.tmp | tail -n +2 >> profile.cov
|
||||
rm $dir/profile.tmp
|
||||
fi
|
||||
fi
|
||||
done
|
Loading…
Reference in New Issue