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

Function TestLoadInvalidMap

elf_reader_test.go:403–421  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

401}
402
403func TestLoadInvalidMap(t *testing.T) {
404 file := testutils.NativeFile(t, "testdata/invalid_map-%s.elf")
405 cs, err := LoadCollectionSpec(file)
406 if err != nil {
407 t.Fatal("Can't load CollectionSpec", err)
408 }
409
410 ms, ok := cs.Maps["invalid_map"]
411 if !ok {
412 t.Fatal("invalid_map not found in CollectionSpec")
413 }
414
415 m, err := NewMap(ms)
416 t.Log(err)
417 if err == nil {
418 m.Close()
419 t.Fatal("Creating a Map from a MapSpec with non-zero Extra is expected to fail.")
420 }
421}
422
423func TestLoadInvalidMapMissingSymbol(t *testing.T) {
424 file := testutils.NativeFile(t, "testdata/invalid_map_static-%s.elf")

Callers

nothing calls this directly

Calls 4

CloseMethod · 0.95
NativeFileFunction · 0.92
LoadCollectionSpecFunction · 0.85
NewMapFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…