зеркало из https://github.com/microsoft/docker.git
hack/make/test-integration-cli: introduce MAKEDIR variable
- every execution of dirname costs time - less repeating Signed-off-by: Jörg Thalheim <joerg@higgsboson.tk>
This commit is contained in:
Родитель
4d53a19528
Коммит
6533cb973f
|
@ -25,6 +25,7 @@ set -o pipefail
|
|||
|
||||
export DOCKER_PKG='github.com/docker/docker'
|
||||
export SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
export MAKEDIR="$SCRIPTDIR/make"
|
||||
|
||||
# We're a nice, sexy, little shell script, and people might try to run us;
|
||||
# but really, they shouldn't. We want to be in a container!
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
set -e
|
||||
|
||||
IAMSTATIC="true"
|
||||
source "$(dirname "$BASH_SOURCE")/.go-autogen"
|
||||
source "${MAKEDIR}/.go-autogen"
|
||||
|
||||
# dockerinit still needs to be a static binary, even if docker is dynamic
|
||||
go build \
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
set -e
|
||||
|
||||
IAMSTATIC="true"
|
||||
source "$(dirname "$BASH_SOURCE")/.go-autogen"
|
||||
source "${MAKEDIR}/.go-autogen"
|
||||
|
||||
# dockerinit still needs to be a static binary, even if docker is dynamic
|
||||
go build --compiler=gccgo \
|
||||
|
|
|
@ -11,7 +11,7 @@ if [[ "$(uname -s)" == CYGWIN* ]]; then
|
|||
DEST=$(cygpath -mw $DEST)
|
||||
fi
|
||||
|
||||
source "$(dirname "$BASH_SOURCE")/.go-autogen"
|
||||
source "${MAKEDIR}/.go-autogen"
|
||||
|
||||
go build \
|
||||
-o "$DEST/$BINARY_FULLNAME" \
|
||||
|
|
|
@ -5,7 +5,7 @@ DEST=$1
|
|||
|
||||
# subshell so that we can export PATH without breaking other things
|
||||
(
|
||||
source "$(dirname "$BASH_SOURCE")/.integration-daemon-start"
|
||||
source "${MAKEDIR}/.integration-daemon-start"
|
||||
|
||||
# we need to wrap up everything in between integration-daemon-start and
|
||||
# integration-daemon-stop to make sure we kill the daemon and don't hang,
|
||||
|
@ -76,7 +76,7 @@ DEST=$1
|
|||
# clean up after ourselves
|
||||
rm -f Dockerfile.build
|
||||
|
||||
source "$(dirname "$BASH_SOURCE")/.integration-daemon-stop"
|
||||
source "${MAKEDIR}/.integration-daemon-stop"
|
||||
|
||||
[ -z "$didFail" ] # "set -e" ftw
|
||||
) 2>&1 | tee -a $DEST/test.log
|
||||
|
|
|
@ -28,6 +28,6 @@ for platform in $DOCKER_CROSSPLATFORMS; do
|
|||
export LDFLAGS_STATIC_DOCKER="" # we just need a simple client for these platforms
|
||||
export BUILDFLAGS=( "${ORIG_BUILDFLAGS[@]/ daemon/}" ) # remove the "daemon" build tag from platforms that aren't supported
|
||||
fi
|
||||
source "$(dirname "$BASH_SOURCE")/binary" "$DEST/$platform"
|
||||
source "${MAKEDIR}/binary" "$DEST/$platform"
|
||||
)
|
||||
done
|
||||
|
|
|
@ -4,7 +4,7 @@ set -e
|
|||
DEST=$1
|
||||
|
||||
if [ -z "$DOCKER_CLIENTONLY" ]; then
|
||||
source "$(dirname "$BASH_SOURCE")/.dockerinit"
|
||||
source "${MAKEDIR}/.dockerinit"
|
||||
|
||||
hash_files "$DEST/dockerinit-$VERSION"
|
||||
else
|
||||
|
@ -18,5 +18,5 @@ fi
|
|||
export LDFLAGS_STATIC_DOCKER=''
|
||||
export BUILDFLAGS=( "${BUILDFLAGS[@]/netgo /}" ) # disable netgo, since we don't need it for a dynamic binary
|
||||
export BUILDFLAGS=( "${BUILDFLAGS[@]/static_build /}" ) # we're not building a "static" binary here
|
||||
source "$(dirname "$BASH_SOURCE")/binary"
|
||||
source "${MAKEDIR}/binary"
|
||||
)
|
||||
|
|
|
@ -4,7 +4,7 @@ set -e
|
|||
DEST=$1
|
||||
|
||||
if [ -z "$DOCKER_CLIENTONLY" ]; then
|
||||
source "$(dirname "$BASH_SOURCE")/.dockerinit-gccgo"
|
||||
source "${MAKEDIR}/.dockerinit-gccgo"
|
||||
|
||||
hash_files "$DEST/dockerinit-$VERSION"
|
||||
else
|
||||
|
@ -19,5 +19,5 @@ fi
|
|||
export LDFLAGS_STATIC_DOCKER=''
|
||||
export BUILDFLAGS=( "${BUILDFLAGS[@]/netgo /}" ) # disable netgo, since we don't need it for a dynamic binary
|
||||
export BUILDFLAGS=( "${BUILDFLAGS[@]/static_build /}" ) # we're not building a "static" binary here
|
||||
source "$(dirname "$BASH_SOURCE")/gccgo"
|
||||
source "${MAKEDIR}/gccgo"
|
||||
)
|
||||
|
|
|
@ -6,7 +6,7 @@ BINARY_NAME="docker-$VERSION"
|
|||
BINARY_EXTENSION="$(binary_extension)"
|
||||
BINARY_FULLNAME="$BINARY_NAME$BINARY_EXTENSION"
|
||||
|
||||
source "$(dirname "$BASH_SOURCE")/.go-autogen"
|
||||
source "${MAKEDIR}/.go-autogen"
|
||||
|
||||
go build -compiler=gccgo \
|
||||
-o "$DEST/$BINARY_FULLNAME" \
|
||||
|
|
|
@ -5,7 +5,7 @@ DEST=$1
|
|||
|
||||
# subshell so that we can export PATH without breaking other things
|
||||
(
|
||||
source "$(dirname "$BASH_SOURCE")/.integration-daemon-start"
|
||||
source "${MAKEDIR}/.integration-daemon-start"
|
||||
|
||||
# we need to wrap up everything in between integration-daemon-start and
|
||||
# integration-daemon-stop to make sure we kill the daemon and don't hang,
|
||||
|
@ -24,7 +24,7 @@ DEST=$1
|
|||
didFail=1
|
||||
fi
|
||||
|
||||
source "$(dirname "$BASH_SOURCE")/.integration-daemon-stop"
|
||||
source "${MAKEDIR}/.integration-daemon-stop"
|
||||
|
||||
[ -z "$didFail" ] # "set -e" ftw
|
||||
) 2>&1 | tee -a $DEST/test.log
|
||||
|
|
|
@ -5,7 +5,7 @@ DEST=$1
|
|||
|
||||
INIT=$DEST/../dynbinary/dockerinit-$VERSION
|
||||
[ -x "$INIT" ] || {
|
||||
source "$(dirname "$BASH_SOURCE")/.dockerinit"
|
||||
source "${MAKEDIR}/.dockerinit"
|
||||
INIT="$DEST/dockerinit"
|
||||
}
|
||||
export TEST_DOCKERINIT_PATH="$INIT"
|
||||
|
|
|
@ -9,23 +9,23 @@ bundle_test_integration_cli() {
|
|||
|
||||
# subshell so that we can export PATH without breaking other things
|
||||
(
|
||||
source "$(dirname "$BASH_SOURCE")/.integration-daemon-start"
|
||||
source "${MAKEDIR}/.integration-daemon-start"
|
||||
|
||||
# we need to wrap up everything in between integration-daemon-start and
|
||||
# integration-daemon-stop to make sure we kill the daemon and don't hang,
|
||||
# even and especially on test failures
|
||||
didFail=
|
||||
if ! {
|
||||
source "$(dirname "$BASH_SOURCE")/.ensure-frozen-images"
|
||||
source "$(dirname "$BASH_SOURCE")/.ensure-httpserver"
|
||||
source "$(dirname "$BASH_SOURCE")/.ensure-emptyfs"
|
||||
source "${MAKEDIR}/.ensure-frozen-images"
|
||||
source "${MAKEDIR}/.ensure-httpserver"
|
||||
source "${MAKEDIR}/.ensure-emptyfs"
|
||||
|
||||
bundle_test_integration_cli
|
||||
}; then
|
||||
didFail=1
|
||||
fi
|
||||
|
||||
source "$(dirname "$BASH_SOURCE")/.integration-daemon-stop"
|
||||
source "${MAKEDIR}/.integration-daemon-stop"
|
||||
|
||||
[ -z "$didFail" ] # "set -e" ftw
|
||||
) 2>&1 | tee -a $DEST/test.log
|
||||
) 2>&1 | tee -a "$DEST/test.log"
|
||||
|
|
|
@ -39,12 +39,12 @@ bundle_test_unit() {
|
|||
mkdir -p "$HOME/.parallel"
|
||||
touch "$HOME/.parallel/ignored_vars"
|
||||
|
||||
echo "$TESTDIRS" | parallel --jobs "$PARALLEL_JOBS" --env _ "$(dirname "$BASH_SOURCE")/.go-compile-test-dir"
|
||||
echo "$TESTDIRS" | parallel --jobs "$PARALLEL_JOBS" --env _ "${MAKEDIR}/.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" || true
|
||||
"${MAKEDIR}/.go-compile-test-dir" "$test_dir" || true
|
||||
# don't let one directory that fails to build tank _all_ our tests!
|
||||
done
|
||||
fi
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/bin/bash
|
||||
|
||||
source "$(dirname "$BASH_SOURCE")/.validate"
|
||||
source "${MAKEDIR}/.validate"
|
||||
|
||||
adds=$(validate_diff --numstat | awk '{ s += $1 } END { print s }')
|
||||
dels=$(validate_diff --numstat | awk '{ s += $2 } END { print s }')
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/bin/bash
|
||||
|
||||
source "$(dirname "$BASH_SOURCE")/.validate"
|
||||
source "${MAKEDIR}/.validate"
|
||||
|
||||
IFS=$'\n'
|
||||
files=( $(validate_diff --diff-filter=ACMR --name-only -- '*.go' | grep -v '^vendor/' || true) )
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/bin/bash
|
||||
|
||||
source "$(dirname "$BASH_SOURCE")/.validate"
|
||||
source "${MAKEDIR}/.validate"
|
||||
|
||||
IFS=$'\n'
|
||||
files=( $(validate_diff --diff-filter=ACMR --name-only -- 'MAINTAINERS' || true) )
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/bin/bash
|
||||
|
||||
source "$(dirname "$BASH_SOURCE")/.validate"
|
||||
source "${MAKEDIR}/.validate"
|
||||
|
||||
IFS=$'\n'
|
||||
files=( $(validate_diff --diff-filter=ACMR --name-only -- '*.go' | grep -v '^vendor/' || true) )
|
||||
|
|
Загрузка…
Ссылка в новой задаче