test.sh 718 B

123456789101112131415161718192021222324252627282930
  1. #!/bin/bash
  2. set -e
  3. # Build and install all binaries in PATH
  4. export GOBIN="${HOME}/bin"
  5. export PATH="${PATH}:${GOBIN}"
  6. make install
  7. # Run go tests
  8. echo "" > coverage.txt
  9. for package in $(go list ./...); do
  10. if echo "$package" | grep -q "/scan/crypto"; then
  11. echo "skipped $package"
  12. continue
  13. fi
  14. # only run the race detector on x86_64
  15. if [ "$(uname -m)" = "x86_64" ]; then
  16. go test -mod=vendor -tags "$BUILD_TAGS" -race -coverprofile=profile.out -covermode=atomic $package
  17. else
  18. go test -mod=vendor -tags "$BUILD_TAGS" -coverprofile=profile.out $package
  19. fi
  20. if [ -f profile.out ]; then
  21. cat profile.out >> coverage.txt
  22. rm profile.out
  23. fi
  24. done