ebpf-verifier
ebpf-verifier copied to clipboard
Add EbpfTransformer Catch2 test suite
Summary
- add helpers in the transformer test fixture to construct program info for alternate platforms and to scope map descriptor mutations
- extend the transformer Catch2 suite with map-load/map-lookup/callx scenarios and with stack writable-argument and packet-reallocation call semantics
Testing
- cmake --build build --target tests
- ./tests "[transformer]"
https://chatgpt.com/codex/tasks/task_e_68c897a330288329bd41b7fed0dbb44a
Summary by CodeRabbit
- New Features
- No user-facing changes.
- Tests
- Added extensive test coverage for the eBPF transformer, spanning arithmetic, pointer/stack behavior, bitwise and shift operations, endianness, assumptions, packet and map interactions, subprogram calls, and memory round-trips. Improves reliability and guards against regressions.
- Chores
- Enabled the new tests in the build pipeline.
Walkthrough
Adds a new eBPF transformer test suite, wires it into the build when tests are enabled, and exposes internal state of EbpfDomain to tests via a forward declaration and friend class.
Changes
| Cohort / File(s) | Summary of edits |
|---|---|
Build/Test wiringCMakeLists.txt |
Includes test_ebpf_transformer.cpp in the test sources within the VERIFIER_ENABLE_TESTS block. |
Domain test accesssrc/crab/ebpf_domain.hpp |
Adds forward declaration class EbpfDomainInspector; and friend class EbpfDomainInspector; inside EbpfDomain. |
New eBPF transformer testssrc/test/test_ebpf_transformer.cpp |
Introduces comprehensive tests covering arithmetic, bitwise, shifts, pointer/stack semantics, endianness, assumptions, packets, maps (incl. maps of maps, program arrays), calls/subprograms, and helper dispatch, along with test utilities and inspectors. |
Estimated code review effort
🎯 4 (Complex) | ⏱️ ~60 minutes
Pre-merge checks and finishing touches
❌ Failed checks (1 warning)
| Check name | Status | Explanation | Resolution |
|---|---|---|---|
| Docstring Coverage | ⚠️ Warning | Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. | You can run @coderabbitai generate docstrings to improve docstring coverage. |
✅ Passed checks (2 passed)
| Check name | Status | Explanation |
|---|---|---|
| Description Check | ✅ Passed | Check skipped - CodeRabbit’s high-level summary is enabled. |
| Title Check | ✅ Passed | The title "Add EbpfTransformer Catch2 test suite" succinctly and accurately summarizes the PR's primary change: adding a Catch2-based test suite for the eBPF transformer and integrating it into the build. It is specific to the main intent and avoids unnecessary detail such as file lists or internal implementation. A reviewer scanning project history will understand the PR focus from this title. |
✨ Finishing touches
- [ ] 📝 Generate Docstrings
🧪 Generate unit tests
- [ ] Create PR with unit tests
- [ ] Post copyable unit tests in a comment
- [ ] Commit unit tests in branch
codex/add-catch2-test-suite-for-ebpftransformer
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands and usage tips.
Pull Request Test Coverage Report for Build 17776994019
Details
- 545 of 545 (100.0%) changed or added relevant lines in 1 file are covered.
- No unchanged relevant lines lost coverage.
- Overall first build on codex/add-catch2-test-suite-for-ebpftransformer at 88.796%
| Totals | |
|---|---|
| Change from base Build 17748859600: | 88.8% |
| Covered Lines: | 9114 |
| Relevant Lines: | 10264 |