Browse code

Unify hack/make/*test further by invoking hack/make/test directly from dyntest

Tianon Gravi authored on 2013/12/09 07:32:17
Showing 1 changed files
... ...
@@ -10,61 +10,7 @@ if [ ! -x "$INIT" ]; then
10 10
 	false
11 11
 fi
12 12
 
13
-TEXTRESET=$'\033[0m' # reset the foreground colour
14
-RED=$'\033[31m'
15
-GREEN=$'\033[32m'
13
+export TEST_DOCKERINIT_PATH="$INIT"
16 14
 
17
-# Run Docker's test suite, including sub-packages, and store their output as a bundle
18
-# If $TESTFLAGS is set in the environment, it is passed as extra arguments to 'go test'.
19
-# You can use this to select certain tests to run, eg.
20
-#
21
-#   TESTFLAGS='-run ^TestBuild$' ./hack/make.sh test
22
-#
23
-bundle_test() {
24
-	{
25
-		date
26
-
27
-		export TEST_DOCKERINIT_PATH=$DEST/../dynbinary/dockerinit-$VERSION
28
-
29
-		TESTS_FAILED=()
30
-		for test_dir in $(find_test_dirs); do
31
-			echo
32
-
33
-			if ! LDFLAGS="$LDFLAGS -X github.com/dotcloud/docker/utils.INITSHA1 \"$DOCKER_INITSHA1\"" go_test_dir "$test_dir"; then
34
-				TESTS_FAILED+=("$test_dir")
35
-				echo
36
-				echo "${RED}Tests failed: $test_dir${TEXTRESET}"
37
-				sleep 1 # give it a second, so observers watching can take note
38
-			fi
39
-		done
40
-
41
-		echo
42
-		echo
43
-		echo
44
-
45
-		# if some tests fail, we want the bundlescript to fail, but we want to
46
-		# try running ALL the tests first, hence TESTS_FAILED
47
-		if [ "${#TESTS_FAILED[@]}" -gt 0 ]; then
48
-			echo "${RED}Test failures in: ${TESTS_FAILED[@]}${TEXTRESET}"
49
-			echo
50
-			false
51
-		else
52
-			echo "${GREEN}Test success${TEXTRESET}"
53
-			echo
54
-			true
55
-		fi
56
-	} 2>&1 | tee $DEST/test.log
57
-}
58
-
59
-
60
-# This helper function walks the current directory looking for directories
61
-# holding Go test files, and prints their paths on standard output, one per
62
-# line.
63
-find_test_dirs() {
64
-	find -not \( \
65
-		\( -wholename './vendor' -o -wholename './integration' \) \
66
-		-prune \
67
-	\) -name '*_test.go' -print0 | xargs -0n1 dirname | sort -u
68
-}
69
-
70
-bundle_test
15
+LDFLAGS_STATIC="-X github.com/dotcloud/docker/utils.INITSHA1 \"$DOCKER_INITSHA1\"" \
16
+	source "$(dirname "$BASH_SOURCE")/test"