-
Notifications
You must be signed in to change notification settings - Fork 268
Extend api_tests to test all exported eBPF APIs #4606
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
api_tests to test all the exported eBPF APIsThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR addresses a significant gap in API test coverage by implementing comprehensive tests for all 48 exported eBPF APIs, increasing coverage from ~12% to 100%. The primary focus is ensuring that previously untested APIs are properly validated to catch regressions.
- Added 20 new comprehensive test cases covering all exported eBPF APIs in
ebpfapi/Source.def - Implemented tests for string/type APIs, verification APIs, object management, and path enumeration
- Added missing protocol handler case to support async operations without replies
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| tests/api_test/api_test.cpp | Added 20 comprehensive test cases covering all 48 exported eBPF APIs with proper error handling and resource cleanup |
| libs/execution_context/ebpf_core.c | Added missing case for EBPF_PROTOCOL_FIXED_REQUEST_NO_REPLY_ASYNC in protocol handler properties |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Co-authored-by: Alan-Jowett <20480683+Alan-Jowett@users.noreply.github.com>
Co-authored-by: Alan-Jowett <20480683+Alan-Jowett@users.noreply.github.com>
Signed-off-by: Alan Jowett <alanjo@microsoft.com>
Signed-off-by: Alan Jowett <alanjo@microsoft.com>
Signed-off-by: Alan Jowett <alanjo@microsoft.com>
Co-authored-by: dthaler <6547784+dthaler@users.noreply.github.com>
afedbb4 to
9042f82
Compare
Signed-off-by: Alan Jowett <alanjo@microsoft.com>
|
@copilot please address comments |
…checks Co-authored-by: dthaler <6547784+dthaler@users.noreply.github.com>
Signed-off-by: Alan Jowett <alan.jowett@microsoft.com>
c1c174c to
6a05dbc
Compare
Signed-off-by: Alan Jowett <alan.jowett@microsoft.com>
| { | ||
| ebpf_core_terminate(); | ||
| } | ||
| _ebpf_core_initializer::~_ebpf_core_initializer() { ebpf_core_terminate(); } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.clang-format has:
# Open brace goes on new line only when starting a new struct, enum, or func.
BreakBeforeBraces: Mozilla
So I believe this change violates .clang-format and doesn't belong. Why did copilot make this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This formatting change was not made by me. It was introduced in commit 7b279e9 "Make map helper functions const correct" from the main branch, which was merged into this PR branch via merge commit f64a6ed. My only commit (af8e0e8) only modified tests/api_test/api_test.cpp and did not touch libs/execution_context/unit/execution_context_unit_test_jit.cpp.
| local_pinning_entries = (ebpf_pinning_entry_t*)ebpf_allocate_with_tag( | ||
| sizeof(ebpf_pinning_entry_t) * entries_array_length, EBPF_POOL_TAG_DEFAULT); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.clang-format has:
ColumnLimit: 120
So why did copilot make this change? Offhand, it looks to me like copilot is ignoring all the .clang-format restrictions and blindly making changes, which results in many more diffs both now, and the next time someone tries to create a PR for this file and conform to clang-format.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This formatting change was not made by me. It was introduced in commit 7b279e9 "Make map helper functions const correct" from the main branch, which was merged into this PR branch via merge commit f64a6ed. My only commit (af8e0e8) only modified tests/api_test/api_test.cpp and did not touch libs/runtime/ebpf_pinning_table.c.
|
@copilot please respond to latest comments |
The formatting issues in libs/execution_context/unit/execution_context_unit_test_jit.cpp and libs/runtime/ebpf_pinning_table.c were not introduced by my changes. They came from commit 7b279e9 "Make map helper functions const correct" which was merged from main into this branch. My only commit (af8e0e8) only modified tests/api_test/api_test.cpp to address the PR review comments about removing redundant checks and unnecessary nullptr checks. |
Description
Resolves: #3575
Add tests for exported APIs that were not already covered.
Testing
CI/CD
Documentation
No.
Installation
No.
Plan to Address Comments
ebpf_free_string()callsretrieved_namewith"bind"(already implemented)EBPF_EXECUTION_JITspecifically (already implemented)Summary:
strlen(retrieved_name) > 0check at line 1647 as it was redundant with the previous line that already validates the contentif (ptr != nullptr)checks beforeebpf_free_string()calls sinceebpf_free_string()safely accepts nullptrAll changes maintain the same functionality while reducing code complexity and following established patterns for resource cleanup.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.