github.com/docker/docker-ce@v17.12.1-ce-rc2+incompatible/components/cli/scripts/test/unit-with-coverage (about)

     1  #!/usr/bin/env bash
     2  set -eu -o pipefail
     3  
     4  # install test dependencies once before running tests for each package. This
     5  # reduces the runtime from 200s down to 23s
     6  go test -i "$@"
     7  
     8  for pkg in "$@"; do
     9      ./scripts/test/unit \
    10          -cover \
    11          -coverprofile=profile.out \
    12          -covermode=atomic \
    13          "${pkg}"
    14  
    15      if test -f profile.out; then
    16          cat profile.out >> coverage.txt
    17          rm profile.out
    18      fi
    19  done