2017-02-13 19:01:54 +00:00
|
|
|
#!/usr/bin/env bash
|
2014-04-08 04:14:19 +00:00
|
|
|
set -e
|
2013-10-18 05:36:28 +00:00
|
|
|
|
2013-09-10 01:45:40 +00:00
|
|
|
# Run Docker's test suite, including sub-packages, and store their output as a bundle
|
2013-10-15 21:54:52 +00:00
|
|
|
# If $TESTFLAGS is set in the environment, it is passed as extra arguments to 'go test'.
|
2016-09-21 05:48:06 +00:00
|
|
|
# You can use this to select certain tests to run, e.g.
|
2013-12-02 21:52:27 +00:00
|
|
|
#
|
2015-04-03 22:05:14 +00:00
|
|
|
# TESTFLAGS='-test.run ^TestBuild$' ./hack/make.sh test-unit
|
2013-10-15 21:54:52 +00:00
|
|
|
#
|
2014-04-29 22:49:03 +00:00
|
|
|
bundle_test_unit() {
|
2016-03-11 19:06:56 +00:00
|
|
|
TESTFLAGS+=" -test.timeout=${TIMEOUT}"
|
2016-06-14 19:56:38 +00:00
|
|
|
INCBUILD="-i"
|
|
|
|
count=0
|
|
|
|
for flag in "${BUILDFLAGS[@]}"; do
|
|
|
|
if [ "${flag}" == ${INCBUILD} ]; then
|
|
|
|
unset BUILDFLAGS[${count}]
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
count=$[ ${count} + 1 ]
|
|
|
|
done
|
|
|
|
|
2015-10-28 23:58:05 +00:00
|
|
|
date
|
2015-11-02 18:44:09 +00:00
|
|
|
if [ -z "$TESTDIRS" ]; then
|
|
|
|
TEST_PATH=./...
|
|
|
|
else
|
|
|
|
TEST_PATH=./${TESTDIRS}
|
|
|
|
fi
|
2016-06-07 07:45:21 +00:00
|
|
|
|
2017-06-28 03:18:55 +00:00
|
|
|
source "${MAKEDIR}/.go-autogen"
|
|
|
|
|
2016-06-07 07:45:21 +00:00
|
|
|
if [ "$(go env GOHOSTOS)" = 'solaris' ]; then
|
|
|
|
pkg_list=$(go list -e \
|
|
|
|
-f '{{if ne .Name "github.com/docker/docker"}}
|
|
|
|
{{.ImportPath}}
|
|
|
|
{{end}}' \
|
|
|
|
"${BUILDFLAGS[@]}" $TEST_PATH \
|
|
|
|
| grep github.com/docker/docker \
|
|
|
|
| grep -v github.com/docker/docker/vendor \
|
|
|
|
| grep -v github.com/docker/docker/daemon/graphdriver \
|
|
|
|
| grep -v github.com/docker/docker/man \
|
|
|
|
| grep -v github.com/docker/docker/integration-cli)
|
|
|
|
else
|
|
|
|
pkg_list=$(go list -e \
|
|
|
|
-f '{{if ne .Name "github.com/docker/docker"}}
|
|
|
|
{{.ImportPath}}
|
|
|
|
{{end}}' \
|
|
|
|
"${BUILDFLAGS[@]}" $TEST_PATH \
|
|
|
|
| grep github.com/docker/docker \
|
|
|
|
| grep -v github.com/docker/docker/vendor \
|
|
|
|
| grep -v github.com/docker/docker/man \
|
|
|
|
| grep -v github.com/docker/docker/integration-cli)
|
|
|
|
fi
|
|
|
|
|
2016-08-25 17:24:35 +00:00
|
|
|
go test -cover -ldflags "$LDFLAGS" "${BUILDFLAGS[@]}" $TESTFLAGS $pkg_list
|
2017-06-05 11:57:01 +00:00
|
|
|
go test -cover -ldflags "$LDFLAGS" "${BUILDFLAGS[@]}" $TESTFLAGS github.com/docker/docker/pkg/term -test.root
|
2013-09-10 01:45:40 +00:00
|
|
|
}
|
|
|
|
|
2015-04-14 16:08:08 +00:00
|
|
|
bundle_test_unit 2>&1 | tee -a "$DEST/test.log"
|