(t *testing.T)
| 11 | ) |
| 12 | |
| 13 | func TestCreateStructOpsMapSpecSimple(t *testing.T) { |
| 14 | requireTestmodOps(t) |
| 15 | |
| 16 | btfSpec, err := btf.LoadKernelModuleSpec("bpf_testmod") |
| 17 | qt.Assert(t, qt.IsNil(err)) |
| 18 | |
| 19 | var outerValueType *btf.Struct |
| 20 | qt.Assert(t, qt.IsNil(btfSpec.TypeByName(structOpsValuePrefix+"bpf_testmod_ops", &outerValueType))) |
| 21 | |
| 22 | ms := &MapSpec{ |
| 23 | Name: "testmod_ops", |
| 24 | Type: StructOpsMap, |
| 25 | Flags: sys.BPF_F_LINK, |
| 26 | Key: &btf.Int{Size: 4}, |
| 27 | KeySize: 4, |
| 28 | Value: &btf.Struct{Name: "bpf_testmod_ops"}, |
| 29 | MaxEntries: 1, |
| 30 | Contents: []MapKV{ |
| 31 | { |
| 32 | Key: uint32(0), |
| 33 | Value: make([]byte, outerValueType.Size), |
| 34 | }, |
| 35 | }, |
| 36 | } |
| 37 | |
| 38 | m, err := NewMap(ms) |
| 39 | testutils.SkipIfNotSupported(t, err) |
| 40 | qt.Assert(t, qt.IsNil(err)) |
| 41 | t.Cleanup(func() { _ = m.Close() }) |
| 42 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…