Skip to content

Commit 73053d9

Browse files
committed
(WIP) Travis: Show new/changed uncovered lines
1 parent 9d386f5 commit 73053d9

2 files changed

Lines changed: 23 additions & 3 deletions

File tree

.travis/coverage_interpolate

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/usr/bin/env python3
2+
3+
import sys
4+
5+
for line in sys.stdin:
6+
try:
7+
filename, no_filename = line.split(':')
8+
start_and_end = no_filename.split(' ')[0]
9+
start, end = start_and_end.split(',')
10+
start_line = int(start.split('.')[0])
11+
end_line = int(end.split('.')[0])
12+
except ValueError:
13+
print(line)
14+
continue
15+
for line_num in range(start_line, end_line+1):
16+
print(filename + ':' + str(line_num) + ': Uncovered')

.travis/script

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# Upstream q is broken, and this also causes dns-prop279 to be broken.
44
#travis_retry go get github.com/tcnksm/ghr github.com/mitchellh/gox gopkg.in/alecthomas/gometalinter.v2 github.com/miekg/exdns/q github.com/namecoin/dns-prop279
5-
travis_retry go get github.com/tcnksm/ghr github.com/mitchellh/gox gopkg.in/alecthomas/gometalinter.v2
5+
travis_retry go get github.com/tcnksm/ghr github.com/mitchellh/gox gopkg.in/alecthomas/gometalinter.v2 github.com/bradleyfalzon/revgrep/...
66

77
go test -v -coverprofile coverage.out ./...
88
RESULT=$?
@@ -12,10 +12,14 @@ if [ "$RESULT" != "0" ]; then
1212
return $RESULT
1313
fi
1414

15-
# TODO: Maybe fail the build if new uncovered lines are added.
1615
echo "Uncovered lines:"
1716
echo ""
18-
grep -v -e " 1$" coverage.out
17+
grep -v -e " 1$" coverage.out | sed "s_github.com/namecoin/ncdns/__"
18+
echo ""
19+
20+
echo "New/changed uncovered lines:"
21+
echo ""
22+
grep -v -e " 1$" coverage.out | sed "s_github.com/namecoin/ncdns/__" | ./.travis/coverage_interpolate | revgrep "${TRAVIS_BRANCH}"
1923
echo ""
2024

2125
# Static analysis

0 commit comments

Comments
 (0)