Skip to content

Commit

Permalink
(WIP) Travis: Show new/changed uncovered lines
Browse files Browse the repository at this point in the history
  • Loading branch information
JeremyRand committed Aug 27, 2019
1 parent 9d386f5 commit 73053d9
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
16 changes: 16 additions & 0 deletions .travis/coverage_interpolate
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env python3

import sys

for line in sys.stdin:
try:
filename, no_filename = line.split(':')
start_and_end = no_filename.split(' ')[0]
start, end = start_and_end.split(',')
start_line = int(start.split('.')[0])
end_line = int(end.split('.')[0])
except ValueError:
print(line)
continue
for line_num in range(start_line, end_line+1):
print(filename + ':' + str(line_num) + ': Uncovered')
10 changes: 7 additions & 3 deletions .travis/script
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Upstream q is broken, and this also causes dns-prop279 to be broken.
#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
travis_retry go get github.com/tcnksm/ghr github.com/mitchellh/gox gopkg.in/alecthomas/gometalinter.v2
travis_retry go get github.com/tcnksm/ghr github.com/mitchellh/gox gopkg.in/alecthomas/gometalinter.v2 github.com/bradleyfalzon/revgrep/...

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

# TODO: Maybe fail the build if new uncovered lines are added.
echo "Uncovered lines:"
echo ""
grep -v -e " 1$" coverage.out
grep -v -e " 1$" coverage.out | sed "s_github.com/namecoin/ncdns/__"
echo ""

echo "New/changed uncovered lines:"
echo ""
grep -v -e " 1$" coverage.out | sed "s_github.com/namecoin/ncdns/__" | ./.travis/coverage_interpolate | revgrep "${TRAVIS_BRANCH}"
echo ""

# Static analysis
Expand Down

0 comments on commit 73053d9

Please sign in to comment.