From 43a24515eeda4e490d1c1f6faf9c07dd3331394e Mon Sep 17 00:00:00 2001 From: Casey Callendrello Date: Thu, 1 Jun 2017 18:43:58 +0200 Subject: [PATCH] build: some minor post-repo-split fixes; add fastbuild --- .travis.yml | 9 +-------- build.sh | 7 ++++++- plugins/meta/portmap/portmap_integ_test.go | 4 ++-- test.sh | 11 +++++++---- 4 files changed, 16 insertions(+), 15 deletions(-) diff --git a/.travis.yml b/.travis.yml index 35dce0a78..be690569a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,17 +19,10 @@ env: matrix: fast_finish: true -install: - - | - go get github.com/containernetworking/cni || true - pushd ../cni - GOARCH="${TARGET}" ./build.sh - popd - script: - | if [ "${TARGET}" == "amd64" ]; then - CNI_PATH="$(cd ../cni/bin && pwd)" GOARCH="${TARGET}" ./test.sh + GOARCH="${TARGET}" ./test.sh else GOARCH="${TARGET}" ./build.sh fi diff --git a/build.sh b/build.sh index b1b82a66c..9e816d2d1 100755 --- a/build.sh +++ b/build.sh @@ -21,6 +21,11 @@ for d in $PLUGINS; do plugin="$(basename "$d")" echo " $plugin" # use go install so we don't duplicate work - go build -o "${PWD}/bin/$plugin" -pkgdir "$GOPATH/pkg" "$@" "$REPO_PATH/$d" + if [ -n "$FASTBUILD" ] + then + GOBIN=${PWD}/bin go install -pkgdir $GOPATH/pkg "$@" $REPO_PATH/$d + else + go build -o "${PWD}/bin/$plugin" -pkgdir "$GOPATH/pkg" "$@" "$REPO_PATH/$d" + fi fi done diff --git a/plugins/meta/portmap/portmap_integ_test.go b/plugins/meta/portmap/portmap_integ_test.go index 69df51c5f..ff1a3ef6a 100644 --- a/plugins/meta/portmap/portmap_integ_test.go +++ b/plugins/meta/portmap/portmap_integ_test.go @@ -186,7 +186,7 @@ func testEchoServer(address string) bool { } defer conn.Close() - conn.SetDeadline(time.Now().Add(2 * time.Second)) + conn.SetDeadline(time.Now().Add(20 * time.Second)) fmt.Fprintln(GinkgoWriter, "connected to", address) message := "Aliquid melius quam pessimum optimum non est." @@ -196,7 +196,7 @@ func testEchoServer(address string) bool { return false } - conn.SetDeadline(time.Now().Add(2 * time.Second)) + conn.SetDeadline(time.Now().Add(20 * time.Second)) fmt.Fprintln(GinkgoWriter, "reading...") response := make([]byte, len(message)) _, err = conn.Read(response) diff --git a/test.sh b/test.sh index 0300f34d7..8a4dad95f 100755 --- a/test.sh +++ b/test.sh @@ -19,9 +19,7 @@ if [ -z "$PKG" ]; then # user has provided PKG override else - # strip out slashes and dots from PKG=./foo/ - TEST=${PKG//\//} - TEST=${TEST//./} + TEST=$PKG # only run gofmt on packages provided by user FMT="$TEST" @@ -40,4 +38,9 @@ if [ -n "${fmtRes}" ]; then exit 255 fi - +echo "Checking govet..." +vetRes=$(go vet $TEST) +if [ -n "${vetRes}" ]; then + echo -e "govet checking failed:\n${vetRes}" + exit 255 +fi