github.com/demonoid81/moby@v0.0.0-20200517203328-62dd8e17c460/hack/test/e2e-run.sh (about) 1 #!/usr/bin/env bash 2 set -e -u -o pipefail 3 4 ARCH=$(uname -m) 5 if [ "$ARCH" = "x86_64" ]; then 6 ARCH="amd64" 7 fi 8 9 export DOCKER_ENGINE_GOARCH=${DOCKER_ENGINE_GOARCH:-${ARCH}} 10 11 # Set defaults 12 : ${TESTFLAGS:=} 13 : ${TESTDEBUG:=} 14 15 integration_api_dirs=${TEST_INTEGRATION_DIR:-"$( 16 find /tests/integration -type d \ 17 | grep -vE '(^/tests/integration($|/internal)|/testdata)' 18 )"} 19 20 run_test_integration() { 21 set_platform_timeout 22 run_test_integration_suites 23 run_test_integration_legacy_suites 24 } 25 26 run_test_integration_suites() { 27 local flags="-test.v -test.timeout=${TIMEOUT:-10m} $TESTFLAGS" 28 for dir in $integration_api_dirs; do 29 if ! ( 30 cd $dir 31 echo "Running $PWD" 32 test_env ./test.main $flags 33 ); then exit 1; fi 34 done 35 } 36 37 run_test_integration_legacy_suites() { 38 ( 39 flags="-test.v -test.timeout=360m $TESTFLAGS" 40 cd /tests/integration-cli 41 echo "Running $PWD" 42 test_env ./test.main $flags 43 ) 44 } 45 46 # use "env -i" to tightly control the environment variables that bleed into the tests 47 test_env() { 48 ( 49 set -e +u 50 [ -n "$TESTDEBUG" ] && set -x 51 env -i \ 52 DOCKER_API_VERSION="$DOCKER_API_VERSION" \ 53 DOCKER_INTEGRATION_DAEMON_DEST="$DOCKER_INTEGRATION_DAEMON_DEST" \ 54 DOCKER_TLS_VERIFY="$DOCKER_TEST_TLS_VERIFY" \ 55 DOCKER_CERT_PATH="$DOCKER_TEST_CERT_PATH" \ 56 DOCKER_ENGINE_GOARCH="$DOCKER_ENGINE_GOARCH" \ 57 DOCKER_GRAPHDRIVER="$DOCKER_GRAPHDRIVER" \ 58 DOCKER_USERLANDPROXY="$DOCKER_USERLANDPROXY" \ 59 DOCKER_HOST="$DOCKER_HOST" \ 60 DOCKER_REMAP_ROOT="$DOCKER_REMAP_ROOT" \ 61 DOCKER_REMOTE_DAEMON="$DOCKER_REMOTE_DAEMON" \ 62 DOCKERFILE="$DOCKERFILE" \ 63 GOPATH="$GOPATH" \ 64 GOTRACEBACK=all \ 65 HOME="$ABS_DEST/fake-HOME" \ 66 PATH="$PATH" \ 67 TEMP="$TEMP" \ 68 TEST_CLIENT_BINARY="$TEST_CLIENT_BINARY" \ 69 "$@" 70 ) 71 } 72 73 set_platform_timeout() { 74 # Test timeout. 75 if [ "${DOCKER_ENGINE_GOARCH}" = "arm64" ] || [ "${DOCKER_ENGINE_GOARCH}" = "arm" ]; then 76 : ${TIMEOUT:=10m} 77 elif [ "${DOCKER_ENGINE_GOARCH}" = "windows" ]; then 78 : ${TIMEOUT:=8m} 79 else 80 : ${TIMEOUT:=5m} 81 fi 82 } 83 84 sh /scripts/ensure-emptyfs.sh 85 run_test_integration