test-global-coverage.sh 655 B

1234567891011121314151617181920212223242526
  1. #!/bin/bash
  2. # This script runs all package tests and merges the resulting coverage
  3. # profiles. Coverage is accounted per package under test.
  4. set -e
  5. if [ ! -f "build/env.sh" ]; then
  6. echo "$0 must be run from the root of the repository."
  7. exit 2
  8. fi
  9. echo "mode: count" > profile.cov
  10. for pkg in $(go list ./...); do
  11. # drop the namespace prefix.
  12. dir=${pkg##github.com/ethereum/go-ethereum/}
  13. if [[ $dir != "tests/vm" ]]; then
  14. go test -covermode=count -coverprofile=$dir/profile.tmp $pkg
  15. fi
  16. if [[ -f $dir/profile.tmp ]]; then
  17. tail -n +2 $dir/profile.tmp >> profile.cov
  18. rm $dir/profile.tmp
  19. fi
  20. done