File tree Expand file tree Collapse file tree 2 files changed +36
-2
lines changed Expand file tree Collapse file tree 2 files changed +36
-2
lines changed Original file line number Diff line number Diff line change @@ -93,5 +93,28 @@ go_cov(
9393 "\" $(location //:go.mod)\" " +
9494 "\" $(location //:go.sum)\" " +
9595 "\" $(location main.go)\" " +
96- "\" $(location //tools:go-allow-internal.patch)\" " ,
96+ "\" $(location //tools:go-allow-internal.patch)\" " +
97+ "\" false\" " ,
98+ )
99+
100+ go_cov (
101+ name = "runsc_race_coverage" ,
102+ srcs = [
103+ "main.go" ,
104+ "//:go.mod" ,
105+ "//:go.sum" ,
106+ "//:gopath" ,
107+ "//tools:build_cover.sh" ,
108+ "//tools:go-allow-internal.patch" ,
109+ ],
110+ outs = ["runsc_race_cov" ],
111+ cmd =
112+ "\" $(location //tools:build_cover.sh)\" " +
113+ "\" $(location //runsc:runsc_race_cov)\" " +
114+ "\" $(location //:gopath)\" " +
115+ "\" $(location //:go.mod)\" " +
116+ "\" $(location //:go.sum)\" " +
117+ "\" $(location main.go)\" " +
118+ "\" $(location //tools:go-allow-internal.patch)\" " +
119+ "\" true\" " ,
97120)
Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ go_mod="$3"
2222go_sum=" $4 "
2323runsc_main_go=" $5 "
2424golang_patch=$( realpath " $6 " )
25+ race=" $7 "
2526
2627mkdir .gocache
2728GOMODCACHE=" $( pwd) /.gocache"
@@ -48,5 +49,15 @@ mkdir -p "$gvisor_gopath/src/gvisor.dev/gvisor/runsc"
4849cp " $runsc_main_go " " $gvisor_gopath /src/gvisor.dev/gvisor/runsc/main.go"
4950cd " $gvisor_gopath /src/gvisor.dev/gvisor/"
5051export GOROOT=" $goroot_dir "
52+ go_opts=" "
53+ go_tags=" kcov,opensource"
54+ if [[ " $race " = true ]]; then
55+ go_opts=" -race"
56+ go_tags=" $go_tags ,lockdep"
57+ else
58+ # runsc has to be a self-contained binary to be able to run it in a minimal
59+ # mount namespace.
60+ export CGO_ENABLED=0
61+ fi
5162gopkgs=$( " $go_tool " list ./... | grep -v pkg/sentry/platform | grep -v pkg/ring0 | grep -v pkg/coverage | paste -sd,)
52- " $go_tool " build --tags kcov,opensource -cover -coverpkg=" $gopkg " -covermode=atomic -o " $dst " runsc/main.go
63+ " $go_tool " build --tags " $go_tags " $go_opts -cover -coverpkg=" $gopkg " -covermode=atomic -o " $dst " runsc/main.go
You can’t perform that action at this time.
0 commit comments