-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
runtime test suite #35
Comments
I'll paste some commands I've run to test various things in development. These can be put in the runtime test suite:
I'll keep adding here when I remember. |
Maybe we should mark this as priority to help us identify regressions like #103 sooner? Also, it would be nice to have a CI for the project :) |
Yeah, I'd thought about making this priority. And please file a separate ticket for CI. I'll keep adding one-liners here for the runtime test. Just something basic that can run a bunch of one-liners and see if they fail would be great. bcc has a test suite for running tools, I haven't looked into it to see if that's the same approach we want. I suppose each one-liner can end with 'interval:ms:50 { exit(); }', to ensure it exits quickly. |
More one-liners:
|
Should it run with the other tests or separated? The test suite takes about 20s to run.
|
I think it should have it's own separate way of running the tests as these new ones will require root and probably won't work in the CI |
The /tests currently test parsing and BPF code generation, but does not test tracing functionality at runtime (actually running bpftrace and tracing an event). This is necessary to ensure everything actually works. It's a little tricky, as any given event (kprobe, tracepoint, etc) may or may not fire on its own, and may need to be triggered by the test suite.
I could imagine using the tracepoint:syscalls:sys_exit_nanosleep event as much as possible, as it's a stable API and can be easily triggered (from the shell:
sleep 1
).Here's a very basic hacky example:
The idea of spawning a "sleep 1" and a "sleep 15" is to allow the test to complete quickly (sleep 1), but if bpftrace was slow to initialize, then there is a 15 second timeout (or shorter, since prior tests that complete in 1 second leave 15 second sleepers still running).
Running these produces the output
So the output says "SUCCESS" or "FAILURE", the name of the test, and some argument to aid debugging.
I think it would be better to write this in C++, or C, or Perl, or Python, and have better control over the sleeps.
The functionality that should be tested should be everything from the reference guide.
The text was updated successfully, but these errors were encountered: