cov_report.sh 658 B

12345678910111213141516171819202122
  1. #!/bin/sh
  2. # This script uses gocov to generate a test coverage report.
  3. # The gocov tool my be obtained with the following command:
  4. # go get github.com/axw/gocov/gocov
  5. #
  6. # It will be installed to $GOPATH/bin, so ensure that location is in your $PATH.
  7. # Check for gocov.
  8. if ! type gocov >/dev/null 2>&1; then
  9. echo >&2 "This script requires the gocov tool."
  10. echo >&2 "You may obtain it with the following command:"
  11. echo >&2 "go get github.com/axw/gocov/gocov"
  12. exit 1
  13. fi
  14. # Only run the cgo tests if gcc is installed.
  15. if type gcc >/dev/null 2>&1; then
  16. (cd spew && gocov test -tags testcgo | gocov report)
  17. else
  18. (cd spew && gocov test | gocov report)
  19. fi