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

Function TestMapClose

map_test.go:312–326  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

310}
311
312func TestMapClose(t *testing.T) {
313 m := createMap(t, Array, 2)
314
315 if err := m.Close(); err != nil {
316 t.Fatal("Can't close map:", err)
317 }
318
319 if err := m.Put(uint32(0), uint32(42)); !errors.Is(err, sys.ErrClosedFd) {
320 t.Fatal("Put doesn't check for closed fd", err)
321 }
322
323 if _, err := m.LookupBytes(uint32(0)); !errors.Is(err, sys.ErrClosedFd) {
324 t.Fatal("Get doesn't check for closed fd", err)
325 }
326}
327
328func TestBatchMapWithLock(t *testing.T) {
329 testutils.SkipOnOldKernel(t, "5.13", "MAP BATCH BPF_F_LOCK")

Callers

nothing calls this directly

Calls 5

PutMethod · 0.80
createMapFunction · 0.70
CloseMethod · 0.65
IsMethod · 0.45
LookupBytesMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…