Skip to content

Commit

Permalink
Use Makefile for Travis tests
Browse files Browse the repository at this point in the history
  • Loading branch information
fjl committed Apr 29, 2015
1 parent c6b983e commit aa03e53
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 36 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,7 @@ deploy/osx/Mist\ Installer.dmg
/build/_workspace/
/build/bin/

# travis
profile.tmp
profile.cov

7 changes: 3 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,20 @@ 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 .
# - golint .
# - 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:
Expand Down
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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)/*
26 changes: 26 additions & 0 deletions build/test-global-coverage.sh
Original file line number Diff line number Diff line change
@@ -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
31 changes: 0 additions & 31 deletions gocoverage.sh

This file was deleted.

0 comments on commit aa03e53

Please sign in to comment.