github.com/fcwu/docker@v1.4.2-0.20150115145920-2a69ca89f0df/project/make/.go-compile-test-dir (about)

     1  #!/bin/bash
     2  set -e
     3  
     4  # Compile phase run by parallel in test-unit. No support for coverpkg
     5  
     6  dir=$1
     7  out_file="$DEST/precompiled/$dir.test"
     8  testcover=()
     9  if [ "$HAVE_GO_TEST_COVER" ]; then
    10  	# if our current go install has -cover, we want to use it :)
    11  	mkdir -p "$DEST/coverprofiles"
    12  	coverprofile="docker${dir#.}"
    13  	coverprofile="$DEST/coverprofiles/${coverprofile//\//-}"
    14  	testcover=( -cover -coverprofile "$coverprofile" ) # missing $coverpkg
    15  fi
    16  if [ "$BUILDFLAGS_FILE" ]; then
    17  	readarray -t BUILDFLAGS < "$BUILDFLAGS_FILE"
    18  fi
    19  (
    20  	cd "$dir"
    21  	go test "${testcover[@]}" -ldflags "$LDFLAGS" "${BUILDFLAGS[@]}" $TESTFLAGS -c
    22  )
    23  [ $? -ne 0 ] && return 1
    24  mkdir -p "$(dirname "$out_file")"
    25  mv "$dir/$(basename "$dir").test" "$out_file"
    26  echo "Precompiled: ${DOCKER_PKG}${dir#.}"