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

Function TestFreezeRodata

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

Source from the content-addressed store, hash-verified

353}
354
355func TestFreezeRodata(t *testing.T) {
356 testutils.SkipOnOldKernel(t, "5.9", "sk_lookup program type")
357
358 file := testutils.NativeFile(t, "testdata/constants-%s.elf")
359 spec, err := LoadCollectionSpec(file)
360 if err != nil {
361 t.Fatal(err)
362 }
363
364 var obj struct {
365 Program *Program `ebpf:"freeze_rodata"`
366 }
367
368 qt.Assert(t, qt.IsNil(spec.Variables["ret"].Set(uint32(1))))
369
370 mustLoadAndAssign(t, spec, &obj, nil)
371 obj.Program.Close()
372}
373
374func TestCollectionSpecDetach(t *testing.T) {
375 coll := Collection{

Callers

nothing calls this directly

Calls 7

SkipOnOldKernelFunction · 0.92
NativeFileFunction · 0.92
LoadCollectionSpecFunction · 0.85
mustLoadAndAssignFunction · 0.85
IsNilMethod · 0.80
CloseMethod · 0.65
SetMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…