diff options
| author | Dean Deng <deandeng@google.com> | 2020-10-13 00:05:50 -0700 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2020-10-13 09:42:46 +0200 |
| commit | bd69ee0d2dd6fc13399841bf7b6b34a1fc56448a (patch) | |
| tree | 9dd7136e3745a1242005d297f590490763e195e0 /pkg | |
| parent | d32b0bbf2f8cfe548553c4012e2c0f79040d999f (diff) | |
gvisor: add build option for collecting code coverage
Diffstat (limited to 'pkg')
| -rw-r--r-- | pkg/build/gvisor.go | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/pkg/build/gvisor.go b/pkg/build/gvisor.go index 8d97be174..c3e817b03 100644 --- a/pkg/build/gvisor.go +++ b/pkg/build/gvisor.go @@ -16,9 +16,14 @@ type gvisor struct{} func (gvisor gvisor) build(params *Params) error { // Bring down bazel daemon right away. We don't need it running and consuming memory. defer osutil.RunCmd(10*time.Minute, params.KernelDir, params.Compiler, "shutdown") - outBinary := "" + + config := " " + string(params.Config) + " " args := []string{"build", "--verbose_failures"} - if strings.Contains(" "+string(params.Config)+" ", " -race ") { + outBinary := "" + if strings.Contains(config, " -cover ") { + args = append(args, []string{"--collect_code_coverage", "--instrumentation_filter=//pkg/..."}...) + } + if strings.Contains(config, " -race ") { args = append(args, "--features=race", "//runsc:runsc-race") outBinary = "bazel-bin/runsc/linux_amd64_static_race_stripped/runsc-race" } else { |
