imagetesting

package
v0.143.1 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2025 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultGoldenOpts = GoldenImageTestOpts{
	WriteFiles: false,
	DevMode:    false,
}

To rebuild all Golden image tests, toggle WriteFiles=true and run: GOARCH=amd64 go test -count 1 -timeout 30s -run "^TestImagesGolden" ./... TODO(bep) see if we can do this via flags.

View Source
var SkipGoldenTests = runtime.GOARCH == "ppc64" || runtime.GOARCH == "ppc64le" || runtime.GOARCH == "s390x"

We don't have a CI test environment for these, and there are known dithering issues that makes these time consuming to maintain.

View Source
var UsesFMA = runtime.GOARCH == "s390x" ||
	runtime.GOARCH == "ppc64" ||
	runtime.GOARCH == "ppc64le" ||
	runtime.GOARCH == "arm64" ||
	runtime.GOARCH == "riscv64"

UsesFMA indicates whether "fused multiply and add" (FMA) instruction is used. The command "grep FMADD go/test/codegen/floats.go" can help keep the FMA-using architecture list updated.

Functions

Types

type GoldenImageTestOpts

type GoldenImageTestOpts struct {
	// The test.
	T testing.TB

	// Name of the test. Will be used as the base folder for generated images.
	// Slashes allowed and encouraged.
	Name string

	// The test site's files in txttar format.
	Files string

	// Set to true to write golden files to disk.
	WriteFiles bool

	// If not set, a temporary directory will be created.
	WorkingDir string

	// Set to true to skip any assertions. Useful when adding new golden variants to a test.
	DevMode bool

	// Set to skip any assertions.
	SkipAssertions bool

	// Whether this represents a rebuild of the same site.
	// Setting this to true will keep the previous golden image set.
	Rebuild bool
}

GoldenImageTestOpts provides options for a golden image test.

Jump to

Keyboard shortcuts

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