diff --git a/.gitignore b/.gitignore index 1e730feef..89c7c042f 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ coverage.out files/pidx bin perfstats*.csv +coverage.xml diff --git a/README.md b/README.md index 638d0c6b6..28d6aea33 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,6 @@ syncthing ========= [![Latest Build](http://img.shields.io/jenkins/s/http/build.syncthing.net/syncthing.svg?style=flat-square)](http://build.syncthing.net/job/syncthing/lastSuccessfulBuild/artifact/) -[![Coverage Status](https://img.shields.io/coveralls/syncthing/syncthing.svg?style=flat-square)](https://coveralls.io/r/syncthing/syncthing?branch=master) [![API Documentation](http://img.shields.io/badge/api-Godoc-blue.svg?style=flat-square)](http://godoc.org/github.com/syncthing/syncthing) [![MIT License](http://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)](http://opensource.org/licenses/MIT) diff --git a/auto/auto_test.go b/auto/auto_test.go new file mode 100644 index 000000000..f612e340a --- /dev/null +++ b/auto/auto_test.go @@ -0,0 +1,7 @@ +// Copyright (C) 2014 Jakob Borg and Contributors (see the CONTRIBUTORS file). +// All rights reserved. Use of this source code is governed by an MIT-style +// license that can be found in the LICENSE file. + +package auto_test + +// Empty test file to generate 0% coverage rather than no coverage diff --git a/build.go b/build.go index 9ac32e68d..c71c7a4e1 100644 --- a/build.go +++ b/build.go @@ -149,7 +149,6 @@ func setup() { runPrint("go", "get", "-v", "code.google.com/p/go.tools/cmd/cover") runPrint("go", "get", "-v", "code.google.com/p/go.tools/cmd/vet") runPrint("go", "get", "-v", "code.google.com/p/go.net/html") - runPrint("go", "get", "-v", "github.com/mattn/goveralls") runPrint("go", "get", "-v", "github.com/tools/godep") } diff --git a/build.sh b/build.sh index 0f49069a4..15db91143 100755 --- a/build.sh +++ b/build.sh @@ -66,16 +66,31 @@ case "${1:-default}" in ;; test-cov) + go get github.com/axw/gocov/gocov + go get github.com/AlekSi/gocov-xml + echo "mode: set" > coverage.out fail=0 + # For every package in the repo for dir in $(go list ./...) ; do + # run the tests godep go test -coverprofile=profile.out $dir if [ -f profile.out ] ; then + # and if there was test output, append it to coverage.out grep -v "mode: set" profile.out >> coverage.out rm profile.out fi done + + gocov convert coverage.out | gocov-xml > coverage.xml + + # This is usually run from within Jenkins. If it is, we need to + # tweak the paths in coverage.xml so cobertura finds the + # source. + if [[ "${WORKSPACE:-default}" != "default" ]] ; then + sed "s#$WORKSPACE##g" < coverage.xml > coverage.xml.new && mv coverage.xml.new coverage.xml + fi ;; *) diff --git a/cmd/syncthing/main_test.go b/cmd/syncthing/main_test.go new file mode 100644 index 000000000..17c67b379 --- /dev/null +++ b/cmd/syncthing/main_test.go @@ -0,0 +1,7 @@ +// Copyright (C) 2014 Jakob Borg and Contributors (see the CONTRIBUTORS file). +// All rights reserved. Use of this source code is governed by an MIT-style +// license that can be found in the LICENSE file. + +package main_test + +// Empty test file to generate 0% coverage rather than no coverage diff --git a/discover/discover_test.go b/discover/discover_test.go new file mode 100644 index 000000000..be9da1ca2 --- /dev/null +++ b/discover/discover_test.go @@ -0,0 +1,7 @@ +// Copyright (C) 2014 Jakob Borg and Contributors (see the CONTRIBUTORS file). +// All rights reserved. Use of this source code is governed by an MIT-style +// license that can be found in the LICENSE file. + +package discover_test + +// Empty test file to generate 0% coverage rather than no coverage diff --git a/osutil/osutil_test.go b/osutil/osutil_test.go new file mode 100644 index 000000000..7bc142e43 --- /dev/null +++ b/osutil/osutil_test.go @@ -0,0 +1,7 @@ +// Copyright (C) 2014 Jakob Borg and Contributors (see the CONTRIBUTORS file). +// All rights reserved. Use of this source code is governed by an MIT-style +// license that can be found in the LICENSE file. + +package osutil_test + +// Empty test file to generate 0% coverage rather than no coverage diff --git a/versioner/versioner_test.go b/versioner/versioner_test.go new file mode 100644 index 000000000..8ea9653fb --- /dev/null +++ b/versioner/versioner_test.go @@ -0,0 +1,7 @@ +// Copyright (C) 2014 Jakob Borg and Contributors (see the CONTRIBUTORS file). +// All rights reserved. Use of this source code is governed by an MIT-style +// license that can be found in the LICENSE file. + +package versioner_test + +// Empty test file to generate 0% coverage rather than no coverage