| ... | ... |
@@ -62,6 +62,24 @@ LDFLAGS='-X main.GITCOMMIT "'$GITCOMMIT'" -X main.VERSION "'$VERSION'" -w' |
| 62 | 62 |
LDFLAGS_STATIC='-X github.com/dotcloud/docker/utils.IAMSTATIC true -linkmode external -extldflags "-lpthread -static -Wl,--unresolved-symbols=ignore-in-object-files"' |
| 63 | 63 |
BUILDFLAGS='-tags netgo' |
| 64 | 64 |
|
| 65 |
+# If $TESTFLAGS is set in the environment, it is passed as extra arguments to 'go test'. |
|
| 66 |
+# You can use this to select certain tests to run, eg. |
|
| 67 |
+# |
|
| 68 |
+# TESTFLAGS='-run ^TestBuild$' ./hack/make.sh test |
|
| 69 |
+# |
|
| 70 |
+go_test_dir() {
|
|
| 71 |
+ dir=$1 |
|
| 72 |
+ ( # we run "go test -i" ouside the "set -x" to provde cleaner output |
|
| 73 |
+ cd "$dir" |
|
| 74 |
+ go test -i -ldflags "$LDFLAGS" $BUILDFLAGS |
|
| 75 |
+ ) |
|
| 76 |
+ ( |
|
| 77 |
+ set -x |
|
| 78 |
+ cd "$dir" |
|
| 79 |
+ go test -ldflags "$LDFLAGS" $BUILDFLAGS $TESTFLAGS |
|
| 80 |
+ ) |
|
| 81 |
+} |
|
| 82 |
+ |
|
| 65 | 83 |
bundle() {
|
| 66 | 84 |
bundlescript=$1 |
| 67 | 85 |
bundle=$(basename $bundlescript) |
| ... | ... |
@@ -17,29 +17,20 @@ GREEN=$'\033[32m' |
| 17 | 17 |
# Run Docker's test suite, including sub-packages, and store their output as a bundle |
| 18 | 18 |
# If $TESTFLAGS is set in the environment, it is passed as extra arguments to 'go test'. |
| 19 | 19 |
# You can use this to select certain tests to run, eg. |
| 20 |
-# |
|
| 21 |
-# TESTFLAGS='-run ^TestBuild$' ./hack/make.sh test |
|
| 20 |
+# |
|
| 21 |
+# TESTFLAGS='-run ^TestBuild$' ./hack/make.sh test |
|
| 22 | 22 |
# |
| 23 | 23 |
bundle_test() {
|
| 24 | 24 |
{
|
| 25 | 25 |
date |
| 26 |
- |
|
| 26 |
+ |
|
| 27 |
+ export TEST_DOCKERINIT_PATH=$DEST/../dynbinary/dockerinit-$VERSION |
|
| 28 |
+ |
|
| 27 | 29 |
TESTS_FAILED=() |
| 28 | 30 |
for test_dir in $(find_test_dirs); do |
| 29 | 31 |
echo |
| 30 |
- |
|
| 31 |
- if ! ( |
|
| 32 |
- set -x |
|
| 33 |
- cd $test_dir |
|
| 34 |
- |
|
| 35 |
- # Install packages that are dependencies of the tests. |
|
| 36 |
- # Note: Does not run the tests. |
|
| 37 |
- go test -i -ldflags "$LDFLAGS" $BUILDFLAGS |
|
| 38 |
- |
|
| 39 |
- # Run the tests with the optional $TESTFLAGS. |
|
| 40 |
- export TEST_DOCKERINIT_PATH=$DEST/../dynbinary/dockerinit-$VERSION |
|
| 41 |
- go test -ldflags "$LDFLAGS -X github.com/dotcloud/docker/utils.INITSHA1 \"$DOCKER_INITSHA1\"" $BUILDFLAGS $TESTFLAGS |
|
| 42 |
- ); then |
|
| 32 |
+ |
|
| 33 |
+ if ! LDFLAGS="$LDFLAGS -X github.com/dotcloud/docker/utils.INITSHA1 \"$DOCKER_INITSHA1\"" go_test_dir "$test_dir"; then |
|
| 43 | 34 |
TESTS_FAILED+=("$test_dir")
|
| 44 | 35 |
echo |
| 45 | 36 |
echo "${RED}Tests failed: $test_dir${TEXTRESET}"
|
| ... | ... |
@@ -12,7 +12,7 @@ GREEN=$'\033[32m' |
| 12 | 12 |
# If $TESTFLAGS is set in the environment, it is passed as extra arguments to 'go test'. |
| 13 | 13 |
# You can use this to select certain tests to run, eg. |
| 14 | 14 |
# |
| 15 |
-# TESTFLAGS='-run ^TestBuild$' ./hack/make.sh test |
|
| 15 |
+# TESTFLAGS='-run ^TestBuild$' ./hack/make.sh test |
|
| 16 | 16 |
# |
| 17 | 17 |
bundle_test() {
|
| 18 | 18 |
{
|
| ... | ... |
@@ -22,17 +22,7 @@ bundle_test() {
|
| 22 | 22 |
for test_dir in $(find_test_dirs); do |
| 23 | 23 |
echo |
| 24 | 24 |
|
| 25 |
- if ! ( |
|
| 26 |
- set -x |
|
| 27 |
- cd $test_dir |
|
| 28 |
- |
|
| 29 |
- # Install packages that are dependencies of the tests. |
|
| 30 |
- # Note: Does not run the tests. |
|
| 31 |
- go test -i -ldflags "$LDFLAGS $LDFLAGS_STATIC" $BUILDFLAGS |
|
| 32 |
- |
|
| 33 |
- # Run the tests with the optional $TESTFLAGS. |
|
| 34 |
- go test -ldflags "$LDFLAGS $LDFLAGS_STATIC" $BUILDFLAGS $TESTFLAGS |
|
| 35 |
- ); then |
|
| 25 |
+ if ! LDFLAGS="$LDFLAGS $LDFLAGS_STATIC" go_test_dir "$test_dir"; then |
|
| 36 | 26 |
TESTS_FAILED+=("$test_dir")
|
| 37 | 27 |
echo |
| 38 | 28 |
echo "${RED}Tests failed: $test_dir${TEXTRESET}"
|