2013-12-02 15:48:26 -07:00
|
|
|
#!/bin/bash
|
2014-04-07 22:14:19 -06:00
|
|
|
set -e
|
2013-10-17 23:36:28 -06:00
|
|
|
|
2013-09-09 18:45:40 -07: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'.
|
|
|
|
# You can use this to select certain tests to run, eg.
|
2013-12-02 13:52:27 -08:00
|
|
|
#
|
2015-04-03 15:05:14 -07: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() {
|
2015-10-28 16:58:05 -07:00
|
|
|
date
|
2015-11-02 19:44:09 +01:00
|
|
|
if [ -z "$TESTDIRS" ]; then
|
|
|
|
TEST_PATH=./...
|
|
|
|
else
|
|
|
|
TEST_PATH=./${TESTDIRS}
|
|
|
|
fi
|
2015-10-28 16:58:05 -07:00
|
|
|
pkg_list=$(go list -e \
|
|
|
|
-f '{{if ne .Name "github.com/docker/docker"}}
|
2015-11-02 19:44:09 +01:00
|
|
|
{{.ImportPath}}
|
|
|
|
{{end}}' \
|
|
|
|
"${BUILDFLAGS[@]}" $TEST_PATH \
|
2015-11-01 18:21:17 -08:00
|
|
|
| grep github.com/docker/docker \
|
2015-10-28 16:58:05 -07:00
|
|
|
| grep -v github.com/docker/docker/vendor \
|
|
|
|
| grep -v github.com/docker/docker/integration-cli)
|
2015-10-31 20:22:44 +00:00
|
|
|
go test $COVER $GCCGOFLAGS -ldflags "$LDFLAGS" "${BUILDFLAGS[@]}" $TESTFLAGS $pkg_list
|
2013-09-09 18:45:40 -07:00
|
|
|
}
|
|
|
|
|
2015-11-07 08:23:10 -08:00
|
|
|
|
|
|
|
if [[ "$(go version)" == *"gccgo"* ]]; then
|
2015-10-31 20:22:44 +00:00
|
|
|
GCCGOFLAGS=-gccgoflags="-lpthread"
|
|
|
|
else
|
|
|
|
COVER=-cover
|
|
|
|
fi
|
2015-04-14 18:08:08 +02:00
|
|
|
bundle_test_unit 2>&1 | tee -a "$DEST/test.log"
|