|
@@ -2,7 +2,7 @@
|
|
|
set -e
|
|
|
|
|
|
DEST=$1
|
|
|
-: ${PARALLEL_JOBS:=$(nproc)}
|
|
|
+: ${PARALLEL_JOBS:=$(nproc 2>/dev/null || echo 1)} # if nproc fails (usually because we don't have it), let's not parallelize by default
|
|
|
|
|
|
RED=$'\033[31m'
|
|
|
GREEN=$'\033[32m'
|
|
@@ -38,12 +38,13 @@ bundle_test_unit() {
|
|
|
export BUILDFLAGS_FILE="$HOME/buildflags_file"
|
|
|
( IFS=$'\n'; echo "${BUILDFLAGS[*]}" ) > "$BUILDFLAGS_FILE"
|
|
|
|
|
|
- echo "$TESTDIRS" | parallel --jobs "$PARALLEL_JOBS" --halt 2 --env _ "$(dirname "$BASH_SOURCE")/.go-compile-test-dir"
|
|
|
+ echo "$TESTDIRS" | parallel --jobs "$PARALLEL_JOBS" --env _ "$(dirname "$BASH_SOURCE")/.go-compile-test-dir"
|
|
|
rm -rf "$HOME"
|
|
|
else
|
|
|
# aww, no "parallel" available - fall back to boring
|
|
|
for test_dir in $TESTDIRS; do
|
|
|
- "$(dirname "$BASH_SOURCE")/.go-compile-test-dir" "$test_dir"
|
|
|
+ "$(dirname "$BASH_SOURCE")/.go-compile-test-dir" "$test_dir" || true
|
|
|
+ # don't let one directory that fails to build tank _all_ our tests!
|
|
|
done
|
|
|
fi
|
|
|
)
|
|
@@ -56,7 +57,7 @@ go_run_test_dir() {
|
|
|
while read dir; do
|
|
|
echo
|
|
|
echo '+ go test' $TESTFLAGS "${DOCKER_PKG}${dir#.}"
|
|
|
- precompiled="$DEST/precompiled/$dir.test"
|
|
|
+ precompiled="$DEST/precompiled/$dir.test$(binary_extension)"
|
|
|
if ! ( cd "$dir" && "$precompiled" $TESTFLAGS ); then
|
|
|
TESTS_FAILED+=("$dir")
|
|
|
echo
|
|
@@ -82,5 +83,4 @@ go_run_test_dir() {
|
|
|
fi
|
|
|
}
|
|
|
|
|
|
-exec > >(tee -a $DEST/test.log) 2>&1
|
|
|
-bundle_test_unit
|
|
|
+bundle_test_unit 2>&1 | tee -a $DEST/test.log
|