Skip to content

Commit ecb2774

Browse files
r41k0uclaude
andcommitted
Tests: Declare the ringbuf map with its real type and a legal size
The map was declared as RingBuf, which is not an exported name -- the class is RingBuffer. maps_pass has no processor registered under RingBuf, so it fell through to the 'unknown map type, defaulting to HashMap' path and was emitted as BPF_MAP_TYPE_HASH with no key or value size. The kernel rejected it: libbpf: map 'mymap': found type = 1. libbpf: map 'mymap': failed to create: -EINVAL Nothing caught this earlier because the test framework compiles the file's AST and never imports it, so the bogus 'from pythonbpf.maps import RingBuf' never raised ImportError. Using the real name also subjects the map to process_ringbuf_map's validation, which max_entries=1024 does not survive: a ringbuf needs a power of two at least as large as the page size. Raised to 4096. libbpf now reports type = 27 with max_entries = 4096. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent a7e2bc3 commit ecb2774

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

tests/passing_tests/ringbuf.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
from pythonbpf import bpf, BPF, map, bpfglobal, section, compile, compile_to_ir
2-
from pythonbpf.maps import RingBuf, HashMap
2+
from pythonbpf.maps import RingBuffer, HashMap
33
from ctypes import c_int32, c_void_p
44

55

66
# Define a map
77
@bpf
88
@map
9-
def mymap() -> RingBuf:
10-
return RingBuf(max_entries=(1024))
9+
def mymap() -> RingBuffer:
10+
return RingBuffer(max_entries=4096)
1111

1212

1313
@bpf

0 commit comments

Comments
 (0)