Documentation
¶
Index ¶
- Constants
- func CaptureStdoutAndStderr() func() (string, error)
- func FilterStability(t *testing.T, mode StabilityMode)
- func MaxParallel() int
- func MaxParallelOverride() (int, bool)
- func MutateByteSlice(bytez []byte) []byte
- func NewTestCaseDir(t *testing.T) (string, func())
- func NewTestFile(t *testing.T) (*os.File, func())
- type StabilityMode
Constants ¶
const MaxParallelEnv = "GNO_TEST_MAX_PARALLEL"
MaxParallelEnv pins the worker counts derived in this file. Setting it opts out of scaling to fit the machine, which is occasionally useful when profiling or bisecting a memory problem.
Variables ¶
This section is empty.
Functions ¶
func CaptureStdoutAndStderr ¶
CaptureStdoutAndStderr temporarily pipes os.Stdout and os.Stderr into a buffer. Imported from https://github.com/moul/u/blob/master/io.go.
func FilterStability ¶
func FilterStability(t *testing.T, mode StabilityMode)
func MaxParallel ¶
func MaxParallel() int
MaxParallel reports how many memory-heavy workers a test suite may run concurrently, for suites that must fix the count up front — a pool of GnoVM stores, say, as opposed to workers started one at a time, which can instead ramp against github.com/gnolang/gno/tm2/pkg/meminfo.Read.
Such workers cost hundreds of megabytes of live heap each, so sizing their concurrency off GOMAXPROCS — the default for `go test` parallelism — makes peak memory scale with the core count. That is the wrong axis: these suites are bound by memory, not CPU, and stop getting faster well before they stop getting bigger.
func MaxParallelOverride ¶
MaxParallelOverride reports the MaxParallelEnv setting, if it holds a positive integer.
func MutateByteSlice ¶
Contract: !bytes.Equal(input, output) && len(input) >= len(output) TODO: keep output size the same; search all usage first.
func NewTestCaseDir ¶
NewTestCaseDir creates a new temporary directory for a test case. Returns the directory path and a cleanup function.
Types ¶
type StabilityMode ¶
type StabilityMode string
const ( Stable StabilityMode = "stable" Flappy StabilityMode = "flappy" Broken StabilityMode = "broken" )