testutils

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckFeatureMatrix added in v0.10.0

func CheckFeatureMatrix[K comparable](t *testing.T, fm internal.FeatureMatrix[K])

func CheckFeatureTest

func CheckFeatureTest(t *testing.T, fn func() error)

func ClangBin added in v0.16.0

func ClangBin(tb testing.TB) string

func CreateCgroup added in v0.7.0

func CreateCgroup(tb testing.TB) *os.File

func Files added in v0.6.0

func Files(t *testing.T, files []string, fn func(*testing.T, string))

Files calls fn for each given file.

The function errors out if the pattern matches no files.

func GetCgroupIno added in v0.7.0

func GetCgroupIno(t *testing.T, cgroup *os.File) uint64

func Glob added in v0.6.0

func Glob(tb testing.TB, pattern string, excludes ...string) []string

Glob finds files matching a pattern.

The pattern should may include full path. Excludes use the same syntax as pattern, but are only applied to the basename instead of the full path.

func IsDeepCopy added in v0.16.0

func IsDeepCopy[T any](got, want T) qt.Checker

IsDeepCopy checks that got is a deep copy of want.

All primitive values must be equal, but pointers must be distinct. This is different from reflect.DeepEqual which will accept equal pointer values. That is, reflect.DeepEqual(a, a) is true, while IsDeepCopy(a, a) is false.

func IsKernelLessThan added in v0.9.2

func IsKernelLessThan(tb testing.TB, minVersion string) bool

func LockOSThreadToSingleCPU added in v0.15.0

func LockOSThreadToSingleCPU(tb testing.TB)

LockOSThreadToSingleCPU force the current goroutine to run on a single CPU.

func NativeFile added in v0.14.0

func NativeFile(tb testing.TB, path string) string

NativeFile substitutes %s with an abbreviation of the host endianness.

func Rand added in v0.11.0

func Rand(tb testing.TB) *rand.Rand

func SkipIfNotSupported

func SkipIfNotSupported(tb testing.TB, err error)

func SkipOnOldKernel

func SkipOnOldKernel(tb testing.TB, minVersion, feature string)

func TempBPFFS added in v0.5.0

func TempBPFFS(tb testing.TB) string

TempBPFFS creates a temporary directory on a BPF FS.

The directory is automatically cleaned up at the end of the test run.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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