functional

package
v1.2.4 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package functional is the machine behind cmd/nova-ci's `functional` verb: which of a change's packages carry functional tests, and which tests those are. A functional test is one in a _test.go file that builds only under the `functional` build tag (docs/TESTING.md: unit tests mock; functional tests carry the tag and run per stream merge, in ci.yml's functional job). The unit tier never builds those files, and the functional tier runs only them: `go test -tags functional` alone would run every unit test of the package a second time.

It reads Go source with go/build and go/parser and nothing else: no process, no network, no clock.

Index

Constants

View Source
const Tag = "functional"

Tag is the build tag that makes a test file functional.

Variables

This section is empty.

Functions

func Expand

func Expand(args []string) ([]string, error)

Expand turns `dir/...` patterns into every directory under dir, the way go list reads them (testdata, vendor and names starting with . or _ are not packages); any other argument is kept as given.

func RunPattern

func RunPattern(pkgs []Package) string

RunPattern is one `go test -run` pattern naming exactly the given tests: ^(A|B)$, each name quoted, so a test named like a prefix of another never drags the longer one in.

func Unmatched

func Unmatched(patterns []string) []string

Unmatched returns one clause per pattern that matches no package, in the order given: a directory that does not exist, a path that is not a directory, or a directory (for `dir/...`, a tree) holding no .go file at all, the cases where `go list` would list nothing for it. A typo in CI's package list must be a refusal, never a functional tier that silently runs nothing. It reads the file system only; build constraints are not applied, so a package whose files build only on another GOOS still matches, as go list lists it.

Types

type Package

type Package struct {
	Dir   string
	Tests []string
}

Package is one package directory with functional tests, and their names.

func Select

func Select(dirs []string) ([]Package, error)

Select returns, in the order given, the package directories that hold at least one test file built only under Tag, with the top-level Test functions those files declare (TestMain excluded: go test calls it, -run does not select it). A directory with no Go files is skipped, not an error: a deleted package can still be in a diff's list.

Jump to

Keyboard shortcuts

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