allocs

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package allocs isolates allocation assertions from parallel test activity.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsChildProcess

func IsChildProcess() bool

IsChildProcess reports the exact subprocess invocation made by Run. TestMain may use this to avoid starting background services for an allocation-only test. An environment marker without the matching test filter is insufficient.

func Run

func Run(t *testing.T, measure func())

Run executes measure in a fresh copy of the test executable containing only this top-level test. Subtests are rejected: their parent setup can start concurrent work, and Go splits -test.run patterns on slashes rather than matching the full name. Call it from a parallel test, but do not start background work in measure: testing.Benchmark reads process-wide MemStats, not per-goroutine allocation counters. Parent tests stay parallel; their allocations cannot enter the child's measurement. The original assertion and threshold run in the child and any failure, timeout, or missing execution marker fails here.

Types

This section is empty.

Jump to

Keyboard shortcuts

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