testutil

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2022 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	QRY_CAP        = "cap"
	QRY_MULTIALLOC = "multialloc"
	QRY_STATUS     = "status"
	QRY_BUFFER_F   = "bufferF"
	QRY_BUFFER_I   = "bufferI"
)
View Source
var Ann = annFactory{}

Factory for creating annotation strings. Interpolate results with Go source code. Wrap multiple factory calls in the At function to concatenate multiple annotations on the same line and prefix with "//@ "

Functions

func At

func At(anns ...string) string

Prefixes a sequence of strings with "//@ "

func GoKerTestName

func GoKerTestName(test string) string

func ListAllTests

func ListAllTests(t *testing.T, pathToRoot string) []string

func ListGoKerPackages

func ListGoKerPackages(t *testing.T, pathToRoot string) []string

func ListPackagesIn

func ListPackagesIn(t *testing.T, pathToRoot string, blacklist []string, bmDir string) []string

func ListPorPkgTests

func ListPorPkgTests(t *testing.T, pathToRoot string, blacklist []string) []string

func ListSessionTypesPackages

func ListSessionTypesPackages(t *testing.T, pathToRoot string, blacklist []string) []string

func ListSimpleTests

func ListSimpleTests(t *testing.T, pathToRoot string) []string

func ListSyncPkgCondTests

func ListSyncPkgCondTests(t *testing.T, pathToRoot string, blacklist []string) []string

func ListSyncPkgTests

func ListSyncPkgTests(t *testing.T, pathToRoot string, blacklist []string) []string

func ListTopPointerTests

func ListTopPointerTests(t *testing.T, pathToRoot string, blacklist []string) []string

func RecListPackagesIn

func RecListPackagesIn(t *testing.T, pathToRoot string, blacklist []string, bmDir string) []string

Types

type AnnBlocks

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

func (AnnBlocks) FalseNegative

func (a AnnBlocks) FalseNegative() bool

func (AnnBlocks) FalsePositive

func (a AnnBlocks) FalsePositive() bool

func (AnnBlocks) Focused

func (a AnnBlocks) Focused() AnnGoro

func (AnnBlocks) HasFocus

func (a AnnBlocks) HasFocus() bool

func (AnnBlocks) Manager

func (a AnnBlocks) Manager() NotesManager

func (AnnBlocks) Name

func (a AnnBlocks) Name() string

func (AnnBlocks) Nodes

func (a AnnBlocks) Nodes() map[cfg.Node]struct{}

func (AnnBlocks) Note

func (a AnnBlocks) Note() *expect.Note

func (AnnBlocks) Panicked

func (a AnnBlocks) Panicked() bool

func (AnnBlocks) Related

func (a1 AnnBlocks) Related() annList

Returns all annotations found on the same line as the given annotation.

func (AnnBlocks) String

func (a AnnBlocks) String() string

type AnnChan

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

func (AnnChan) Chan

func (a AnnChan) Chan() ssa.Value

func (AnnChan) FalseNegative

func (a AnnChan) FalseNegative() bool

func (AnnChan) FalsePositive

func (a AnnChan) FalsePositive() bool

func (AnnChan) Manager

func (a AnnChan) Manager() NotesManager

func (AnnChan) Name

func (a AnnChan) Name() string

func (AnnChan) Nodes

func (a AnnChan) Nodes() map[cfg.Node]struct{}

func (AnnChan) Note

func (a AnnChan) Note() *expect.Note

func (AnnChan) Panicked

func (a AnnChan) Panicked() bool

func (AnnChan) Related

func (a1 AnnChan) Related() annList

Returns all annotations found on the same line as the given annotation.

func (AnnChan) String

func (a AnnChan) String() string

type AnnChanQuery

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

func (AnnChanQuery) Chan

func (a AnnChanQuery) Chan() ssa.Value

func (*AnnChanQuery) ChanNote

func (a *AnnChanQuery) ChanNote() AnnChan

Retrieves the channel annotation with the same channel name.

func (AnnChanQuery) ChanRelated

func (a1 AnnChanQuery) ChanRelated() []Annotation

Returns related channel queries.

func (AnnChanQuery) FalseNegative

