github.com/jfrazelle/docker@v1.1.2-0.20210712172922-bf78e25fe508/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 -eux -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 echo "${pkg_list}" | grep --fixed-strings "libnetwork/drivers/bridge" \ 22 && if ! type docker-proxy; then 23 hack/make.sh binary-proxy install-proxy 24 fi 25 26 mkdir -p bundles 27 gotestsum --format=standard-quiet --jsonfile=bundles/go-test-report.json --junitfile=bundles/junit-report.xml -- \ 28 "${BUILDFLAGS[@]}" \ 29 -cover \ 30 -coverprofile=bundles/profile.out \ 31 -covermode=atomic \ 32 ${TESTFLAGS} \ 33 ${pkg_list}