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:
Jörg Thalheim 2015-04-14 18:43:33 +02:00
parent 4d53a19528
commit 6533cb973f
17 changed files with 27 additions and 26 deletions

View File

@ -25,6 +25,7 @@ set -o pipefail
export DOCKER_PKG='github.com/docker/docker' export DOCKER_PKG='github.com/docker/docker'
export SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" 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; # 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! # but really, they shouldn't. We want to be in a container!

View File

@ -2,7 +2,7 @@
set -e set -e
IAMSTATIC="true" 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 # dockerinit still needs to be a static binary, even if docker is dynamic
go build \ go build \

View File

@ -2,7 +2,7 @@
set -e set -e
IAMSTATIC="true" 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 # dockerinit still needs to be a static binary, even if docker is dynamic
go build --compiler=gccgo \ go build --compiler=gccgo \

View File

@ -11,7 +11,7 @@ if [[ "$(uname -s)" == CYGWIN* ]]; then
DEST=$(cygpath -mw $DEST) DEST=$(cygpath -mw $DEST)
fi fi
source "$(dirname "$BASH_SOURCE")/.go-autogen" source "${MAKEDIR}/.go-autogen"
go build \ go build \
-o "$DEST/$BINARY_FULLNAME" \ -o "$DEST/$BINARY_FULLNAME" \

View File

@ -5,7 +5,7 @@ DEST=$1
# subshell so that we can export PATH without breaking other things # 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 # 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, # integration-daemon-stop to make sure we kill the daemon and don't hang,
@ -76,7 +76,7 @@ DEST=$1
# clean up after ourselves # clean up after ourselves
rm -f Dockerfile.build rm -f Dockerfile.build
source "$(dirname "$BASH_SOURCE")/.integration-daemon-stop" source "${MAKEDIR}/.integration-daemon-stop"
[ -z "$didFail" ] # "set -e" ftw [ -z "$didFail" ] # "set -e" ftw
) 2>&1 | tee -a $DEST/test.log ) 2>&1 | tee -a $DEST/test.log

View File

@ -28,6 +28,6 @@ for platform in $DOCKER_CROSSPLATFORMS; do
export LDFLAGS_STATIC_DOCKER="" # we just need a simple client for these platforms 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 export BUILDFLAGS=( "${ORIG_BUILDFLAGS[@]/ daemon/}" ) # remove the "daemon" build tag from platforms that aren't supported
fi fi
source "$(dirname "$BASH_SOURCE")/binary" "$DEST/$platform" source "${MAKEDIR}/binary" "$DEST/$platform"
) )
done done

View File

@ -4,7 +4,7 @@ set -e
DEST=$1 DEST=$1
if [ -z "$DOCKER_CLIENTONLY" ]; then if [ -z "$DOCKER_CLIENTONLY" ]; then
source "$(dirname "$BASH_SOURCE")/.dockerinit" source "${MAKEDIR}/.dockerinit"
hash_files "$DEST/dockerinit-$VERSION" hash_files "$DEST/dockerinit-$VERSION"
else else
@ -18,5 +18,5 @@ fi
export LDFLAGS_STATIC_DOCKER='' export LDFLAGS_STATIC_DOCKER=''
export BUILDFLAGS=( "${BUILDFLAGS[@]/netgo /}" ) # disable netgo, since we don't need it for a dynamic binary 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 export BUILDFLAGS=( "${BUILDFLAGS[@]/static_build /}" ) # we're not building a "static" binary here
source "$(dirname "$BASH_SOURCE")/binary" source "${MAKEDIR}/binary"
) )

View File

@ -4,7 +4,7 @@ set -e
DEST=$1 DEST=$1
if [ -z "$DOCKER_CLIENTONLY" ]; then if [ -z "$DOCKER_CLIENTONLY" ]; then
source "$(dirname "$BASH_SOURCE")/.dockerinit-gccgo" source "${MAKEDIR}/.dockerinit-gccgo"
hash_files "$DEST/dockerinit-$VERSION" hash_files "$DEST/dockerinit-$VERSION"
else else
@ -19,5 +19,5 @@ fi
export LDFLAGS_STATIC_DOCKER='' export LDFLAGS_STATIC_DOCKER=''
export BUILDFLAGS=( "${BUILDFLAGS[@]/netgo /}" ) # disable netgo, since we don't need it for a dynamic binary 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 export BUILDFLAGS=( "${BUILDFLAGS[@]/static_build /}" ) # we're not building a "static" binary here
source "$(dirname "$BASH_SOURCE")/gccgo" source "${MAKEDIR}/gccgo"
) )

View File

