Fix make test: regenerate vmlinux.py fixture and stop mis-collecting it - #95
Merged
Conversation
Prevents ctypes _fields_ assignment collisions when multiple anonymous struct/union members across different structs get the same generic '_N' name from clang2py.
- make test/test-cov/test-verifier now depend on a 'vmlinux' target that regenerates vmlinux.py from the running kernel's BTF and symlinks it into every directory under tests/, replacing the stale, duplicated vmlinux.py fixtures that used to be committed there. - collector.py now skips the 'vmlinux.py' filename when collecting BPF test cases, since it's a fixture module, not a test program - it was previously being mis-collected and compiled as a bogus test. - functions_pass.py: llvmlite >=0.49 renamed the 'nocapture' argument attribute to 'captures(none)'.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
tools/vmlinux-gen.py: disambiguate clang2py's generic anonymous-field names (_0,_1, ...) per struct/union, so promoted_anonymous_members from different structs never collide on the same key when assigned to a shared ctypes type - this was crashingimport vmlinuxwithAttributeError: type object 'c_ulong' has no attribute '_fields_'for some kernels.Makefile:test/test-cov/test-verifiernow depend on avmlinuxtarget that regenerates a single mastervmlinux.pyfrom the running kernel's BTF and symlinks it into every directory undertests/, replacing the eight stale, duplicatedvmlinux.pyfixtures that used to be committed there (they were untracked/gitignored already, just deleted from disk).tests/framework/collector.py: skip thevmlinux.pyfilename when collecting BPF test cases - it's a fixture module the test files import, not a test program, and was being mis-collected and compiled as a bogus test case (the root cause of most ofmake test's prior failures).pythonbpf/functions/functions_pass.py: llvmlite >=0.49 renamed thenocaptureargument attribute tocaptures(none).Test plan
make testpasses cleanly on a fresh venv with llvmlite installed: 117 passed, 0 failed, 11 xfailed.void *if no struct annotation is given #94 and Fix register state dump keyerror for register_state_dump test #91 (merged into master ahead of this branch) fix the two remaining pre-existing bugs this surfaced (ctxlookup inprobe_read, anonymous-union field promotion forstruct_pt_regs).