mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #8999 from yoheiueda/test-unit-without-parallel
Make test-unit runnable without parallel
This commit is contained in:
commit
7b7af6dbae
1 changed files with 20 additions and 18 deletions
|
@ -22,29 +22,31 @@ bundle_test_unit() {
|
||||||
if [ -z "$TESTDIRS" ]; then
|
if [ -z "$TESTDIRS" ]; then
|
||||||
TESTDIRS=$(find_dirs '*_test.go')
|
TESTDIRS=$(find_dirs '*_test.go')
|
||||||
fi
|
fi
|
||||||
|
(
|
||||||
if command -v parallel &> /dev/null; then (
|
|
||||||
# accomodate parallel to be able to access variables
|
|
||||||
export SHELL="$BASH"
|
|
||||||
export HOME="$(mktemp -d)"
|
|
||||||
mkdir -p "$HOME/.parallel"
|
|
||||||
touch "$HOME/.parallel/ignored_vars"
|
|
||||||
export LDFLAGS="$LDFLAGS $LDFLAGS_STATIC_DOCKER"
|
export LDFLAGS="$LDFLAGS $LDFLAGS_STATIC_DOCKER"
|
||||||
export TESTFLAGS
|
export TESTFLAGS
|
||||||
export HAVE_GO_TEST_COVER
|
export HAVE_GO_TEST_COVER
|
||||||
export DEST
|
export DEST
|
||||||
# some hack to export array variables
|
if command -v parallel &> /dev/null; then
|
||||||
export BUILDFLAGS_FILE="$HOME/buildflags_file"
|
# accomodate parallel to be able to access variables
|
||||||
( IFS=$'\n'; echo "${BUILDFLAGS[*]}" ) > "$BUILDFLAGS_FILE"
|
export SHELL="$BASH"
|
||||||
|
export HOME="$(mktemp -d)"
|
||||||
|
mkdir -p "$HOME/.parallel"
|
||||||
|
touch "$HOME/.parallel/ignored_vars"
|
||||||
|
|
||||||
echo "$TESTDIRS" | parallel --jobs "$PARALLEL_JOBS" --halt 2 --env _ "$(dirname "$BASH_SOURCE")/.go-compile-test-dir"
|
# some hack to export array variables
|
||||||
rm -rf "$HOME"
|
export BUILDFLAGS_FILE="$HOME/buildflags_file"
|
||||||
) else
|
( IFS=$'\n'; echo "${BUILDFLAGS[*]}" ) > "$BUILDFLAGS_FILE"
|
||||||
# aww, no "parallel" available - fall back to boring
|
|
||||||
for test_dir in $TESTDIRS; do
|
echo "$TESTDIRS" | parallel --jobs "$PARALLEL_JOBS" --halt 2 --env _ "$(dirname "$BASH_SOURCE")/.go-compile-test-dir"
|
||||||
"$(dirname "$BASH_SOURCE")/.go-compile-test-dir" "$test_dir"
|
rm -rf "$HOME"
|
||||||
done
|
else
|
||||||
fi
|
# aww, no "parallel" available - fall back to boring
|
||||||
|
for test_dir in $TESTDIRS; do
|
||||||
|
"$(dirname "$BASH_SOURCE")/.go-compile-test-dir" "$test_dir"
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
)
|
||||||
echo "$TESTDIRS" | go_run_test_dir
|
echo "$TESTDIRS" | go_run_test_dir
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue