Skip to content

Commit aa03e53

Browse files
committed
Use Makefile for Travis tests
1 parent c6b983e commit aa03e53

File tree

5 files changed

+37
-36
lines changed

5 files changed

+37
-36
lines changed

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,7 @@ deploy/osx/Mist\ Installer.dmg
3030
/build/_workspace/
3131
/build/bin/
3232

33+
# travis
34+
profile.tmp
35+
profile.cov
36+

.travis.yml

+3-4
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,20 @@ go:
44
before_install:
55
- sudo add-apt-repository ppa:beineri/opt-qt541 -y
66
- sudo apt-get update -qq
7-
- sudo apt-get install -yqq libgmp3-dev libreadline6-dev qt54quickcontrols qt54webengine
7+
- sudo apt-get install -yqq libgmp3-dev qt54quickcontrols qt54webengine
88
install:
99
# - go get code.google.com/p/go.tools/cmd/goimports
1010
# - go get github.com/golang/lint/golint
1111
# - go get golang.org/x/tools/cmd/vet
12-
- go get golang.org/x/tools/cmd/cover
13-
- go get github.com/mattn/goveralls
12+
- go get golang.org/x/tools/cmd/cover github.com/mattn/goveralls
1413
before_script:
1514
# - gofmt -l -w .
1615
# - goimports -l -w .
1716
# - golint .
1817
# - go vet ./...
1918
# - go test -race ./...
2019
script:
21-
- ./gocoverage.sh
20+
- make travis-test-with-coverage
2221
after_success:
2322
- if [ "$COVERALLS_TOKEN" ]; then goveralls -coverprofile=profile.cov -service=travis-ci -repotoken $COVERALLS_TOKEN; fi
2423
env:

Makefile

+4-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# with Go source code. If you know what GOPATH is then you probably
33
# don't need to bother with make.
44

5-
.PHONY: geth mist test clean
5+
.PHONY: geth mist all test travis-test-with-coverage clean
66
GOBIN = build/bin
77

88
geth:
@@ -21,5 +21,8 @@ all:
2121
test: all
2222
build/env.sh go test ./...
2323

24+
travis-test-with-coverage: all
25+
build/env.sh build/test-global-coverage.sh
26+
2427
clean:
2528
rm -fr build/_workspace/pkg/ Godeps/_workspace/pkg $(GOBIN)/*

build/test-global-coverage.sh

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/bin/bash
2+
3+
# This script runs all package tests and merges the resulting coverage
4+
# profiles. Coverage is accounted per package under test.
5+
6+
set -e
7+
8+
if [ ! -f "build/env.sh" ]; then
9+
echo "$0 must be run from the root of the repository."
10+
exit 2
11+
fi
12+
13+
echo "mode: count" > profile.cov
14+
15+
for pkg in $(go list ./...); do
16+
# drop the namespace prefix.
17+
dir=${pkg##github.com/ethereum/go-ethereum/}
18+
19+
if [[ $dir != "tests/vm" ]]; then
20+
go test -covermode=count -coverprofile=$dir/profile.tmp $pkg
21+
fi
22+
if [[ -f $dir/profile.tmp ]]; then
23+
tail -n +2 $dir/profile.tmp >> profile.cov
24+
rm $dir/profile.tmp
25+
fi
26+
done

gocoverage.sh

-31
This file was deleted.

0 commit comments

Comments
 (0)