Skip to content

Commit

Permalink
Merge pull request intelsdi-x#637 from conikeec/master
Browse files Browse the repository at this point in the history
fix deps and test scripts
  • Loading branch information
tiffanyfay committed Dec 16, 2015
2 parents 413a1b8 + efdfdf6 commit 5da30c0
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 10 deletions.
8 changes: 5 additions & 3 deletions scripts/deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -37,5 +41,3 @@ echo "Checking snap mgmt/rest for deps"
cd ../../mgmt/rest
godep restore
cd ../../


24 changes: 17 additions & 7 deletions scripts/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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)"
Expand All @@ -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
Expand All @@ -72,5 +82,5 @@ do
fi
fi
done

go tool cover -func profile.cov

0 comments on commit 5da30c0

Please sign in to comment.