2013-12-02 17:48:26 -05:00
|
|
|
#!/bin/bash
|
2014-04-08 00:14:19 -04:00
|
|
|
set -e
|
2013-10-18 01:36:28 -04:00
|
|
|
|
2013-09-09 21:45:40 -04:00
|
|
|
# Run Docker's test suite, including sub-packages, and store their output as a bundle
|
2013-10-15 17:54:52 -04:00
|
|
|
# If $TESTFLAGS is set in the environment, it is passed as extra arguments to 'go test'.
|
|
|
|
# You can use this to select certain tests to run, eg.
|
2013-12-02 16:52:27 -05:00
|
|
|
#
|
2015-04-03 18:05:14 -04:00
|
|
|
# TESTFLAGS='-test.run ^TestBuild$' ./hack/make.sh test-unit
|
2013-10-15 17:54:52 -04:00
|
|
|
#
|
2014-04-29 18:49:03 -04:00
|
|
|
bundle_test_unit() {
|
2015-10-28 19:58:05 -04:00
|
|
|
date
|
2015-11-02 13:44:09 -05:00
|
|
|
if [ -z "$TESTDIRS" ]; then
|
|
|
|
TEST_PATH=./...
|
|
|
|
else
|
|
|
|
TEST_PATH=./${TESTDIRS}
|
|
|
|
fi
|
2015-10-28 19:58:05 -04:00
|
|
|
pkg_list=$(go list -e \
|
|
|
|
-f '{{if ne .Name "github.com/docker/docker"}}
|
2015-11-02 13:44:09 -05:00
|
|
|
{{.ImportPath}}
|
|
|
|
{{end}}' \
|
|
|
|
"${BUILDFLAGS[@]}" $TEST_PATH \
|
2015-11-01 21:21:17 -05:00
|
|
|
| grep github.com/docker/docker \
|
2015-10-28 19:58:05 -04:00
|
|
|
| grep -v github.com/docker/docker/vendor \
|
|
|
|
| grep -v github.com/docker/docker/integration-cli)
|
2015-10-31 16:22:44 -04:00
|
|
|
go test $COVER $GCCGOFLAGS -ldflags "$LDFLAGS" "${BUILDFLAGS[@]}" $TESTFLAGS $pkg_list
|
2013-09-09 21:45:40 -04:00
|
|
|
}
|
|
|
|
|
2015-11-07 11:23:10 -05:00
|
|
|
|
|
|
|
if [[ "$(go version)" == *"gccgo"* ]]; then
|
2015-10-31 16:22:44 -04:00
|
|
|
GCCGOFLAGS=-gccgoflags="-lpthread"
|
|
|
|
else
|
|
|
|
COVER=-cover
|
|
|
|
fi
|
2015-04-14 12:08:08 -04:00
|
|
|
bundle_test_unit 2>&1 | tee -a "$DEST/test.log"
|