func (a AnnChanQuery) FalseNegative() bool

func (AnnChanQuery) FalsePositive

func (a AnnChanQuery) FalsePositive() bool

func (AnnChanQuery) Focused

func (a AnnChanQuery) Focused() string

func (AnnChanQuery) FocusedNote

func (a AnnChanQuery) FocusedNote() AnnGoro

Retrieves the goroutine annotation for the focused goroutine of that channel query. It should always succeed.

func (AnnChanQuery) Gowner

func (a AnnChanQuery) Gowner() string

func (AnnChanQuery) GownerNote

func (a AnnChanQuery) GownerNote() AnnGoro

Retrieves the goroutine annotation for the goroutine that owns the channel. It should always succeed.

func (AnnChanQuery) HasOwner

func (a AnnChanQuery) HasOwner() bool

func (AnnChanQuery) IsFocused

func (a AnnChanQuery) IsFocused() bool

func (AnnChanQuery) Manager

func (a AnnChanQuery) Manager() NotesManager

func (AnnChanQuery) Name

func (a AnnChanQuery) Name() string

func (AnnChanQuery) Nodes

func (a AnnChanQuery) Nodes() map[cfg.Node]struct{}

func (AnnChanQuery) Note

func (a AnnChanQuery) Note() *expect.Note

func (AnnChanQuery) Panicked

func (a AnnChanQuery) Panicked() bool

func (AnnChanQuery) Prop

func (a AnnChanQuery) Prop() string

func (AnnChanQuery) Related

func (a1 AnnChanQuery) Related() annList

Returns all annotations found on the same line as the given annotation.

func (AnnChanQuery) String

func (a AnnChanQuery) String() string

func (AnnChanQuery) Value

func (a AnnChanQuery) Value() L.Element

type AnnFalseNegative

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

func (AnnFalseNegative) FalseNegative

func (a AnnFalseNegative) FalseNegative() bool

func (AnnFalseNegative) FalsePositive

func (a AnnFalseNegative) FalsePositive() bool

func (AnnFalseNegative) Manager

func (a AnnFalseNegative) Manager() NotesManager

func (AnnFalseNegative) Name

func (a AnnFalseNegative) Name() string

func (AnnFalseNegative) Nodes

func (a AnnFalseNegative) Nodes() map[cfg.Node]struct{}

func (AnnFalseNegative) Note

func (a AnnFalseNegative) Note() *expect.Note

func (AnnFalseNegative) Panicked

func (a AnnFalseNegative) Panicked() bool

func (AnnFalseNegative) Related

func (a1 AnnFalseNegative) Related() annList

Returns all annotations found on the same line as the given annotation.

func (AnnFalseNegative) String

func (a AnnFalseNegative) String() string

type AnnFalsePositive

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

func (AnnFalsePositive) FalseNegative

func (a AnnFalsePositive) FalseNegative() bool

func (AnnFalsePositive) FalsePositive

func (a AnnFalsePositive) FalsePositive() bool

func (AnnFalsePositive) Manager

func (a AnnFalsePositive) Manager() NotesManager

func (AnnFalsePositive) Name

func (a AnnFalsePositive) Name() string

func (AnnFalsePositive) Nodes

func (a AnnFalsePositive) Nodes() map[cfg.Node]struct{}

func (AnnFalsePositive) Note

func (a AnnFalsePositive) Note() *expect.Note

func (AnnFalsePositive) Panicked

func (a AnnFalsePositive) Panicked() bool

func (AnnFalsePositive) Related

func (a1 AnnFalsePositive) Related() annList

Returns all annotations found on the same line as the given annotation.

func (AnnFalsePositive) String

func (a AnnFalsePositive) String() string

type AnnFocused

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

func (AnnFocused) FalseNegative

func (a AnnFocused) FalseNegative() bool

func (AnnFocused) FalsePositive

func (a AnnFocused) FalsePositive() bool

func (AnnFocused) Goro

func (a AnnFocused) Goro() AnnGoro

func (AnnFocused) Manager

func (a AnnFocused) Manager() NotesManager

func (AnnFocused) Matches

func (a AnnFocused) Matches(g defs.Goro) bool

func (AnnFocused) Name

