Selaa lähdekoodia

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

Alexey Alexandrov 7 vuotta sitten
vanhempi
commit
f9bd42aa89
1 muutettua tiedostoa jossa 4 lisäystä ja 3 poistoa
  1. 4
    3
      test.sh

+ 4
- 3
test.sh Näytä tiedosto

@@ -1,7 +1,8 @@
1 1
 #!/usr/bin/env bash
2 2
 
3 3
 set -e
4
-echo "" > coverage.txt
4
+MODE=atomic
5
+echo "mode: $MODE" > coverage.txt
5 6
 
6 7
 PKG=$(go list ./... | grep -v /vendor/)
7 8
 
@@ -10,9 +11,9 @@ unused $PKG
10 11
 go test -v $PKG
11 12
 
12 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 15
   if [ -f profile.out ]; then
15
-    cat profile.out >> coverage.txt
16
+    cat profile.out | grep -v "^mode: " >> coverage.txt
16 17
     rm profile.out
17 18
   fi
18 19
 done