github.com/ncdc/docker@v0.10.1-0.20160129113957-6c6729ef5b74/hack/make/test-unit (about)

     1  #!/bin/bash
     2  set -e
     3  
     4  # Run Docker's test suite, including sub-packages, and store their output as a bundle
     5  # If $TESTFLAGS is set in the environment, it is passed as extra arguments to 'go test'.
     6  # You can use this to select certain tests to run, eg.
     7  #
     8  #   TESTFLAGS='-test.run ^TestBuild$' ./hack/make.sh test-unit
     9  #
    10  bundle_test_unit() {
    11  	date
    12  	if [ -z "$TESTDIRS" ]; then
    13  		TEST_PATH=./...
    14  	else
    15  		TEST_PATH=./${TESTDIRS}
    16  	fi
    17  	pkg_list=$(go list -e \
    18  		-f '{{if ne .Name "github.com/docker/docker"}}
    19  			{{.ImportPath}}
    20  		    {{end}}' \
    21  		"${BUILDFLAGS[@]}" $TEST_PATH \
    22  		| grep github.com/docker/docker \
    23  		| grep -v github.com/docker/docker/vendor \
    24  		| grep -v github.com/docker/docker/integration-cli)
    25  	go test $COVER $GCCGOFLAGS -ldflags "$LDFLAGS" "${BUILDFLAGS[@]}" $TESTFLAGS $pkg_list
    26  }
    27  
    28  
    29  if [[ "$(go version)" == *"gccgo"* ]]; then
    30  	GCCGOFLAGS=-gccgoflags="-lpthread"
    31  else
    32  	COVER=-cover
    33  fi
    34  bundle_test_unit 2>&1 | tee -a "$DEST/test.log"