github.com/docker/docker@v299999999.0.0-20200612211812-aaf470eca7b5+incompatible/hack/test/unit (about)

     1  #!/usr/bin/env bash
     2  #
     3  # Run unit tests and create report
     4  #
     5  # TESTFLAGS - add additional test flags. Ex:
     6  #
     7  #   TESTFLAGS='-v -run TestBuild' hack/test/unit
     8  #
     9  # TESTDIRS - run tests for specified packages. Ex:
    10  #
    11  #   TESTDIRS='./pkg/term' hack/test/unit
    12  #
    13  set -eu -o pipefail
    14  
    15  BUILDFLAGS=(-tags 'netgo seccomp libdm_no_deferred_remove')
    16  TESTFLAGS+=" -test.timeout=${TIMEOUT:-5m}"
    17  TESTDIRS="${TESTDIRS:-./...}"
    18  exclude_paths='/vendor/|/integration'
    19  pkg_list=$(go list $TESTDIRS | grep -vE "($exclude_paths)")
    20  
    21  mkdir -p bundles
    22  gotestsum --format=standard-quiet --jsonfile=bundles/go-test-report.json --junitfile=bundles/junit-report.xml -- \
    23  	"${BUILDFLAGS[@]}" \
    24  	-cover \
    25  	-coverprofile=bundles/profile.out \
    26  	-covermode=atomic \
    27  	${TESTFLAGS} \
    28  	${pkg_list}