Skip to content
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

Remove async feature; misc test cleanup #650

Merged
merged 5 commits into from
Jul 14, 2023
Merged

Remove async feature; misc test cleanup #650

merged 5 commits into from
Jul 14, 2023

Conversation

tamird
Copy link
Member

@tamird tamird commented Jul 13, 2023

See individual commits.

@tamird tamird requested a review from ajwerner July 13, 2023 14:55
@netlify
Copy link

netlify bot commented Jul 13, 2023

Deploy Preview for aya-rs-docs ready!

Name Link
🔨 Latest commit 8e9712a
🔍 Latest deploy log https://app.netlify.com/sites/aya-rs-docs/deploys/64b1642ed7663d0008c0dbde
😎 Deploy Preview https://deploy-preview-650--aya-rs-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Member

@ajwerner ajwerner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:LGTM:

Reviewed 9 of 9 files at r1, 2 of 2 files at r2, 5 of 5 files at r3, 3 of 3 files at r4, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @tamird)

@tamird tamird force-pushed the test-cleanup branch 6 times, most recently from 35f978f to 4a252ce Compare July 13, 2023 19:10
@tamird tamird closed this Jul 13, 2023
@tamird tamird reopened this Jul 13, 2023
@tamird tamird force-pushed the test-cleanup branch 15 times, most recently from 737eff6 to 3b81db6 Compare July 13, 2023 21:42
@tamird tamird marked this pull request as ready for review July 13, 2023 21:47
@@ -98,16 +98,17 @@ impl<T: BorrowMut<MapData> + Borrow<MapData>> AsyncPerfEventArray<T> {
index: u32,
page_count: Option<usize>,
) -> Result<AsyncPerfEventArrayBuffer<T>, PerfBufferError> {
let buf = self.perf_map.open(index, page_count)?;
let Self { perf_map } = self;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you love a destructuring don't you 😅 In this case, how is it better than just doing self.perf_map? It's the only field used and it's used only once

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I sure do! It's just an assertion that no fields have been added and don't need to be dealt with. It's a bit of paranoia that protects this code from future changes that affect semantics.

let fd = buf.as_raw_fd();
Ok(AsyncPerfEventArrayBuffer {
buf,

#[cfg(feature = "async_tokio")]
async_fd: AsyncFd::new(fd)?,
async_tokio_fd: AsyncFd::new(fd)?,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I understand - is the purpose of this change to make cargo hack
happy? This code (pre PR) is messy and I'm glad it's getting improved, but now
it'll let you compile with both features on but won't do the right thing at
runtime. I think we should compile_error or something if both features are on?

Also I'm not sure that merging the read_events implementations is an
improvement. The code seems harder to read and understand to me. Not having to
write docs twice is an improvement, but that can probably be achieved in some
other way.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can compile error, but we're in somewhat unsupported territory because mutually exclusive features aren't really a thing in cargo.

We can also do something approximating the old code: pick tokio If both are enabled.

A third option is to crash at runtime. Not clear to me what's best here.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should keep the current behaviour and use tokio when both are enabled https://doc.rust-lang.org/cargo/reference/features.html#mutually-exclusive-features

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

This feature is equivalent to async_tokio || async_std; removing it
avoids warnings emitted during `cargo hack check --feature-powerset`
where async is selected without either of the other features.

Use cargo hack to ensure clippy runs on the powerset of features.
This can cause test pollution. Create a new temp directory on each run.
Several tests were not running due to being omitted from this list.
@tamird tamird merged commit 61608e6 into main Jul 14, 2023
@tamird tamird deleted the test-cleanup branch July 14, 2023 16:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants