Runs go tests on Apple Silicon efficiency cores only (useful for fuzzing)
Want to run your Go fuzz tests in the background without impacting your daily work? This tool automatically constrains test execution to Apple Silicon efficiency cores and sets background task priority in the macOS scheduler, letting you continue work or video calls while long-running fuzz tests churn away quietly in the background.
This tool wraps a command invocation I've been using in my shell aliases for
years, which I originally shared via a tweet. Upon request it's now packaged
as a Go binary for easy distribution via go install
.
To install:
go install github.com/mroth/go-bgtest@latest
For usage, simply subtitute go-bgtest
for go test
, all command line args
will be passed to go test unmodified, for example:
$ go-bgtest -fuzz=FuzzExample -fuzztime=6h
2025/06/28 15:48:42 🔬 Detected CPU: Apple M2 Pro (4 efficiency cores, 8 performance cores)
2025/06/28 15:48:42 🏃 Running GOMAXPROCS=4 taskpolicy -b -- go test -fuzz=FuzzExample -fuzztime=6h
fuzz: elapsed: 0s, gathering baseline coverage: 0/10 completed
fuzz: elapsed: 0s, gathering baseline coverage: 10/10 completed, now fuzzing with 4 workers
fuzz: elapsed: 3s, execs: 118732 (39508/sec), new interesting: 0 (total: 10)
fuzz: elapsed: 6s, execs: 243097 (41501/sec), new interesting: 0 (total: 10)
...
Your tests are run on efficiency cores only with task priority set to
PRIO_DARWIN_BG
, and GOMAXPROCS automatically set to the number of efficiency
cores on your workstation.