1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Merge pull request #10833 from fabianorosas/10832-fix-test-unit-without-parallel

Fix test-unit run without parallel
This commit is contained in:
Tianon Gravi 2015-02-20 12:12:46 -08:00
commit f2d2862459

View file

@ -27,6 +27,11 @@ bundle_test_unit() {
export TESTFLAGS
export HAVE_GO_TEST_COVER
export DEST
# some hack to export array variables
export BUILDFLAGS_FILE="buildflags_file"
( IFS=$'\n'; echo "${BUILDFLAGS[*]}" ) > "$BUILDFLAGS_FILE"
if command -v parallel &> /dev/null; then
# accomodate parallel to be able to access variables
export SHELL="$BASH"
@ -34,10 +39,6 @@ bundle_test_unit() {
mkdir -p "$HOME/.parallel"
touch "$HOME/.parallel/ignored_vars"
# some hack to export array variables
export BUILDFLAGS_FILE="$HOME/buildflags_file"
( IFS=$'\n'; echo "${BUILDFLAGS[*]}" ) > "$BUILDFLAGS_FILE"
echo "$TESTDIRS" | parallel --jobs "$PARALLEL_JOBS" --env _ "$(dirname "$BASH_SOURCE")/.go-compile-test-dir"
rm -rf "$HOME"
else
@ -47,6 +48,7 @@ bundle_test_unit() {
# don't let one directory that fails to build tank _all_ our tests!
done
fi
rm -f "$BUILDFLAGS_FILE"
)
echo "$TESTDIRS" | go_run_test_dir
}