// Copyright 2024 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package cryptotest

import (
	
	
	
	
	
	
	
)

// SkipTestAllocations skips the test if there are any factors that interfere
// with allocation optimizations.
func ( *testing.T) {
	// Go+BoringCrypto uses cgo.
	if boring.Enabled {
		.Skip("skipping allocations test with BoringCrypto")
	}

	// The sanitizers sometimes cause allocations.
	if race.Enabled || msan.Enabled || asan.Enabled {
		.Skip("skipping allocations test with sanitizers")
	}

	// The plan9 crypto/rand allocates.
	if runtime.GOOS == "plan9" {
		.Skip("skipping allocations test on plan9")
	}

	// Some APIs rely on inliner and devirtualization to allocate on the stack.
	testenv.SkipIfOptimizationOff()
}