cover

package
v0.0.0-...-be17c9c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 14, 2026 License: Apache-2.0 Imports: 27 Imported by: 82

Documentation

Overview

Package cover provides types for working with coverage information (arrays of covered PCs).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DoHeatMapStyleBodyJS

func DoHeatMapStyleBodyJS(
	ctx context.Context, client spannerclient.SpannerClient, scope *coveragedb.SelectScope, onlyUnique bool,
	sss, managers []string, dataFilters Format) (template.CSS, template.HTML, template.HTML, error)

func DoSubsystemsHeatMapStyleBodyJS

func DoSubsystemsHeatMapStyleBodyJS(
	ctx context.Context, client spannerclient.SpannerClient, scope *coveragedb.SelectScope, onlyUnique bool,
	sss, managers []string, format Format) (template.CSS, template.HTML, template.HTML, error)

func FilesCoverageToTemplateData

func FilesCoverageToTemplateData(fCov []*coveragedb.FileCoverageWithDetails) *templateHeatmap

func FormatResult

func FormatResult(thm *templateHeatmap, format Format)

func GetMergeResult

func GetMergeResult(c context.Context, ns, repo, forCommit, sourceCommit, filePath string,
	proxy covermerger.FuncProxyURI, tp coveragedb.TimePeriod) (*covermerger.MergeResult, error)

nolint:revive

func GetPCBase

func GetPCBase(cfg *mgrconfig.Config) (uint64, error)

func Percent

func Percent[T int | int64](covered, total T) T

func RendFileCoverage

func RendFileCoverage(repo, forCommit, filePath string, fileProvider covermerger.FileVersProvider,
	mr *covermerger.MergeResult, renderConfig *CoverageRenderConfig) (string, error)

func RendHTMLLine

func RendHTMLLine(code string, line int, coverage *covermerger.MergeResult, config *CoverageRenderConfig) string

func RendTextLine

func RendTextLine(code string, line int, coverage *covermerger.MergeResult, config *CoverageRenderConfig) string

func WriteCIJSONLine

func WriteCIJSONLine(w io.Writer, managerCover CoverageInfo, ciDetails CIDetails) error

func WriteJSLine

func WriteJSLine[T any](w io.Writer, obj *T) error

Types

type Block

type Block struct {
	HitCount int `json:"hit_count,omitempty"`
	FromLine int `json:"from_line"`
	FromCol  int `json:"from_column"`
	ToLine   int `json:"to_line"`
	ToCol    int `json:"to_column"`
}

type CIDetails

type CIDetails struct {
	Version        int    `json:"version"`
	Timestamp      string `json:"timestamp"`
	FuzzingMinutes int    `json:"fuzzing_minutes"`
	Arch           string `json:"arch"`
	BuildID        string `json:"build_id"`
	Manager        string `json:"manager"`
	KernelRepo     string `json:"kernel_repo"`
	KernelBranch   string `json:"kernel_branch"`
	KernelCommit   string `json:"kernel_commit"`
}

CIDetails fields will be added to every CSV line.

type Canonicalizer

type Canonicalizer struct {
	// contains filtered or unexported fields
}

func NewCanonicalizer

func NewCanonicalizer(modules []*vminfo.KernelModule, flagSignal bool) *Canonicalizer

func (*Canonicalizer) NewInstance

func (can *Canonicalizer) NewInstance(modules []*vminfo.KernelModule) *CanonicalizerInstance

type CanonicalizerInstance

type CanonicalizerInstance struct {
	// contains filtered or unexported fields
}

func (*CanonicalizerInstance) Canonicalize

func (ci *CanonicalizerInstance) Canonicalize(elems []uint64) []uint64

func (*CanonicalizerInstance) Decanonicalize

func (ci *CanonicalizerInstance) Decanonicalize(elems []uint64) []uint64

type Convert

type Convert struct {
	// contains filtered or unexported fields
}

Contains the current conversion maps used.

type Cover

type Cover map[uint64]struct{}

func FromRaw

func FromRaw(raw []uint64) Cover

func (*Cover) Merge

func (cov *Cover) Merge(raw []uint64)

func (*Cover) MergeDiff

func (cov *Cover) MergeDiff(raw []uint64) []uint64

Merge merges raw into coverage and returns newly added PCs. Overwrites/mutates raw.

