-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathtest
executable file
·48 lines (35 loc) · 930 Bytes
/
test
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/env bash
set -eu
NAME="init"
ORG_PATH="github.com/coreos"
REPO_PATH="${ORG_PATH}/${NAME}"
if [ ! -h gopath/src/${REPO_PATH} ]; then
mkdir -p gopath/src/${ORG_PATH}
ln -s ../../../.. gopath/src/${REPO_PATH} || exit 255
fi
eval $(go env)
export GOBIN=${PWD}/bin
export GOPATH=${PWD}/gopath
SRC=$(find . -name '*.go')
PKG=$(cd gopath/src/${REPO_PATH}; go list ./...)
PKG_VET=$(cd gopath/src/${REPO_PATH}; go list ./...)
echo "Checking gofix..."
go tool fix -diff $SRC
echo "Checking gofmt..."
res=$(gofmt -d -e -s $SRC)
echo "${res}"
if [ -n "${res}" ]; then
exit 1
fi
echo "Checking govet..."
go vet $PKG_VET
if [ "${ACTION:-TEST}" != "COMPILE" ]; then
echo "Running tests..."
go test -timeout 9999s -cover $@ ${PKG} --race --test.v --parallel 5 --coreos-install=${GOBIN}/flatcar-install
else
echo "Compiling tests..."
for p in ${PKG}; do
go test -c $p
done
fi
echo "Success"