From efdfdf61adddc0b2dfdcb9f0a4ff0b7580d8273c Mon Sep 17 00:00:00 2001 From: conikeec Date: Tue, 15 Dec 2015 17:43:08 -0800 Subject: [PATCH] fix deps and test scripts --- scripts/deps.sh | 8 +++++--- scripts/test.sh | 24 +++++++++++++++++------- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/scripts/deps.sh b/scripts/deps.sh index a4ccfd33b..800404140 100755 --- a/scripts/deps.sh +++ b/scripts/deps.sh @@ -22,9 +22,13 @@ ctrl_c() { exit $? -} +} trap ctrl_c SIGINT +# Godep +echo "Getting godep if not found" +go get github.com/tools/godep + # First load snap deps echo "Checking snap root for deps" godep restore @@ -37,5 +41,3 @@ echo "Checking snap mgmt/rest for deps" cd ../../mgmt/rest godep restore cd ../../ - - diff --git a/scripts/test.sh b/scripts/test.sh index 15479ddab..2de63b29f 100755 --- a/scripts/test.sh +++ b/scripts/test.sh @@ -26,16 +26,26 @@ # 6. test coverage (http://blog.golang.org/cover) # If the following plugins don't exist, exit -[ -f $SNAP_PATH/plugin/snap-collector-mock1 ] || { echo 'Error: $SNAP_PATH/plugin/snap-collector-mock1 does not exist. Run make to build it.' ; exit 1; } -[ -f $SNAP_PATH/plugin/snap-collector-mock2 ] || { echo 'Error: $SNAP_PATH/plugin/snap-collector-mock2 does not exist. Run make to build it.' ; exit 1; } -[ -f $SNAP_PATH/plugin/snap-processor-passthru ] || { echo 'Error: $SNAP_PATH/plugin/snap-processor-passthru does not exist. Run make to build it.' ; exit 1; } -[ -f $SNAP_PATH/plugin/snap-publisher-file ] || { echo 'Error: $SNAP_PATH/plugin/snap-publisher-file does not exist. Run make to build it.' ; exit 1; } +[ -f $SNAP_PATH/plugin/snap-collector-mock1 ] || { echo 'Error: $SNAP_PATH/plugin/snap-collector-mock1 does not exist. Run make to build it.' ; exit 1; } +[ -f $SNAP_PATH/plugin/snap-collector-mock2 ] || { echo 'Error: $SNAP_PATH/plugin/snap-collector-mock2 does not exist. Run make to build it.' ; exit 1; } +[ -f $SNAP_PATH/plugin/snap-processor-passthru ] || { echo 'Error: $SNAP_PATH/plugin/snap-processor-passthru does not exist. Run make to build it.' ; exit 1; } +[ -f $SNAP_PATH/plugin/snap-publisher-file ] || { echo 'Error: $SNAP_PATH/plugin/snap-publisher-file does not exist. Run make to build it.' ; exit 1; } TEST_DIRS="cmd/ control/ core/ mgmt/ pkg/ snapd.go scheduler/" VET_DIRS="./cmd/... ./control/... ./core/... ./mgmt/... ./pkg/... ./scheduler/... ." set -e +# If the following tools don't exist, get them +echo "Getting GoConvey if not found" +go get github.com/smartystreets/goconvey +echo "Getting goimports if not found" +go get golang.org/x/tools/cmd/goimports +echo "Getting govet if not found" +go get golang.org/x/tools/cmd/vet +echo "Getting cover if not found" +go get golang.org/x/tools/cmd/cover + # Automatic checks echo "gofmt" test -z "$(gofmt -s -l -d $TEST_DIRS | tee /dev/stderr)" @@ -56,10 +66,10 @@ test -z "$(goimports -l -d $TEST_DIRS | tee /dev/stderr)" echo "go vet" go vet $VET_DIRS # go test -race ./... - Lets disable for now - + # Run test coverage on each subdirectories and merge the coverage profile. echo "mode: count" > profile.cov - + # Standard go tooling behavior is to ignore dirs with leading underscors for dir in $(find . -maxdepth 10 -not -path './.git*' -not -path '*/_*' -not -path './examples/*' -not -path './scripts/*' -type d); do @@ -72,5 +82,5 @@ do fi fi done - + go tool cover -func profile.cov