func (*Cover) Serialize

func (cov *Cover) Serialize() []uint64

type CoverageInfo

type CoverageInfo struct {
	FilePath  string `json:"file_path"`
	FuncName  string `json:"func_name"`
	StartLine int    `json:"sl"`
	StartCol  int    `json:"sc"`
	EndLine   int    `json:"el"`
	EndCol    int    `json:"ec"`
	HitCount  int    `json:"hit_count"`
	Inline    bool   `json:"inline"`
	PC        uint64 `json:"pc"`
}

type CoverageRenderConfig

type CoverageRenderConfig struct {
	RendLine                  lineRender
	ShowLineCoverage          bool
	ShowLineNumbers           bool
	ShowLineSourceExplanation bool
}

func DefaultHTMLRenderConfig

func DefaultHTMLRenderConfig() *CoverageRenderConfig

func DefaultTextRenderConfig

func DefaultTextRenderConfig() *CoverageRenderConfig

type FileCoverage

type FileCoverage struct {
	Repo      string          `json:"repo,omitempty"`
	Commit    string          `json:"commit,omitempty"`
	FilePath  string          `json:"file_path"`
	Functions []*FuncCoverage `json:"functions"`
}

type Format

type Format struct {
	FilterMinCoveredLinesDrop int
	OrderByCoveredLinesDrop   bool
	DropCoveredLines0         bool
}

type FuncCoverage

type FuncCoverage struct {
	FuncName string   `json:"func_name"`
	Blocks   []*Block `json:"blocks"`
}

type HandlerParams

type HandlerParams struct {
	Progs  []Prog
	Filter map[uint64]struct{}
	Debug  bool
	Force  bool
}

type Prog

type Prog struct {
	Sig  string
	Data string
	PCs  []uint64
}

type ProgramCoverage

type ProgramCoverage struct {
	Repo         string          `json:"repo,omitempty"`
	Commit       string          `json:"commit,omitempty"`
	Program      string          `json:"program"`
	CoveredFiles []*FileCoverage `json:"coverage"`
}

type ReportGenerator

type ReportGenerator struct {
	*backend.Impl
	// contains filtered or unexported fields
}

func MakeReportGenerator

func MakeReportGenerator(cfg *mgrconfig.Config, modules []*vminfo.KernelModule) (*ReportGenerator, error)

func (*ReportGenerator) DoCoverJSONL

func (rg *ReportGenerator) DoCoverJSONL(w io.Writer, params HandlerParams) error

DoCoverJSONL is a handler for "/cover?jsonl=1".

func (*ReportGenerator) DoCoverPrograms

func (rg *ReportGenerator) DoCoverPrograms(w io.Writer, params HandlerParams) error

DoCoverPrograms returns the corpus programs with the associated coverage. The result is a jsonl stream. Each line is a single ProgramCoverage record.

func (*ReportGenerator) DoFileCover

func (rg *ReportGenerator) DoFileCover(w io.Writer, params HandlerParams) error

func (*ReportGenerator) DoFilterPCs

func (rg *ReportGenerator) DoFilterPCs(w io.Writer, params HandlerParams) error

func (*ReportGenerator) DoFuncCover

func (rg *ReportGenerator) DoFuncCover(w io.Writer, params HandlerParams) error

func (*ReportGenerator) DoHTML

func (rg *ReportGenerator) DoHTML(w io.Writer, params HandlerParams) error

func (*ReportGenerator) DoLineJSON

func (rg *ReportGenerator) DoLineJSON(w io.Writer, params HandlerParams) error

func (*ReportGenerator) DoModuleCover

func (rg *ReportGenerator) DoModuleCover(w io.Writer, params HandlerParams) error

func (*ReportGenerator) DoRawCover

func (rg *ReportGenerator) DoRawCover(w io.Writer, params HandlerParams) error

func (*ReportGenerator) DoRawCoverFiles

func (rg *ReportGenerator) DoRawCoverFiles(w io.Writer, params HandlerParams) error

func (*ReportGenerator) DoSubsystemCover

func (rg *ReportGenerator) DoSubsystemCover(w io.Writer, params HandlerParams) error

type StyleBodyJS

type StyleBodyJS struct {
	Style template.CSS
	Body  template.HTML
	JS    template.HTML
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL