-
Notifications
You must be signed in to change notification settings - Fork 165
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
tests(test/drivers): extend modern bpf test framework to all drivers (part 1) #799
Conversation
Signed-off-by: Andrea Terzolo <andrea.terzolo@polito.it>
Signed-off-by: Andrea Terzolo <andrea.terzolo@polito.it>
Signed-off-by: Andrea Terzolo <andrea.terzolo@polito.it>
Signed-off-by: Andrea Terzolo <andrea.terzolo@polito.it>
Signed-off-by: Andrea Terzolo <andrea.terzolo@polito.it>
Signed-off-by: Andrea Terzolo <andrea.terzolo@polito.it>
I added the new README :) |
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.
Left some comments; this is incredible work @Andreagit97!
Thank you very much for taking care of this!
All in all, this LGTM!
cmake -DUSE_BUNDLED_DEPS=On -DENABLE_DRIVERS_TESTS=On -DBUILD_LIBSCAP_GVISOR=Off -DCREATE_TEST_TARGETS=On .. | ||
``` | ||
|
||
In this case, only the `kmod` engine will be built and you can assert only the behavior of the kernel module. If you want to assert also the bpf probe you have to add `-DBUILD_BPF=True`, while if you want to add the modern bpf probe engine you have to use `-DBUILD_LIBSCAP_MODERN_BPF=On`. |
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.
I dream a future where:
- no driver is built by default
- we use same naming for the cmake options to enable drivers, like
DBUILD_LIBSCAP_MODERN_BPF
,DBUILD_LIBSCAP_BPF
andDBUILD_LIBSCAP_KMOD
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.
you are a dreamer my friend!
@@ -85,6 +84,13 @@ void assert_syscall_state(int syscall_state, const char* syscall_name, long sysc | |||
class event_test | |||
{ | |||
public: | |||
static scap_t* scap_handle; |
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.
Mmmh why static?
Btw can we call it s_scap_handle
?
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 is static because is shared between all class objects. Every event_test
object uses the same scap handle.
test/drivers/start_tests.cpp
Outdated
} | ||
|
||
/* We need to start the capture to calibrate socket with bpf engine */ | ||
if(scap_start_capture(event_test::scap_handle) != SCAP_SUCCESS) |
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.
I know we need this, but it makes me laugh everytime 😆
LGTM label has been added. Git tree hash: 3988ebd761248402f58ad1d31fa7883343479a77
|
Signed-off-by: Andrea Terzolo <andrea.terzolo@polito.it> Co-authored-by: Federico Di Pierro <nierro92@gmail.com>
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.
/approve
Superb job <3
LGTM label has been added. Git tree hash: 52aa1f36d16cc1a990b3d83653feefc27223918f
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: Andreagit97, FedeDP, leogr The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What type of PR is this?
/kind feature
Any specific area of the project related to this PR?
/area build
/area CI
/area tests
Does this PR require a change in the driver versions?
No
What this PR does / why we need it:
This PR is the first part of the driver's test porting phase, here you can find the full PR #783.
More in detail, this PR adds:
test/drivers
start_tests.cpp
bpf_x.cpp
test. This failure is due to the fact that now we use the scap engine instead of libpman so we have many morebpf
syscalls called by the engine.LOCAL_TEST_SUITE
toACTION_SUITE
. Here we could test generic actions like reading from the buffers.Which issue(s) this PR fixes:
Special notes for your reviewer:
Does this PR introduce a user-facing change?: