forked from projectcalico/libcalico-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run-uts
executable file
·53 lines (45 loc) · 1.14 KB
/
run-uts
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
52
53
#!/bin/bash
set -e
if [ -z $SKIP ]
then
SKIP="vendor"
else
SKIP="vendor,$SKIP"
fi
echo "Removing old coverprofiles..."
find . -name "*.coverprofile" -type f -delete
if [ -z $WHAT ]
then
echo "Calculating packages to cover..."
go_dirs=$(find . -type f -name '*.go' | \
grep -vE '/vendor/|.glide|.git' | \
xargs -n 1 dirname | \
sort | uniq | \
tr '\n' ',' | \
sed 's/,$//' )
else
go_dirs=$WHAT
fi
echo "Covering: $go_dirs"
test ! -z "$go_dirs"
# Run tests in random order find tests recursively (-r).
echo WHAT: $WHAT
echo SKIP: $SKIP
ginkgo -cover -coverpkg=${go_dirs} -r --skipPackage $SKIP $WHAT
gocovmerge $(find . -name '*.coverprofile') > combined.coverprofile
echo
echo '+==============+'
echo '| All coverage |'
echo '+==============+'
echo
go tool cover -func combined.coverprofile | \
sed 's=github.com/projectcalico/libcalico-go/==' | \
column -t
echo
echo '+==================+'
echo '| Missing coverage |'
echo '+==================+'
echo
go tool cover -func combined.coverprofile | \
sed 's=github.com/projectcalico/libcalico-go/==' | grep -v '100.0%' | \
column -t