@ -6,7 +6,7 @@ BINARY_NAME="docker-$VERSION"
BINARY_EXTENSION="$(binary_extension)" BINARY_EXTENSION="$(binary_extension)"
BINARY_FULLNAME="$BINARY_NAME$BINARY_EXTENSION" BINARY_FULLNAME="$BINARY_NAME$BINARY_EXTENSION"
source "$(dirname "$BASH_SOURCE")/.go-autogen" source "${MAKEDIR}/.go-autogen"
go build -compiler=gccgo \ go build -compiler=gccgo \
-o "$DEST/$BINARY_FULLNAME" \ -o "$DEST/$BINARY_FULLNAME" \

View File

@ -5,7 +5,7 @@ DEST=$1
# subshell so that we can export PATH without breaking other things # 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 # 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, # integration-daemon-stop to make sure we kill the daemon and don't hang,
@ -24,7 +24,7 @@ DEST=$1
didFail=1 didFail=1
fi fi
source "$(dirname "$BASH_SOURCE")/.integration-daemon-stop" source "${MAKEDIR}/.integration-daemon-stop"
[ -z "$didFail" ] # "set -e" ftw [ -z "$didFail" ] # "set -e" ftw
) 2>&1 | tee -a $DEST/test.log ) 2>&1 | tee -a $DEST/test.log

View File

@ -5,7 +5,7 @@ DEST=$1
INIT=$DEST/../dynbinary/dockerinit-$VERSION INIT=$DEST/../dynbinary/dockerinit-$VERSION
[ -x "$INIT" ] || { [ -x "$INIT" ] || {
source "$(dirname "$BASH_SOURCE")/.dockerinit" source "${MAKEDIR}/.dockerinit"
INIT="$DEST/dockerinit" INIT="$DEST/dockerinit"
} }
export TEST_DOCKERINIT_PATH="$INIT" export TEST_DOCKERINIT_PATH="$INIT"

View File

@ -9,23 +9,23 @@ bundle_test_integration_cli() {
# subshell so that we can export PATH without breaking other things # 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 # 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, # integration-daemon-stop to make sure we kill the daemon and don't hang,
# even and especially on test failures # even and especially on test failures
didFail= didFail=
if ! { if ! {
source "$(dirname "$BASH_SOURCE")/.ensure-frozen-images" source "${MAKEDIR}/.ensure-frozen-images"
source "$(dirname "$BASH_SOURCE")/.ensure-httpserver" source "${MAKEDIR}/.ensure-httpserver"
source "$(dirname "$BASH_SOURCE")/.ensure-emptyfs" source "${MAKEDIR}/.ensure-emptyfs"
bundle_test_integration_cli bundle_test_integration_cli
}; then }; then
didFail=1 didFail=1
fi fi
source "$(dirname "$BASH_SOURCE")/.integration-daemon-stop" source "${MAKEDIR}/.integration-daemon-stop"
[ -z "$didFail" ] # "set -e" ftw [ -z "$didFail" ] # "set -e" ftw
) 2>&1 | tee -a $DEST/test.log ) 2>&1 | tee -a "$DEST/test.log"

View File

@ -39,12 +39,12 @@ bundle_test_unit() {
mkdir -p "$HOME/.parallel" mkdir -p "$HOME/.parallel"
touch "$HOME/.parallel/ignored_vars" 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" rm -rf "$HOME"
else else
# aww, no "parallel" available - fall back to boring # aww, no "parallel" available - fall back to boring
for test_dir in $TESTDIRS; do 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! # don't let one directory that fails to build tank _all_ our tests!
done done
fi fi

View File

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
source "$(dirname "$BASH_SOURCE")/.validate" source "${MAKEDIR}/.validate"
adds=$(validate_diff --numstat | awk '{ s += $1 } END { print s }') adds=$(validate_diff --numstat | awk '{ s += $1 } END { print s }')
dels=$(validate_diff --numstat | awk '{ s += $2 } END { print s }') dels=$(validate_diff --numstat | awk '{ s += $2 } END { print s }')

View File

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
source "$(dirname "$BASH_SOURCE")/.validate" source "${MAKEDIR}/.validate"
IFS=$'\n' IFS=$'\n'
files=( $(validate_diff --diff-filter=ACMR --name-only -- '*.go' | grep -v '^vendor/' || true) ) files=( $(validate_diff --diff-filter=ACMR --name-only -- '*.go' | grep -v '^vendor/' || true) )

View File

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
source "$(dirname "$BASH_SOURCE")/.validate" source "${MAKEDIR}/.validate"
IFS=$'\n' IFS=$'\n'
files=( $(validate_diff --diff-filter=ACMR --name-only -- 'MAINTAINERS' || true) ) files=( $(validate_diff --diff-filter=ACMR --name-only -- 'MAINTAINERS' || true) )

View File

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
source "$(dirname "$BASH_SOURCE")/.validate" source "${MAKEDIR}/.validate"
IFS=$'\n' IFS=$'\n'
files=( $(validate_diff --diff-filter=ACMR --name-only -- '*.go' | grep -v '^vendor/' || true) ) files=( $(validate_diff --diff-filter=ACMR --name-only -- '*.go' | grep -v '^vendor/' || true) )