Skip to content

Commit 4eeebce

Browse files
qmonnetanakryiko
authored andcommitted
selftests/bpf: Fix parsing of prog types in UAPI hdr for bpftool sync
The script for checking that various lists of types in bpftool remain in sync with the UAPI BPF header uses a regex to parse enum bpf_prog_type. If this enum contains a set of values different from the list of program types in bpftool, it complains. This script should have reported the addition, some time ago, of the new BPF_PROG_TYPE_SYSCALL, which was not reported to bpftool's program types list. It failed to do so, because it failed to parse that new type from the enum. This is because the new value, in the BPF header, has an explicative comment on the same line, and the regex does not support that. Let's update the script to support parsing enum values when they have comments on the same line. Signed-off-by: Quentin Monnet <[email protected]> Signed-off-by: Andrii Nakryiko <[email protected]> Link: https://lore.kernel.org/bpf/[email protected]
1 parent fc843cc commit 4eeebce

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tools/testing/selftests/bpf/test_bpftool_synctypes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ def get_enum(self, enum_name):
180180
@enum_name: name of the enum to parse
181181
"""
182182
start_marker = re.compile(f'enum {enum_name} {{\n')
183-
pattern = re.compile('^\s*(BPF_\w+),?$')
183+
pattern = re.compile('^\s*(BPF_\w+),?(\s+/\*.*\*/)?$')
184184
end_marker = re.compile('^};')
185185
parser = BlockParser(self.reader)
186186
parser.search_block(start_marker)

0 commit comments

Comments
 (0)