diff --git a/.gitignore b/.gitignore
index a90cb225b9df811e3967057e18aae0e2d6e8eae5..241c26a55bb4903c88d203a78913bebf09ee7a97 100644
--- a/.gitignore
+++ b/.gitignore
@@ -30,3 +30,7 @@ deploy/osx/Mist\ Installer.dmg
 /build/_workspace/
 /build/bin/
 
+# travis
+profile.tmp
+profile.cov
+
diff --git a/.travis.yml b/.travis.yml
index d6954e0cb7df48fe83776d3e562467506771ba73..b0f295fb63f436f5f9d0967a272da83e06588207 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -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:
diff --git a/Makefile b/Makefile
index 917e7f4ac6a3288eb6c6f191c5f6006b589041d0..03e3bf4c6f93789301be3058765e8189cccea45e 100644
--- a/Makefile
+++ b/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)/*
diff --git a/build/test-global-coverage.sh b/build/test-global-coverage.sh
new file mode 100755
index 0000000000000000000000000000000000000000..417c829f4f8510283b681d325898dfefe43fd1df
--- /dev/null
+++ b/build/test-global-coverage.sh
@@ -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
diff --git a/gocoverage.sh b/gocoverage.sh
deleted file mode 100755
index 5479d8d3b72c33effbe920c814713758c1ff5dcf..0000000000000000000000000000000000000000
--- a/gocoverage.sh
+++ /dev/null
@@ -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