func (a AnnFocused) Name() string

func (AnnFocused) Nodes

func (a AnnFocused) Nodes() map[cfg.Node]struct{}

func (AnnFocused) Note

func (a AnnFocused) Note() *expect.Note

func (AnnFocused) Panicked

func (a AnnFocused) Panicked() bool

func (AnnFocused) Related

func (a1 AnnFocused) Related() annList

Returns all annotations found on the same line as the given annotation.

func (AnnFocused) String

func (a AnnFocused) String() string

type AnnGo

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

Annotation for naming spawning points

func (AnnGo) FalseNegative

func (a AnnGo) FalseNegative() bool

func (AnnGo) FalsePositive

func (a AnnGo) FalsePositive() bool

func (AnnGo) Go

func (a AnnGo) Go() cfg.Node

Goroutine CFG node associated with spawning point.

func (AnnGo) Manager

func (a AnnGo) Manager() NotesManager

func (AnnGo) Name

func (a AnnGo) Name() string

func (AnnGo) Nodes

func (a AnnGo) Nodes() map[cfg.Node]struct{}

func (AnnGo) Note

func (a AnnGo) Note() *expect.Note

func (AnnGo) Panicked

func (a AnnGo) Panicked() bool

func (AnnGo) Related

func (a1 AnnGo) Related() annList

Returns all annotations found on the same line as the given annotation.

func (AnnGo) String

func (a AnnGo) String() string

type AnnGoro

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

Annotation for creating specific goroutines. Goroutines consist of a chain of spawning points. The order is given left to right from the root goroutine.

func (AnnGoro) FalseNegative

func (a AnnGoro) FalseNegative() bool

func (AnnGoro) FalsePositive

func (a AnnGoro) FalsePositive() bool

func (AnnGoro) Goro

func (a AnnGoro) Goro() []cfg.Node

func (AnnGoro) Manager

func (a AnnGoro) Manager() NotesManager

func (AnnGoro) Matches

func (a AnnGoro) Matches(g defs.Goro) bool

Checks whether a goroutine structure is represented by a goroutine annotation (only takes control locations into account). If the goroutine annotation is set to hardmatch, then the full spawning point chain must match. Otherwise, only the inner-most chain must.

func (AnnGoro) Name

func (a AnnGoro) Name() string

func (AnnGoro) Nodes

func (a AnnGoro) Nodes() map[cfg.Node]struct{}

func (AnnGoro) Note

func (a AnnGoro) Note() *expect.Note

func (AnnGoro) Panicked

func (a AnnGoro) Panicked() bool

func (AnnGoro) Related

func (a1 AnnGoro) Related() annList

Returns all annotations found on the same line as the given annotation.

func (AnnGoro) String

func (a AnnGoro) String() string

type AnnPanicked

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

func (AnnPanicked) FalseNegative

func (a AnnPanicked) FalseNegative() bool

func (AnnPanicked) FalsePositive

func (a AnnPanicked) FalsePositive() bool

func (AnnPanicked) Manager

func (a AnnPanicked) Manager() NotesManager

func (AnnPanicked) Name

func (a AnnPanicked) Name() string

func (AnnPanicked) Nodes

func (a AnnPanicked) Nodes() map[cfg.Node]struct{}

func (AnnPanicked) Note

func (a AnnPanicked) Note() *expect.Note

func (AnnPanicked) Panicked

func (a AnnPanicked) Panicked() bool

func (AnnPanicked) Related

func (a1 AnnPanicked) Related() annList

Returns all annotations found on the same line as the given annotation.

func (AnnPanicked) String

func (a AnnPanicked) String() string

type AnnProgress

type AnnProgress interface {
	Annotation

	Focused() AnnGoro
	HasFocus() bool
}

type AnnReleases

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

func (AnnReleases) FalseNegative

func (a AnnReleases) FalseNegative() bool

func (AnnReleases) FalsePositive

func (a AnnReleases) FalsePositive() bool

func (AnnReleases) Focused

func (a AnnReleases) Focused() AnnGoro

func (AnnReleases) HasFocus

func (a AnnReleases) HasFocus() bool

func (AnnReleases) Manager

func (a AnnReleases) Manager() NotesManager

