github.com/sijibomii/docker@v0.0.0-20231230191044-5cf6ca554647/hack/make/test-unit (about) 1 #!/bin/bash 2 set -e 3 4 # Run Docker's test suite, including sub-packages, and store their output as a bundle 5 # If $TESTFLAGS is set in the environment, it is passed as extra arguments to 'go test'. 6 # You can use this to select certain tests to run, eg. 7 # 8 # TESTFLAGS='-test.run ^TestBuild$' ./hack/make.sh test-unit 9 # 10 bundle_test_unit() { 11 TESTFLAGS+=" -test.timeout=${TIMEOUT}" 12 date 13 if [ -z "$TESTDIRS" ]; then 14 TEST_PATH=./... 15 else 16 TEST_PATH=./${TESTDIRS} 17 fi 18 pkg_list=$(go list -e \ 19 -f '{{if ne .Name "github.com/docker/docker"}} 20 {{.ImportPath}} 21 {{end}}' \ 22 "${BUILDFLAGS[@]}" $TEST_PATH \ 23 | grep github.com/docker/docker \ 24 | grep -v github.com/docker/docker/vendor \ 25 | grep -v github.com/docker/docker/integration-cli) 26 go test $COVER $GCCGOFLAGS -ldflags "$LDFLAGS" "${BUILDFLAGS[@]}" $TESTFLAGS $pkg_list 27 } 28 29 30 if [[ "$(go version)" == *"gccgo"* ]]; then 31 GCCGOFLAGS=-gccgoflags="-lpthread" 32 else 33 COVER=-cover 34 fi 35 bundle_test_unit 2>&1 | tee -a "$DEST/test.log"