Documentation
¶
Index ¶
- func CanCollect() bool
- func CanCollectPerTestCoverage() bool
- func CanComputeCoverageProfile() bool
- func CleanupRuntimeCoverageSnapshot()
- func ConfigureBackfill(input BackfillInput)
- func GetCoverage() float64
- func InitializeCoverage(m *testing.M, uploadEnabled bool)
- func ResetForTesting()
- func RuntimeCoverageSnapshot() (*runtimeCoverageSnapshot, error)
- func WriteLCOVReport(w io.Writer) error
- func WriteLCOVReportFromProfile(profilePath string, w io.Writer) error
- type BackfillInput
- type BackfillResult
- type TestCoverage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CanCollectPerTestCoverage ¶
func CanCollectPerTestCoverage() bool
CanCollectPerTestCoverage returns whether per-test coverage upload can run.
func CanComputeCoverageProfile ¶
func CanComputeCoverageProfile() bool
CanComputeCoverageProfile returns whether a runtime coverprofile can be produced.
func CleanupRuntimeCoverageSnapshot ¶
func CleanupRuntimeCoverageSnapshot()
CleanupRuntimeCoverageSnapshot removes a generated temp snapshot once.
func ConfigureBackfill ¶
func ConfigureBackfill(input BackfillInput)
ConfigureBackfill stores backend aggregate coverage for the finalizer.
func GetCoverage ¶
func GetCoverage() float64
GetCoverage returns the total coverage percentage for the test package
func InitializeCoverage ¶
InitializeCoverage initializes the runtime coverage.
func ResetForTesting ¶
func ResetForTesting()
ResetForTesting clears package globals used by coverage tests.
func RuntimeCoverageSnapshot ¶
func RuntimeCoverageSnapshot() (*runtimeCoverageSnapshot, error)
RuntimeCoverageSnapshot returns the single coverage profile snapshot used for final coverage calculation and ITR backfill.
func WriteLCOVReport ¶
WriteLCOVReport writes an LCOV report from the current runtime coverage snapshot.
Types ¶
type BackfillInput ¶
type BackfillInput struct {
BackendCoverage map[string]*filebitmap.FileBitmap
ActualSkips int
}
BackfillInput configures backend aggregate coverage that can repair the process-local coverage profile after ITR skips have been applied.
type BackfillResult ¶
type BackfillResult struct {
Applied bool
Reason string
Coverage float64
ProfilePath string
MatchedFiles int
UnmatchedBackendFiles int
MatchedBlocks int
UpdatedBlocks int
}
BackfillResult describes one idempotent coverage backfill finalization.
func FinalizeBackfill ¶
func FinalizeBackfill() BackfillResult
FinalizeBackfill applies backend coverage to the runtime snapshot once.
func PreflightBackfill ¶
func PreflightBackfill(input BackfillInput) BackfillResult
PreflightBackfill validates that runtime coverage can later be backfilled. Path matching is deferred to FinalizeBackfill because producing a coverage profile before testing.M.Run completes mutates Go's runtime coverage state.
type TestCoverage ¶
type TestCoverage interface {
// CollectCoverageBeforeTestExecution collects coverage before test execution.
CollectCoverageBeforeTestExecution()
// CollectCoverageAfterTestExecution collects coverage after test execution.
CollectCoverageAfterTestExecution()
}
TestCoverage is the interface for collecting test coverage.
func NewTestCoverage ¶
func NewTestCoverage(sessionID, moduleID, suiteID, testID uint64, testFile string) TestCoverage
NewTestCoverage creates a new test coverage.