Closed Phantomical closed 2 years ago
This looks good - thank you! I fixed the docs, too.
Just as an aside - I noticed that the simple_build
test fails when run under a VM since hardware events are not available. You could probably get cargo test --tests
to work in CI by changing it to use a software event.
I have some plans to add a mock testing framework so we should be able to exercise everything in GitHub CI. That's what the "hooks" feature is for. With that we should be able to get very thorough coverage, including weird cases, despite being a very system-interaction-heavy crate.
Although - mocking doesn't help when the bug was that you misunderstood what the platform is doing, so that wouldn't help in this particular case
It looks like in the past this was not valid (see issue #4) but since this was last changed things seem to have changed and now the sys bindings for perf_event_open use libc::syscall which returns the error in errno.
This commit replaces the check_raw_syscall calls around perf_event_open with check_errno_syscall. This means that check_raw_syscall is no longer used so it has been deleted. I have also includes a test case to verify that the correct error code is returned in at least one case.
Fixes #18