func (AnnReleases) Name

func (a AnnReleases) Name() string

func (AnnReleases) Nodes

func (a AnnReleases) Nodes() map[cfg.Node]struct{}

func (AnnReleases) Note

func (a AnnReleases) Note() *expect.Note

func (AnnReleases) Panicked

func (a AnnReleases) Panicked() bool

func (AnnReleases) Related

func (a1 AnnReleases) Related() annList

Returns all annotations found on the same line as the given annotation.

func (AnnReleases) String

func (a AnnReleases) String() string

type Annotation

type Annotation interface {
	// Returns related annotations (created from notes on the same line).
	Related() annList
	String() string

	Panicked() bool

	Note() *expect.Note
	Nodes() map[cfg.Node]struct{}
	Manager() NotesManager
}

type AnnotationWithFocus

type AnnotationWithFocus interface {
	Annotation

	Focused() annList
}

type LoadResult

type LoadResult struct {
	MainPkg          *packages.Package
	Prog             *ssa.Program
	Mains            []*ssa.Package
	Cfg              *cfg.Cfg
	Goros            u.GoTopology
	GoroCycles       u.GoCycles
	Pointer          *pointer.Result
	CallDAG          graph.SCCDecomposition[*ssa.Function]
	CtrLocPriorities u.CtrLocPriorities
	WrittenFields    u.WrittenFields
}

func LoadExamplePackage

func LoadExamplePackage(t *testing.T, pathToRoot string, pkg string) LoadResult

func LoadPackageFromSource

func LoadPackageFromSource(t *testing.T, importPath string, content string) (res LoadResult)

func LoadResultFromPackages

func LoadResultFromPackages(t *testing.T, pkgs []*packages.Package) (res LoadResult)

type NotesManager

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

func MakeNotesManager

func MakeNotesManager(
	t *testing.T,
	loadRes LoadResult) (n NotesManager)

func (NotesManager) AnnotationOf

func (n NotesManager) AnnotationOf(note *expect.Note) Annotation

func (NotesManager) Annotations

func (n NotesManager) Annotations() map[*expect.Note]Annotation

func (NotesManager) CreateAnnotation

func (mgr NotesManager) CreateAnnotation(note *expect.Note) Annotation

func (NotesManager) FindAllAnnotations

func (n NotesManager) FindAllAnnotations(pred func(Annotation) bool) annList

func (NotesManager) FindAllNotes

func (n NotesManager) FindAllNotes(find func(*expect.Note) bool) (notes map[*expect.Note]struct{})

func (NotesManager) FindGoro

func (n NotesManager) FindGoro(name string) AnnGoro

func (NotesManager) FindNote

func (n NotesManager) FindNote(find func(*expect.Note) bool) (*expect.Note, bool)

func (NotesManager) ForEachAnnotation

func (n NotesManager) ForEachAnnotation(do func(a Annotation))

func (NotesManager) ForEachNote

func (n NotesManager) ForEachNote(
	do func(i int, note *expect.Note),
)

func (NotesManager) LoadResult

func (n NotesManager) LoadResult() LoadResult

func (NotesManager) NodeHasAnn

func (n NotesManager) NodeHasAnn(node cfg.Node, ann Annotation) bool

func (NotesManager) NodesForNote

func (n NotesManager) NodesForNote(note *expect.Note) map[cfg.Node]struct{}

func (NotesManager) NoteForCtrLoc

func (n NotesManager) NoteForCtrLoc(cl defs.CtrLoc) (*expect.Note, bool)

func (NotesManager) NoteForNode

func (n NotesManager) NoteForNode(node cfg.Node) (*expect.Note, bool)

func (NotesManager) Notes

func (n NotesManager) Notes() []*expect.Note

func (NotesManager) NotesForNode

func (n NotesManager) NotesForNode(node cfg.Node) map[*expect.Note]struct{}

func (NotesManager) OrphansToAnnotations

func (n NotesManager) OrphansToAnnotations(orphans map[defs.Superloc]map[defs.Goro]struct{}) map[defs.Superloc]annList

func (NotesManager) String

func (n NotesManager) String() (str string)

Jump to

Keyboard shortcuts

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