MCPcopy
hub / github.com/cilium/ebpf / TestProgramLoadPinnedWithFlags

Function TestProgramLoadPinnedWithFlags

prog_test.go:241–263  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

239}
240
241func TestProgramLoadPinnedWithFlags(t *testing.T) {
242 // Introduced in commit 6e71b04a8224.
243 testutils.SkipOnOldKernel(t, "4.14", "file_flags in BPF_OBJ_GET")
244
245 prog := createBasicProgram(t)
246
247 tmp := testutils.TempBPFFS(t)
248
249 path := filepath.Join(tmp, "program")
250 if err := prog.Pin(path); err != nil {
251 t.Fatal(err)
252 }
253
254 prog.Close()
255
256 _, err := LoadPinnedProgram(path, &LoadPinOptions{
257 Flags: math.MaxUint32,
258 })
259 testutils.SkipIfNotSupported(t, err)
260 if !errors.Is(err, unix.EINVAL) {
261 t.Fatal("Invalid flags don't trigger an error:", err)
262 }
263}
264
265func TestProgramVerifierOutputOnError(t *testing.T) {
266 _, err := newProgram(t, &ProgramSpec{

Callers

nothing calls this directly

Calls 8

SkipOnOldKernelFunction · 0.92
TempBPFFSFunction · 0.92
SkipIfNotSupportedFunction · 0.92
createBasicProgramFunction · 0.85
LoadPinnedProgramFunction · 0.85
PinMethod · 0.65
CloseMethod · 0.65
IsMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…