Skip to content
This repository was archived by the owner on Sep 18, 2020. It is now read-only.

Commit daf8cc8

Browse files
committed
build: update test script to test properly
1 parent 1029250 commit daf8cc8

File tree

1 file changed

+12
-28
lines changed

1 file changed

+12
-28
lines changed

test

Lines changed: 12 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,42 +2,26 @@
22

33
source ./build
44

5-
SRC="
6-
config
7-
config/validate
8-
datasource
9-
datasource/configdrive
10-
datasource/file
11-
datasource/metadata
12-
datasource/metadata/cloudsigma
13-
datasource/metadata/digitalocean
14-
datasource/metadata/ec2
15-
datasource/proc_cmdline
16-
datasource/test
17-
datasource/url
18-
datasource/vmware
19-
datasource/waagent
20-
initialize
21-
network
22-
pkg
23-
system
24-
.
25-
"
5+
SRC=$(find . -name '*.go' \
6+
-not -path "./vendor/*")
7+
8+
PKG=$(cd gopath/src/${REPO_PATH}; go list ./... | \
9+
grep --invert-match vendor)
2610

2711
echo "Checking gofix..."
2812
go tool fix -diff $SRC
2913

3014
echo "Checking gofmt..."
31-
gofmt -d -e $SRC
32-
33-
# split SRC into an array and prepend REPO_PATH to each local package for go vet
34-
split_vet=(${SRC// / })
35-
VET_TEST="${REPO_PATH} ${split_vet[@]/#/${REPO_PATH}/}"
15+
res=$(gofmt -d -e -s $SRC)
16+
echo "${res}"
17+
if [ -n "${res}" ]; then
18+
exit 1
19+
fi
3620

3721
echo "Checking govet..."
38-
go vet $VET_TEST
22+
go vet $PKG
3923

4024
echo "Running tests..."
41-
go test -timeout 60s -cover $@ ${VET_TEST} --race
25+
go test -timeout 60s -cover $@ ${PKG} --race
4226

4327
echo "Success"

0 commit comments

Comments
 (0)