package pods

import "internal/coverage/pods"

Index

Types

type Pod

type Pod struct {
	MetaFile         string
	CounterDataFiles []string
	Origins          []int
	ProcessIDs       []int
}

Pod encapsulates a set of files emitted during the executions of a coverage-instrumented binary. Each pod contains a single meta-data file, and then 0 or more counter data files that refer to that meta-data file. Pods are intended to simplify processing of coverage output files in the case where we have several coverage output directories containing output files derived from more than one instrumented executable. In the case where the files that make up a pod are spread out across multiple directories, each element of the "Origins" field below will be populated with the index of the originating directory for the corresponding counter data file (within the slice of input dirs handed to CollectPods). The ProcessIDs field will be populated with the process ID of each data file in the CounterDataFiles slice.

func CollectPods

func CollectPods(dirs []string, warn bool) ([]Pod, error)

CollectPods visits the files contained within the directories in the list 'dirs', collects any coverage-related files, partitions them into pods, and returns a list of the pods to the caller, along with an error if something went wrong during directory/file reading.

CollectPods skips over any file that is not related to coverage (e.g. avoids looking at things that are not meta-data files or counter-data files). CollectPods also skips over 'orphaned' counter data files (e.g. counter data files for which we can't find the corresponding meta-data file). If "warn" is true, CollectPods will issue warnings to stderr when it encounters non-fatal problems (for orphans or a directory with no meta-data files).

func CollectPodsFromFiles

func CollectPodsFromFiles(files []string, warn bool) []Pod

CollectPodsFromFiles functions the same as "CollectPods" but operates on an explicit list of files instead of a directory.