Remove cover tool, this lives in tools.git now.
This commit is contained in:
1 parent
5208dcd67e
commit
f3360e61e1
3 files changed
+5
-104
No files matched your search
@@ -16,10 +16,9 @@ WEAVEWAIT_EXE=prog/weavewait/weavewait
|
|||||||
WEAVEHOSTS_EXE=prog/weavehosts/weavehosts
|
WEAVEHOSTS_EXE=prog/weavehosts/weavehosts
|
||||||
NETCHECK_EXE=prog/netcheck/netcheck
|
NETCHECK_EXE=prog/netcheck/netcheck
|
||||||
DOCKERTLSARGS_EXE=prog/docker_tls_args/docker_tls_args
|
DOCKERTLSARGS_EXE=prog/docker_tls_args/docker_tls_args
|
||||||
COVER_EXE=testing/cover/cover
|
|
||||||
RUNNER_EXE=testing/runner/runner
|
RUNNER_EXE=testing/runner/runner
|
||||||
|
|
||||||
EXES=$(WEAVER_EXE) $(SIGPROXY_EXE) $(WEAVEPROXY_EXE) $(WEAVEWAIT_EXE) $(WEAVEHOSTS_EXE) $(NETCHECK_EXE) $(DOCKERTLSARGS_EXE) $(COVER_EXE) $(RUNNER_EXE)
|
EXES=$(WEAVER_EXE) $(SIGPROXY_EXE) $(WEAVEPROXY_EXE) $(WEAVEWAIT_EXE) $(WEAVEHOSTS_EXE) $(NETCHECK_EXE) $(DOCKERTLSARGS_EXE) $(RUNNER_EXE)
|
||||||
|
|
||||||
WEAVER_UPTODATE=.weaver.uptodate
|
WEAVER_UPTODATE=.weaver.uptodate
|
||||||
WEAVEEXEC_UPTODATE=.weaveexec.uptodate
|
WEAVEEXEC_UPTODATE=.weaveexec.uptodate
|
||||||
@@ -46,7 +45,7 @@ NETGO_CHECK=@strings $@ | grep cgo_stub\\\.go >/dev/null || { \
|
|||||||
}
|
}
|
||||||
BUILD_FLAGS=-ldflags "-extldflags \"-static\" -X main.version $(WEAVE_VERSION)" -tags netgo
|
BUILD_FLAGS=-ldflags "-extldflags \"-static\" -X main.version $(WEAVE_VERSION)" -tags netgo
|
||||||
|
|
||||||
all: $(WEAVE_EXPORT) $(COVER_EXE) $(RUNNER_EXE)
|
all: $(WEAVE_EXPORT) $(RUNNER_EXE)
|
||||||
|
|
||||||
travis: $(EXES)
|
travis: $(EXES)
|
||||||
|
|
||||||
@@ -78,11 +77,10 @@ $(NETCHECK_EXE): prog/netcheck/netcheck.go
|
|||||||
$(SIGPROXY_EXE): prog/sigproxy/main.go
|
$(SIGPROXY_EXE): prog/sigproxy/main.go
|
||||||
$(WEAVEWAIT_EXE): prog/weavewait/main.go net/*.go
|
$(WEAVEWAIT_EXE): prog/weavewait/main.go net/*.go
|
||||||
$(WEAVEHOSTS_EXE): prog/weavehosts/weavehosts.go
|
$(WEAVEHOSTS_EXE): prog/weavehosts/weavehosts.go
|
||||||
$(COVER_EXE): testing/cover/cover.go
|
|
||||||
$(RUNNER_EXE): testing/runner/runner.go
|
$(RUNNER_EXE): testing/runner/runner.go
|
||||||
$(DOCKERTLSARGS_EXE): prog/docker_tls_args/*.go
|
$(DOCKERTLSARGS_EXE): prog/docker_tls_args/*.go
|
||||||
|
|
||||||
$(WEAVEWAIT_EXE) $(SIGPROXY_EXE) $(WEAVEHOSTS_EXE) $(COVER_EXE) $(RUNNER_EXE) $(DOCKERTLSARGS_EXE):
|
$(WEAVEWAIT_EXE) $(SIGPROXY_EXE) $(WEAVEHOSTS_EXE) $(RUNNER_EXE) $(DOCKERTLSARGS_EXE):
|
||||||
go get -tags netgo ./$(@D)
|
go get -tags netgo ./$(@D)
|
||||||
go build $(BUILD_FLAGS) -o $@ ./$(@D)
|
go build $(BUILD_FLAGS) -o $@ ./$(@D)
|
||||||
|
|
||||||
@@ -108,7 +106,7 @@ $(WEAVE_EXPORT): $(IMAGES_UPTODATE)
|
|||||||
$(DOCKER_DISTRIB):
|
$(DOCKER_DISTRIB):
|
||||||
curl -o $(DOCKER_DISTRIB) $(DOCKER_DISTRIB_URL)
|
curl -o $(DOCKER_DISTRIB) $(DOCKER_DISTRIB_URL)
|
||||||
|
|
||||||
tests: $(COVER_EXE) tools/.git
|
tests: tools/.git
|
||||||
tools/test
|
tools/test
|
||||||
|
|
||||||
lint: tools/.git
|
lint: tools/.git
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ if [ -n "$CIRCLECI" ]; then
|
|||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
$DIR/../testing/cover/cover
|
go get github.com/weaveworks/build-tools/cover
|
||||||
cover ./coverage/* >profile.cov
|
cover ./coverage/* >profile.cov
|
||||||
go tool cover -html=profile.cov -o coverage.html
|
go tool cover -html=profile.cov -o coverage.html
|
||||||
go tool cover -func=profile.cov -o coverage.txt
|
go tool cover -func=profile.cov -o coverage.txt
|
||||||
|
|||||||
@@ -1,97 +0,0 @@
|
|||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
"sort"
|
|
||||||
|
|
||||||
"golang.org/x/tools/cover"
|
|
||||||
)
|
|
||||||
|
|
||||||
func merge(p1, p2 *cover.Profile) *cover.Profile {
|
|
||||||
output := cover.Profile{
|
|
||||||
FileName: p1.FileName,
|
|
||||||
Mode: p1.Mode,
|
|
||||||
}
|
|
||||||
|
|
||||||
i, j := 0, 0
|
|
||||||
for i < len(p1.Blocks) && j < len(p2.Blocks) {
|
|
||||||
bi, bj := p1.Blocks[i], p2.Blocks[j]
|
|
||||||
if bi.StartLine == bj.StartLine && bi.StartCol == bj.StartCol {
|
|
||||||
|
|
||||||
if bi.EndLine != bj.EndLine ||
|
|
||||||
bi.EndCol != bj.EndCol ||
|
|
||||||
bi.NumStmt != bj.NumStmt {
|
|
||||||
panic("Not run on same source!")
|
|
||||||
}
|
|
||||||
|
|
||||||
output.Blocks = append(output.Blocks, cover.ProfileBlock{
|
|
||||||
StartLine: bi.StartLine,
|
|
||||||
StartCol: bi.StartCol,
|
|
||||||
EndLine: bi.EndLine,
|
|
||||||
EndCol: bi.EndCol,
|
|
||||||
NumStmt: bi.NumStmt,
|
|
||||||
Count: bi.Count + bj.Count,
|
|
||||||
})
|
|
||||||
i++
|
|
||||||
j++
|
|
||||||
} else if bi.StartLine < bj.StartLine || bi.StartLine == bj.StartLine && bi.StartCol < bj.StartCol {
|
|
||||||
output.Blocks = append(output.Blocks, bi)
|
|
||||||
i++
|
|
||||||
} else {
|
|
||||||
output.Blocks = append(output.Blocks, bj)
|
|
||||||
j++
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for ; i < len(p1.Blocks); i++ {
|
|
||||||
output.Blocks = append(output.Blocks, p1.Blocks[i])
|
|
||||||
}
|
|
||||||
|
|
||||||
for ; j < len(p2.Blocks); j++ {
|
|
||||||
output.Blocks = append(output.Blocks, p2.Blocks[j])
|
|
||||||
}
|
|
||||||
|
|
||||||
return &output
|
|
||||||
}
|
|
||||||
|
|
||||||
func print(profiles []*cover.Profile) {
|
|
||||||
fmt.Println("mode: atomic")
|
|
||||||
for _, profile := range profiles {
|
|
||||||
for _, block := range profile.Blocks {
|
|
||||||
fmt.Printf("%s:%d.%d,%d.%d %d %d\n", profile.FileName, block.StartLine, block.StartCol,
|
|
||||||
block.EndLine, block.EndCol, block.NumStmt, block.Count)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Copied from https://github.com/golang/tools/blob/master/cover/profile.go
|
|
||||||
type byFileName []*cover.Profile
|
|
||||||
|
|
||||||
func (p byFileName) Len() int { return len(p) }
|
|
||||||
func (p byFileName) Less(i, j int) bool { return p[i].FileName < p[j].FileName }
|
|
||||||
func (p byFileName) Swap(i, j int) { p[i], p[j] = p[j], p[i] }
|
|
||||||
|
|
||||||
func main() {
|
|
||||||
outputProfiles := map[string]*cover.Profile{}
|
|
||||||
for _, input := range os.Args[1:] {
|
|
||||||
inputProfiles, err := cover.ParseProfiles(input)
|
|
||||||
if err != nil {
|
|
||||||
panic(fmt.Sprintf("Error parsing %s: %v", input, err))
|
|
||||||
}
|
|
||||||
for _, ip := range inputProfiles {
|
|
||||||
op := outputProfiles[ip.FileName]
|
|
||||||
if op == nil {
|
|
||||||
outputProfiles[ip.FileName] = ip
|
|
||||||
} else {
|
|
||||||
outputProfiles[ip.FileName] = merge(op, ip)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
profiles := make([]*cover.Profile, 0, len(outputProfiles))
|
|
||||||
for _, profile := range outputProfiles {
|
|
||||||
profiles = append(profiles, profile)
|
|
||||||
}
|
|
||||||
sort.Sort(byFileName(profiles))
|
|
||||||
print(profiles)
|
|
||||||
}
|
|
||||||
Reference in new issue
Block a user