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

Function TestProgramName

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

Source from the content-addressed store, hash-verified

480}
481
482func TestProgramName(t *testing.T) {
483 testutils.SkipIfNotSupported(t, haveObjName())
484
485 prog := mustNewProgram(t, &ProgramSpec{
486 Name: "test*123",
487 Type: SocketFilter,
488 Instructions: asm.Instructions{
489 asm.LoadImm(asm.R0, 1, asm.DWord),
490 asm.Return(),
491 },
492 License: "MIT",
493 }, nil)
494
495 var info sys.ProgInfo
496 if err := sys.ObjInfo(prog.fd, &info); err != nil {
497 t.Fatal(err)
498 }
499
500 name := unix.ByteSliceToString(info.Name[:])
501 qt.Assert(t, qt.Equals(name, "test123"))
502}
503
504func TestProgramCloneNil(t *testing.T) {
505 p, err := (*Program)(nil).Clone()

Callers

nothing calls this directly

Calls 6

SkipIfNotSupportedFunction · 0.92
LoadImmFunction · 0.92
ReturnFunction · 0.92
ObjInfoFunction · 0.92
ByteSliceToStringFunction · 0.92
mustNewProgramFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…