Browse Source

Fix test.sh to produce merged report that "go tool cover" understands. (#236)

Alexey Alexandrov 7 years ago
parent
commit
f9bd42aa89
1 changed files with 4 additions and 3 deletions
  1. 4
    3
      test.sh

+ 4
- 3
test.sh View File

1
 #!/usr/bin/env bash
1
 #!/usr/bin/env bash
2
 
2
 
3
 set -e
3
 set -e
4
-echo "" > coverage.txt
4
+MODE=atomic
5
+echo "mode: $MODE" > coverage.txt
5
 
6
 
6
 PKG=$(go list ./... | grep -v /vendor/)
7
 PKG=$(go list ./... | grep -v /vendor/)
7
 
8
 
10
 go test -v $PKG
11
 go test -v $PKG
11
 
12
 
12
 for d in $PKG; do
13
 for d in $PKG; do
13
-  go test -race -coverprofile=profile.out -covermode=atomic $d
14
+  go test -race -coverprofile=profile.out -covermode=$MODE $d
14
   if [ -f profile.out ]; then
15
   if [ -f profile.out ]; then
15
-    cat profile.out >> coverage.txt
16
+    cat profile.out | grep -v "^mode: " >> coverage.txt
16
     rm profile.out
17
     rm profile.out
17
   fi
18
   fi
18
 done
19
 done