Skip to content

Add CI workflow to run the test suite - #96

Merged
varun-r-mallya merged 12 commits into
vmlinux-gen-fixfrom
ci-test-runner
Aug 30, 2026
Merged

Add CI workflow to run the test suite#96
varun-r-mallya merged 12 commits into
vmlinux-gen-fixfrom
ci-test-runner

Conversation

@varun-r-mallya

@varun-r-mallya varun-r-mallya commented Aug 30, 2026

Copy link
Copy Markdown
Member

Add CI and testing.

Runs make test on every push/PR. Kernel verifier tests need passwordless
sudo and a kernel with BTF/BPF enabled, which isn't guaranteed on every
runner, so the workflow probes for working sudo first and only attempts
them if it's available.

Also add ctypeslib2 to the test extra: make test now regenerates
vmlinux.py via tools/vmlinux-gen.py, which needs clang2py.
linux-tools-generic's update-alternatives symlink for bpftool doesn't
fire on GitHub-hosted runners, since their kernel version has no
matching linux-tools-<version> package.
pip installs the latest 'clang' release by default, whose libclang API
surface is newer than Ubuntu 24.04's apt libclang-16, causing a
LibclangError about an undefined symbol. Older bindings against a
newer libclang stay compatible, so pin the bindings low rather than
the system library.
llvmlite>=0.49's ArgumentAttributes only recognizes the LLVM 19+
'captures(none)' spelling of the renamed 'nocapture' attribute.
Ubuntu noble's default llvm/clang packages are LLVM 18, whose llc
can't parse that attribute in the emitted .ll text.
Verified on CI: LLVM 19's llc still rejects 'captures(none)' as a
parse error ('expected ) at end of argument list'). llvmlite 0.49
bundles LLVM 22.1.0 internally; match that generation instead.
Branches live in this repo, not forks, so a push to a branch with an
open PR fired both push and pull_request for the same commit. push
now only fires for master (a post-merge check); pull_request already
covers every commit on a feature branch.
@varun-r-mallya
varun-r-mallya merged commit 5bfa8e3 into vmlinux-gen-fix Aug 30, 2026
2 checks passed
varun-r-mallya added a commit that referenced this pull request Aug 30, 2026
* widen bitfields whose declared width exceeds their base type

clang2py can emit a bitfield typed as a smaller ctype than its own
declared width (e.g. a 15-bit field typed ctypes.c_ubyte, which only
has 8 bits) - ctypes rejects these with 'ValueError: number of bits
invalid for bit field'. Surfaced by struct_vmbus_channel_offer_channel
on a kernel with Hyper-V support enabled (not present locally, but
present on GitHub Actions' Azure-hosted runners).

Generalizes the existing c_bool-specific workaround to all integer
ctypes, widening to the smallest standard type that fits.

* fix ruff-format violation in vmlinux-gen.py

* Add CI workflow to run the test suite (#96)

* add CI workflow to run the test suite

Runs make test on every push/PR. Kernel verifier tests need passwordless
sudo and a kernel with BTF/BPF enabled, which isn't guaranteed on every
runner, so the workflow probes for working sudo first and only attempts
them if it's available.

Also add ctypeslib2 to the test extra: make test now regenerates
vmlinux.py via tools/vmlinux-gen.py, which needs clang2py.

* fix CI: bpftool is a virtual package on Ubuntu, install linux-tools instead

* fix CI: locate bpftool binary and add it to PATH manually

linux-tools-generic's update-alternatives symlink for bpftool doesn't
fire on GitHub-hosted runners, since their kernel version has no
matching linux-tools-<version> package.

* pin clang bindings to 16.0.6 to match Ubuntu's default libclang

pip installs the latest 'clang' release by default, whose libclang API
surface is newer than Ubuntu 24.04's apt libclang-16, causing a
LibclangError about an undefined symbol. Older bindings against a
newer libclang stay compatible, so pin the bindings low rather than
the system library.

* DEBUG: dump struct_vmbus_channel_offer_channel on test failure

* remove debug step now that the bitfield issue is fixed

* fix CI: install LLVM 19 from apt.llvm.org, Ubuntu's default is too old

llvmlite>=0.49's ArgumentAttributes only recognizes the LLVM 19+
'captures(none)' spelling of the renamed 'nocapture' attribute.
Ubuntu noble's default llvm/clang packages are LLVM 18, whose llc
can't parse that attribute in the emitted .ll text.

* DEBUG: show real llc stderr on failure

* fix YAML syntax in debug step

* fix CI: install LLVM 22 (matching llvmlite's bundled version), not 19

Verified on CI: LLVM 19's llc still rejects 'captures(none)' as a
parse error ('expected ) at end of argument list'). llvmlite 0.49
bundles LLVM 22.1.0 internally; match that generation instead.

* remove debug step, LLVM 22 fix confirmed working on CI

* avoid running CI twice per push: scope push trigger to master

Branches live in this repo, not forks, so a push to a branch with an
open PR fired both push and pull_request for the same commit. push
now only fires for master (a post-merge check); pull_request already
covers every commit on a feature branch.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant