Browse code

Update test scripts to always run ALL tests, even when some fail

Tianon Gravi authored on 2013/11/22 08:19:19
Showing 2 changed files
... ...
@@ -19,18 +19,35 @@ fi
19 19
 bundle_test() {
20 20
 	{
21 21
 		date
22
-		for test_dir in $(find_test_dirs); do (
23
-			set -x
24
-			cd $test_dir
22
+		
23
+		TESTS_FAILED=()
24
+		for test_dir in $(find_test_dirs); do
25
+			echo
25 26
 			
26
-			# Install packages that are dependencies of the tests.
27
-			#   Note: Does not run the tests.
28
-			go test -i -ldflags "$LDFLAGS" $BUILDFLAGS
29
-			
30
-			# Run the tests with the optional $TESTFLAGS.
31
-			export TEST_DOCKERINIT_PATH=$DEST/../dynbinary/dockerinit-$VERSION
32
-			go test -v -ldflags "$LDFLAGS -X github.com/dotcloud/docker/utils.INITSHA1 \"$DOCKER_INITSHA1\"" $BUILDFLAGS $TESTFLAGS
33
-		)  done
27
+			if ! (
28
+				set -x
29
+				cd $test_dir
30
+				
31
+				# Install packages that are dependencies of the tests.
32
+				#   Note: Does not run the tests.
33
+				go test -i -ldflags "$LDFLAGS" $BUILDFLAGS
34
+				
35
+				# Run the tests with the optional $TESTFLAGS.
36
+				export TEST_DOCKERINIT_PATH=$DEST/../dynbinary/dockerinit-$VERSION
37
+				go test -v -ldflags "$LDFLAGS -X github.com/dotcloud/docker/utils.INITSHA1 \"$DOCKER_INITSHA1\"" $BUILDFLAGS $TESTFLAGS
38
+			); then
39
+				TESTS_FAILED+=("$test_dir")
40
+				sleep 1 # give it a second, so observers watching can take note
41
+			fi
42
+		done
43
+		
44
+		# if some tests fail, we want the bundlescript to fail, but we want to
45
+		# try running ALL the tests first, hence TESTS_FAILED
46
+		if [ "${#TESTS_FAILED[@]}" -gt 0 ]; then
47
+			echo
48
+			echo "Test failures in: ${TESTS_FAILED[@]}"
49
+			false
50
+		fi
34 51
 	} 2>&1 | tee $DEST/test.log
35 52
 }
36 53
 
... ...
@@ -13,17 +13,34 @@ set -e
13 13
 bundle_test() {
14 14
 	{
15 15
 		date
16
-		for test_dir in $(find_test_dirs); do (
17
-			set -x
18
-			cd $test_dir
16
+		
17
+		TESTS_FAILED=()
18
+		for test_dir in $(find_test_dirs); do
19
+			echo
19 20
 			
20
-			# Install packages that are dependencies of the tests.
21
-			#   Note: Does not run the tests.
22
-			go test -i -ldflags "$LDFLAGS $LDFLAGS_STATIC" $BUILDFLAGS
23
-			
24
-			# Run the tests with the optional $TESTFLAGS.
25
-			go test -v -ldflags "$LDFLAGS $LDFLAGS_STATIC" $BUILDFLAGS $TESTFLAGS
26
-		)  done
21
+			if ! (
22
+				set -x
23
+				cd $test_dir
24
+				
25
+				# Install packages that are dependencies of the tests.
26
+				#   Note: Does not run the tests.
27
+				go test -i -ldflags "$LDFLAGS $LDFLAGS_STATIC" $BUILDFLAGS
28
+				
29
+				# Run the tests with the optional $TESTFLAGS.
30
+				go test -v -ldflags "$LDFLAGS $LDFLAGS_STATIC" $BUILDFLAGS $TESTFLAGS
31
+			); then
32
+				TESTS_FAILED+=("$test_dir")
33
+				sleep 1 # give it a second, so observers watching can take note
34
+			fi
35
+		done
36
+		
37
+		# if some tests fail, we want the bundlescript to fail, but we want to
38
+		# try running ALL the tests first, hence TESTS_FAILED
39
+		if [ "${#TESTS_FAILED[@]}" -gt 0 ]; then
40
+			echo
41
+			echo "Test failures in: ${TESTS_FAILED[@]}"
42
+			false
43
+		fi
27 44
 	} 2>&1 | tee $DEST/test.log
28 45
 }
29 46