diff options
| author | Dave Collins <[email protected]> | 2013-09-21 21:54:56 -0500 |
|---|---|---|
| committer | Dave Collins <[email protected]> | 2013-09-21 21:54:56 -0500 |
| commit | ee37a939d02e3778801d7dbb039e9999e0de758a (patch) | |
| tree | 75702b6ec5cf4fc9b9bb7e92318f80c2e4c57633 | |
| parent | 56a83c905e47b41640b0a8281d80acd377d958fa (diff) | |
Add a script to generate test coverage report.
This commit adds a script which can be used to generate the test coverage
report. It detects whether or not gcc is installed and adds the necessary
build tag to enable the new cgo tests when gcc is available.
| -rw-r--r-- | cov_report.sh | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/cov_report.sh b/cov_report.sh new file mode 100644 index 0000000..9579497 --- /dev/null +++ b/cov_report.sh @@ -0,0 +1,22 @@ +#!/bin/sh + +# This script uses gocov to generate a test coverage report. +# The gocov tool my be obtained with the following command: +# go get github.com/axw/gocov/gocov +# +# It will be installed to $GOPATH/bin, so ensure that location is in your $PATH. + +# Check for gocov. +if ! type gocov >/dev/null 2>&1; then + echo >&2 "This script requires the gocov tool." + echo >&2 "You may obtain it with the following command:" + echo >&2 "go get github.com/axw/gocov/gocov" + exit 1 +fi + +# Only run the cgo tests if gcc is installed. +if type gcc >/dev/null 2>&1; then + (cd spew && gocov test -tags testcgo | gocov report) +else + (cd spew && gocov test | gocov report) +fi |
