mirror of
https://github.com/octoleo/syncthing.git
synced 2024-11-19 19:45:12 +00:00
build, lib: Correct total test coverage calculation
GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/3483
This commit is contained in:
parent
b3788c8ea0
commit
a4ed50ca85
7
build.sh
7
build.sh
@ -104,7 +104,7 @@ case "${1:-default}" in
|
|||||||
# For every package in the repo
|
# For every package in the repo
|
||||||
for dir in $(go list ./lib/... ./cmd/...) ; do
|
for dir in $(go list ./lib/... ./cmd/...) ; do
|
||||||
# run the tests
|
# run the tests
|
||||||
GOPATH="$(pwd)/Godeps/_workspace:$GOPATH" go test -race -coverprofile=profile.out $dir
|
GOPATH="$(pwd)/Godeps/_workspace:$GOPATH" go test -coverprofile=profile.out $dir
|
||||||
if [ -f profile.out ] ; then
|
if [ -f profile.out ] ; then
|
||||||
# and if there was test output, append it to coverage.out
|
# and if there was test output, append it to coverage.out
|
||||||
grep -v "mode: " profile.out >> coverage.out
|
grep -v "mode: " profile.out >> coverage.out
|
||||||
@ -112,6 +112,11 @@ case "${1:-default}" in
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
notCovered=$(egrep -c '\s0$' coverage.out)
|
||||||
|
total=$(wc -l coverage.out | awk '{print $1}')
|
||||||
|
coverPct=$(awk "BEGIN{print (1 - $notCovered / $total) * 100}")
|
||||||
|
echo "Total coverage is $coverPct%"
|
||||||
|
|
||||||
gocov convert coverage.out | gocov-xml > coverage.xml
|
gocov convert coverage.out | gocov-xml > coverage.xml
|
||||||
|
|
||||||
# This is usually run from within Jenkins. If it is, we need to
|
# This is usually run from within Jenkins. If it is, we need to
|
||||||
|
10
lib/connections/empty_test.go
Normal file
10
lib/connections/empty_test.go
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
// Copyright (C) 2016 The Syncthing Authors.
|
||||||
|
//
|
||||||
|
// This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
// License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||||
|
// You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
|
||||||
|
// The existence of this file means we get 0% test coverage rather than no
|
||||||
|
// test coverage at all. Remove when implementing an actual test.
|
||||||
|
|
||||||
|
package connections
|
10
lib/dialer/empty_test.go
Normal file
10
lib/dialer/empty_test.go
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
// Copyright (C) 2016 The Syncthing Authors.
|
||||||
|
//
|
||||||
|
// This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
// License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||||
|
// You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
|
||||||
|
// The existence of this file means we get 0% test coverage rather than no
|
||||||
|
// test coverage at all. Remove when implementing an actual test.
|
||||||
|
|
||||||
|
package dialer
|
10
lib/pmp/empty_test.go
Normal file
10
lib/pmp/empty_test.go
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
// Copyright (C) 2016 The Syncthing Authors.
|
||||||
|
//
|
||||||
|
// This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
// License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||||
|
// You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
|
||||||
|
// The existence of this file means we get 0% test coverage rather than no
|
||||||
|
// test coverage at all. Remove when implementing an actual test.
|
||||||
|
|
||||||
|
package pmp
|
10
lib/relay/client/empty_test.go
Normal file
10
lib/relay/client/empty_test.go
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
// Copyright (C) 2016 The Syncthing Authors.
|
||||||
|
//
|
||||||
|
// This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
// License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||||
|
// You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
|
||||||
|
// The existence of this file means we get 0% test coverage rather than no
|
||||||
|
// test coverage at all. Remove when implementing an actual test.
|
||||||
|
|
||||||
|
package client
|
10
lib/relay/protocol/empty_test.go
Normal file
10
lib/relay/protocol/empty_test.go
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
// Copyright (C) 2016 The Syncthing Authors.
|
||||||
|
//
|
||||||
|
// This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
// License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||||
|
// You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
|
||||||
|
// The existence of this file means we get 0% test coverage rather than no
|
||||||
|
// test coverage at all. Remove when implementing an actual test.
|
||||||
|
|
||||||
|
package protocol
|
10
lib/stats/empty_test.go
Normal file
10
lib/stats/empty_test.go
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
// Copyright (C) 2016 The Syncthing Authors.
|
||||||
|
//
|
||||||
|
// This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
// License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||||
|
// You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
|
||||||
|
// The existence of this file means we get 0% test coverage rather than no
|
||||||
|
// test coverage at all. Remove when implementing an actual test.
|
||||||
|
|
||||||
|
package stats
|
10
lib/symlinks/empty_test.go
Normal file
10
lib/symlinks/empty_test.go
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
// Copyright (C) 2016 The Syncthing Authors.
|
||||||
|
//
|
||||||
|
// This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
// License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||||
|
// You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
|
||||||
|
// The existence of this file means we get 0% test coverage rather than no
|
||||||
|
// test coverage at all. Remove when implementing an actual test.
|
||||||
|
|
||||||
|
package symlinks
|
10
lib/tlsutil/empty_test.go
Normal file
10
lib/tlsutil/empty_test.go
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
// Copyright (C) 2016 The Syncthing Authors.
|
||||||
|
//
|
||||||
|
// This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
// License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||||
|
// You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
|
||||||
|
// The existence of this file means we get 0% test coverage rather than no
|
||||||
|
// test coverage at all. Remove when implementing an actual test.
|
||||||
|
|
||||||
|
package tlsutil
|
Loading…
Reference in New Issue
Block a user