Merge pull request #12500 from tianon/fix-daemon-logic

Fix daemon start/stop logic in hack/make/* scripts
This commit is contained in:
Alexander Morozov 2015-04-23 11:20:33 -07:00
commit dcbf89d023
5 changed files with 65 additions and 94 deletions

View File

@ -25,6 +25,7 @@ if [ -z "$DOCKER_TEST_HOST" ]; then
--pidfile "$DEST/docker.pid" \
&> "$DEST/docker.log"
) &
trap "source '${MAKEDIR}/.integration-daemon-stop'" EXIT # make sure that if the script exits unexpectedly, we stop this daemon we just started
else
export DOCKER_HOST="$DOCKER_TEST_HOST"
fi

View File

@ -1,5 +1,7 @@
#!/bin/bash
trap - EXIT # reset EXIT trap applied in .integration-daemon-start
for pidFile in $(find "$DEST" -name docker.pid); do
pid=$(set -x; cat "$pidFile")
( set -x; kill "$pid" )

View File

@ -7,13 +7,6 @@ DEST=$1
(
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 ! {
set -e
# TODO consider using frozen images for the dockercore/builder-deb tags
debVersion="${VERSION//-/'~'}"
@ -69,14 +62,9 @@ DEST=$1
docker run --rm "$tempImage" bash -c 'cd .. && tar -c *_*' | tar -xvC "$DEST/$version"
docker rmi "$tempImage"
done
}; then
didFail=1
fi
# clean up after ourselves
rm -f Dockerfile.build
source "${MAKEDIR}/.integration-daemon-stop"
[ -z "$didFail" ] # "set -e" ftw
) 2>&1 | tee -a $DEST/test.log
) 2>&1 | tee -a "$DEST/test.log"

View File

@ -7,11 +7,6 @@ DEST=$1
(
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 ! {
dockerPy='/docker-py'
[ -d "$dockerPy" ] || {
dockerPy="$DEST/docker-py"
@ -20,11 +15,6 @@ DEST=$1
# exporting PYTHONPATH to import "docker" from our local docker-py
test_env PYTHONPATH="$dockerPy" python "$dockerPy/tests/integration_test.py"
}; then
didFail=1
fi
source "${MAKEDIR}/.integration-daemon-stop"
[ -z "$didFail" ] # "set -e" ftw
) 2>&1 | tee -a $DEST/test.log
) 2>&1 | tee -a "$DEST/test.log"

View File

@ -11,21 +11,11 @@ bundle_test_integration_cli() {
(
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 "${MAKEDIR}/.ensure-frozen-images"
source "${MAKEDIR}/.ensure-httpserver"
source "${MAKEDIR}/.ensure-emptyfs"
bundle_test_integration_cli
}; then
didFail=1
fi
source "${MAKEDIR}/.integration-daemon-stop"
[ -z "$didFail" ] # "set -e" ftw
) 2>&1 | tee -a "$DEST/test.log"