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, e.g.
8 # TESTFLAGS='-test.run ^TestBuild$' ./hack/make.sh test-unit
11 TESTFLAGS+=" -test.timeout=${TIMEOUT}"
14 for flag in "${BUILDFLAGS[@]}"; do
15 if [ "${flag}" == ${INCBUILD} ]; then
16 unset BUILDFLAGS[${count}]
19 count=$[ ${count} + 1 ]
23 if [ -z "$TESTDIRS" ]; then
26 TEST_PATH=./${TESTDIRS}
29 source "${MAKEDIR}/.go-autogen"
31 if [ "$(go env GOHOSTOS)" = 'solaris' ]; then
32 pkg_list=$(go list -e \
33 -f '{{if ne .Name "github.com/docker/docker"}}
36 "${BUILDFLAGS[@]}" $TEST_PATH \
37 | grep github.com/docker/docker \
38 | grep -v github.com/docker/docker/vendor \
39 | grep -v github.com/docker/docker/daemon/graphdriver \
40 | grep -v github.com/docker/docker/man \
41 | grep -v github.com/docker/docker/integration-cli \
42 | grep -v github.com/docker/docker/daemon/cluster)
44 pkg_list=$(go list -e \
45 -f '{{if ne .Name "github.com/docker/docker"}}
48 "${BUILDFLAGS[@]}" $TEST_PATH \
49 | grep github.com/docker/docker \
50 | grep -v github.com/docker/docker/vendor \
51 | grep -v github.com/docker/docker/man \
52 | grep -v github.com/docker/docker/integration-cli \
53 | grep -v github.com/docker/docker/daemon/cluster)
56 go test -cover -ldflags "$LDFLAGS" "${BUILDFLAGS[@]}" $TESTFLAGS $pkg_list
57 go test -cover -ldflags "$LDFLAGS" "${BUILDFLAGS[@]}" $TESTFLAGS github.com/docker/docker/pkg/term -test.root
60 bundle_test_unit 2>&1 | tee -a "$DEST/test.log"