github.com/rita33cool1/iot-system-gateway@v0.0.0-20200911033302-e65bde238cc5/docker-engine/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  run_test_integration() {
    20  	[[ "$TESTFLAGS" != *-check.f* ]] && run_test_integration_suites
    21  	run_test_integration_legacy_suites
    22  }
    23  
    24  run_test_integration_suites() {
    25  	local flags="-test.v -test.timeout=${TIMEOUT:-10m} $TESTFLAGS"
    26  	for dir in $integration_api_dirs; do
    27  		if ! (
    28  			cd $dir
    29  			echo "Running $PWD"
    30  			test_env ./test.main $flags
    31  		); then exit 1; fi
    32  	done
    33  }
    34  
    35  run_test_integration_legacy_suites() {
    36  	(
    37  		flags="-check.v -check.timeout=${TIMEOUT:-200m} -test.timeout=360m $TESTFLAGS"
    38  		cd /tests/integration-cli
    39  		echo "Running $PWD"
    40  		test_env ./test.main $flags
    41  	)
    42  }
    43  
    44  # use "env -i" to tightly control the environment variables that bleed into the tests
    45  test_env() {
    46  	(
    47  		set -e +u
    48  		[ -n "$TESTDEBUG" ] && set -x
    49  		env -i \
    50  			DOCKER_API_VERSION="$DOCKER_API_VERSION" \
    51  			DOCKER_INTEGRATION_DAEMON_DEST="$DOCKER_INTEGRATION_DAEMON_DEST" \
    52  			DOCKER_TLS_VERIFY="$DOCKER_TEST_TLS_VERIFY" \
    53  			DOCKER_CERT_PATH="$DOCKER_TEST_CERT_PATH" \
    54  			DOCKER_ENGINE_GOARCH="$DOCKER_ENGINE_GOARCH" \
    55  			DOCKER_GRAPHDRIVER="$DOCKER_GRAPHDRIVER" \
    56  			DOCKER_USERLANDPROXY="$DOCKER_USERLANDPROXY" \
    57  			DOCKER_HOST="$DOCKER_HOST" \
    58  			DOCKER_REMAP_ROOT="$DOCKER_REMAP_ROOT" \
    59  			DOCKER_REMOTE_DAEMON="$DOCKER_REMOTE_DAEMON" \
    60  			DOCKERFILE="$DOCKERFILE" \
    61  			GOPATH="$GOPATH" \
    62  			GOTRACEBACK=all \
    63  			HOME="$ABS_DEST/fake-HOME" \
    64  			PATH="$PATH" \
    65  			TEMP="$TEMP" \
    66  			TEST_CLIENT_BINARY="$TEST_CLIENT_BINARY" \
    67  			"$@"
    68  	)
    69  }
    70  
    71  sh /scripts/ensure-emptyfs.sh
    72  run_test_integration