github.com/DaoCloud/dao@v0.0.0-20161212064103-c3dbfd13ee36/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/man \ 26 | grep -v github.com/docker/docker/integration-cli) 27 go test $COVER $GCCGOFLAGS -ldflags "$LDFLAGS" "${BUILDFLAGS[@]}" $TESTFLAGS $pkg_list 28 } 29 30 31 if [[ "$(go version)" == *"gccgo"* ]]; then 32 GCCGOFLAGS=-gccgoflags="-lpthread" 33 else 34 COVER=-cover 35 fi 36 bundle_test_unit 2>&1 | tee -a "$DEST/test.log"