#!/bin/bash | |
# Copyright 2017 The Chromium OS Authors. All rights reserved. | |
# Use of this source code is governed by a BSD-style license that can be | |
# found in the LICENSE file. | |
set -eu | |
cd -- "$(dirname -- "$0")" | |
cd -P .. | |
if [ $# -ne 1 ]; then | |
printf "Usage: %s PACKAGE" "$0" >&2 | |
exit 1 | |
fi | |
if ! command -v go >/dev/null; then | |
echo "go is not installed" >&2 | |
exit 1 | |
fi | |
export GOPATH="$PWD:/usr/lib/gopath" | |
go test -covermode=count -coverprofile=coverage.out "$@" | |
go tool cover -html=coverage.out |