You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
cmd/cover: add new "emit meta file" mode for packages without tests
Introduce a new mode of execution for instrumenting packages that have
no test files. Instead of just skipping packages with no test files
(during "go test -cover" runs), the go command will invoke cmd/cover
on the package passing in an option in the config file indicating that
it should emit a coverage meta-data file directly for the package (if
the package has no functions, an empty file is emitted). Note that
this CL doesn't actually wire up this functionality in the Go command,
that will come in a later patch.
Updates #27261.
Updates #58770
Updates #24570.
Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest,gotip-windows-amd64-longtest
Change-Id: I01e8a3edb62441698c7246596e4bacbd966591c3
Reviewed-on: https://go-review.googlesource.com/c/go/+/495446
Reviewed-by: Bryan Mills <[email protected]>
LUCI-TryBot-Result: Go LUCI <[email protected]>
varVar=flag.String("var", "GoCover", "name of coverage variable to generate")
69
+
output=flag.String("o", "", "file for output")
70
+
outfilelist=flag.String("outfilelist", "", "file containing list of output files (one per line) if -pkgcfg is in use")
71
+
htmlOut=flag.String("html", "", "generate HTML representation of coverage profile")
72
+
funcOut=flag.String("func", "", "output coverage profile information for each function")
73
+
pkgcfg=flag.String("pkgcfg", "", "enable full-package instrumentation mode using params from specified config file")
74
+
pkgconfig covcmd.CoverPkgConfig
75
+
outputfiles []string// list of *.cover.go instrumented outputs to write, one per input (set when -pkgcfg is in use)
76
+
profilestring// The profile to read; the value of -html or -func
77
+
counterStmtfunc(*File, string) string
78
+
covervarsoutfilestring// an additional Go source file into which we'll write definitions of coverage counter variables + meta data variables (set when -pkgcfg is in use).
79
+
cmode coverage.CounterMode
80
+
cgran coverage.CounterGranularity
74
81
)
75
82
76
-
varpkgconfig covcmd.CoverPkgConfig
77
-
78
-
// outputfiles is the list of *.cover.go instrumented outputs to write,
79
-
// one per input (set when -pkgcfg is in use)
80
-
varoutputfiles []string
81
-
82
-
// covervarsoutfile is an additional Go source file into which we'll
83
-
// write definitions of coverage counter variables + meta data variables
84
-
// (set when -pkgcfg is in use).
85
-
varcovervarsoutfilestring
86
-
87
-
varprofilestring// The profile to read; the value of -html or -func
0 commit comments