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