Allen Li | 98a7721 | 2017-09-20 15:08:44 -0700 | [diff] [blame^] | 1 | #!/bin/bash |
| 2 | # Copyright 2017 The Chromium OS Authors. All rights reserved. |
| 3 | # Use of this source code is governed by a BSD-style license that can be |
| 4 | # found in the LICENSE file. |
| 5 | set -eu |
| 6 | cd -- "$(dirname -- "$0")" |
| 7 | cd -P .. |
| 8 | |
| 9 | if [ $# -ne 1 ]; then |
| 10 | printf "Usage: %s PACKAGE" "$0" >&2 |
| 11 | exit 1 |
| 12 | fi |
| 13 | |
| 14 | if ! command -v go >/dev/null; then |
| 15 | echo "go is not installed" >&2 |
| 16 | exit 1 |
| 17 | fi |
| 18 | export GOPATH="$PWD:/usr/lib/gopath" |
| 19 | go test -covermode=count -coverprofile=coverage.out "$@" |
| 20 | go tool cover -html=coverage.out |