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

Function TestMapBatchUnprivileged

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

Source from the content-addressed store, hash-verified

203}
204
205func TestMapBatchUnprivileged(t *testing.T) {
206 arr := createMap(t, Array, 4)
207 hash := createMap(t, Hash, 4)
208
209 keys := []uint32{0, 1}
210 values := []uint32{42, 4242}
211 qt.Assert(t, qt.IsNil(hash.Update(keys[0], values[0], UpdateAny)))
212 qt.Assert(t, qt.IsNil(hash.Update(keys[1], values[1], UpdateAny)))
213
214 testutils.WithCapabilities(t, nil, func() {
215 tmp := make([]uint32, 2)
216
217 var cursor MapBatchCursor
218 _, err := arr.BatchLookup(&cursor, tmp, tmp, nil)
219 testutils.SkipIfNotSupported(t, err)
220 qt.Assert(t, qt.IsNil(err))
221
222 count, err := arr.BatchUpdate(keys, values, nil)
223 testutils.SkipIfNotSupported(t, err)
224 qt.Assert(t, qt.IsNil(err))
225 qt.Assert(t, qt.Equals(count, len(keys)))
226
227 count, err = hash.BatchDelete(keys, nil)
228 testutils.SkipIfNotSupported(t, err)
229 qt.Assert(t, qt.IsNil(err))
230 qt.Assert(t, qt.Equals(count, len(keys)))
231 })
232}
233
234func TestMapBatchCursorReuse(t *testing.T) {
235 arr1 := createMap(t, Array, 4)

Callers

nothing calls this directly

Calls 8

WithCapabilitiesFunction · 0.92
SkipIfNotSupportedFunction · 0.92
IsNilMethod · 0.80
BatchLookupMethod · 0.80
BatchUpdateMethod · 0.80
BatchDeleteMethod · 0.80
createMapFunction · 0.70
UpdateMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…