mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2026-03-01 04:28:51 +00:00
Contract coverage is not compatible with atomic covermode #1369
Labels
No labels
I1
I2
I3
I4
S1
S2
S3
S4
U0
U1
U2
U3
U3
U4
blocked
bug
bug
cli
compiler
config
config
consensus
dependencies
discussion
documentation
enhancement
epic
feature
go
good first issue
help wanted
neotest
network
oracle
performance
question
rpc
security
smartcontract
task
task
task
test
vm
wallet
windows
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
nspcc-dev/neo-go#1369
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @roman-khimov on GitHub (Sep 13, 2024).
Current Behavior
go test -v -race ./path-to-contract -coverprofile=coverage.txt -covermode=atomicfails withExpected Behavior
Same command working fine. In fact, any of
-covermodeor-raceleads to this while a simplego test -v ./path-to-contract -coverprofile=coverage.txtworks fine.Possible Solution
Not yet known.
Your Environment
e1d5ac8557@AnnaShaleva commented on GitHub (Oct 15, 2024):
The original problem is with
covermode=atomiccoverage mode, because-raceoverwrites coverage collection mode toatomicanyway.It works fine because it uses
setcoverage mode by default.So the issue is about proper
atomiccover mode support. Here what I managed to find out: the described error is returned bygo coverwhen it tries to merge the resulting coverage outputs from different tests. The source code that produces this error is:golang/go@cbdb3545ad/src/cmd/go/internal/test/cover.go (L69)In particular,
go covertool can't find the expectedcovermode: atomicline in the start of specific coverage output file which results in this error. The error looks strange to me, because https://github.com/nspcc-dev/neo-go/pull/3616/commits/2dc588ea9578e54e5971c0730ae78313e5a804cf ensures this line is properly written to the output file. And hence, the only thing that might go wrong is the file location itself. I'd suggest to compilego covertool with some custom logs, see what exactly causes this error (either an empty file or the line of the wrong form) and see what exactlygo coverexpects to get.@AnnaShaleva commented on GitHub (Oct 16, 2024):
And BTW, the reason is definitely not in the compiler; it's in the neotest coverage module itself.