forked from coreos/mayday
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest
executable file
·51 lines (42 loc) · 1.08 KB
/
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
49
50
51
#!/bin/bash -e
#
# Run all mayday tests (not including functional)
# ./test
# ./test -v
#
# Run tests for one package
# PKG=./unit ./test
# PKG=ssh ./test
#
source ./build
echo "Running tests..."
if [[ $* == *--cover* ]]; then
# generate html cover document
mkdir -p tmp/
go test github.com/coreos/mayday -coverprofile tmp/main.out
go test github.com/coreos/mayday/mayday -coverprofile tmp/mayday.out
go tool cover -html=tmp/mayday.out -o tmp/mayday.html
go tool cover -html=tmp/main.out -o tmp/main.html
for PLUGIN in "command" "docker" "file" "journal" "rkt"
do
go test github.com/coreos/mayday/mayday/plugins/$PLUGIN -coverprofile tmp/$PLUGIN.out
go tool cover -html=tmp/$PLUGIN.out -o tmp/$PLUGIN.html
done
rm -rf tmp/*.out
else
# just report percentage
go test $(glide novendor) -cover
fi
echo "Checking gofmt..."
GOFMT=""
if command -v goimports; then
GOFMT=goimports
else
GOFMT=gofmt
fi
fmtRes=$("$GOFMT" -l $(find * -type f -name '*.go' -not -path "vendor/*"))
if [ -n "${fmtRes}" ]; then
echo -e "gofmt checking failed:\n${fmtRes}"
exit 255
fi
echo "Success"