Debian Codegraph @

internal/testutils/bpffs_other.go

raw ◀ ▶
Source reconstructed at patch state 0 of 1 — not the installed (fully patched) source.
1 Debian patch touch this file
1 //go:build !windows
2
3 package testutils
4
5 import (
6 "os"
7 "testing"
8 )
9
10 // TempBPFFS creates a temporary directory on a BPF FS.
11 //
12 // The directory is automatically cleaned up at the end of the test run.
13 func TempBPFFS(tb testing.TB) string {
14 tb.Helper()
15
16 tmp, err := os.MkdirTemp("/sys/fs/bpf", "ebpf-test")
17 if err != nil {
18 tb.Fatal("Create temporary directory on BPFFS:", err)
19 }
20 tb.Cleanup(func() { os.RemoveAll(tmp) })
21
22 return tmp
23 }