wadey / gocovmerge Goto Github PK
View Code? Open in Web Editor NEWMerge coverprofile results from multiple go cover runs
License: BSD 2-Clause "Simplified" License
Merge coverprofile results from multiple go cover runs
License: BSD 2-Clause "Simplified" License
I am trying to understand the case that I am getting this error from. Could you explain when that is?
Since its valid to take profiles from different runs "overlap" sounds like a normal case.
Why can't different modes be merged? I don't see any logic in the code to take any differences into account. When I look at the format in the files between count/atomic, it looks the same.
go version
)?$ go version go version go1.13.9 darwin/amd64
go env
)?go env
Output$ go env GO111MODULE="" GOARCH="amd64" GOBIN="" GOCACHE="$HOME/Library/Caches/go-build" GOENV="$HOME/Library/Application Support/go/env" GOEXE="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="darwin" GONOPROXY="" GONOSUMDB="" GOOS="darwin" GOPATH="$HOME/go" GOPRIVATE="" GOPROXY="https://proxy.golang.org,direct" GOROOT="/usr/local/go" GOSUMDB="sum.golang.org" GOTMPDIR="" GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64" GCCGO="gccgo" AR="ar" CC="clang" CXX="clang++" CGO_ENABLED="1" GOMOD="$HOME/go/project1/go.mod" CGO_CFLAGS="-g -O2" CGO_CPPFLAGS="" CGO_CXXFLAGS="-g -O2" CGO_FFLAGS="-g -O2" CGO_LDFLAGS="-g -O2" PKG_CONFIG="pkg-config" GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/nt/gc7658bs1132ttlcjdmlwwxm0000gn/T/go-build221587211=/tmp/go-build -gno-record-gcc-switches -fno-common"
I am generating respective coverage files for each _test.go
file. However, I am getting an error while executing the gocovmerge
command from last few days. I first encountered it on 25 March, then on 26-27 March, it worked fine. But again from 28-29 March, I am facing the same issue again.
Executed below command to generate merged coverage profile file
gocovmerge ${coverageDir}/myTest-*-coverage.profile
Merged coverage profile file being generated without any error
2021/03/30 01:43:34 failed to parse profiles: line "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" doesn't match expected format: couldn't find a before Count
Kindly assist in nailing down the issue.
When running coverage doing an integration tests (e.g. generating coverage for other packages in my project that get covered when a test runs).
Using go test -coverpkg=pkgA,pkgB,pkgC -coverprofile=profile.cover ./subpackage
I think it's because the same go files are represented in the merged cover profile and the last entry counts, it should be calculating the total aggregate coverage if it processes files of the same name.
I really wanted this to work, but when I run go tool cover -html, I see
not just dark gray, green and red lines, but also light gray lines of
code. It is not obvious whether those lines are covered or not.
I generated the coverage output by doing:
cd $GOPATH/github.com/juju/juju/api
go test -coverprofile /tmp/c.out
cd ../apiserver/client
go test -coverkg github.com/juju/juju/api -coverprofile d.out
gocovmerge /tmp/c.out /tmp/d.out > /tmp/e.out
go tool cover -html /tmp/e.out
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.