Skip to content

Commit 5edbb90

Browse files
avagingvisor-bot
authored andcommitted
runsc: skip coverage instrumentation on norace packages
These cannot be instrumented with regular atomic operations (e.g., sync/atomic.AddInt32), which will happen if -race is enabled. We may be able to re-enable coverage on them when https://golang.org/issue/43007 is resolved. PiperOrigin-RevId: 829085289
1 parent 62a1ac7 commit 5edbb90

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

tools/build_cover.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,5 +59,9 @@ else
5959
# mount namespace.
6060
export CGO_ENABLED=0
6161
fi
62-
gopkgs=$("$go_tool" list ./... | grep -v pkg/sentry/platform | grep -v pkg/ring0 | grep -v pkg/coverage | paste -sd,)
63-
"$go_tool" build --tags "$go_tags" $go_opts -cover -coverpkg="$gopkg" -covermode=atomic -o "$dst" runsc/main.go
62+
# sleep, sync, syncevent use go:norace, which is not respected by coverage
63+
# instrumentation. Race builds will be instrumented with atomic coverage (using
64+
# sync/atomic.AddInt32), which will not work. We may be able to re-enable
65+
# coverage on them when https://golang.org/issue/43007 is resolved.
66+
gopkgs=$("$go_tool" list ./... | grep -E -v 'pkg/sentry/platform|pkg/ring0|pkg/coverage|pkg/sleep|pkg/sync|pkg/syncevent' | paste -sd,)
67+
"$go_tool" build --tags "$go_tags" $go_opts -cover -coverpkg="$gopkgs" -covermode=atomic -o "$dst" runsc/main.go

0 commit comments

Comments
 (0)