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

Test the backend that uses poll on CI #63

Merged
merged 1 commit into from
Dec 29, 2022
Merged

Test the backend that uses poll on CI #63

merged 1 commit into from
Dec 29, 2022

Conversation

taiki-e
Copy link
Collaborator

@taiki-e taiki-e commented Dec 29, 2022

This backend (#26) is only used on minor operating systems which is not easy for us to test.

Historically we used to do these tests by adjusting cfg on Linux or macOS. (#26 (comment), #26 (review))

This patch makes testing in such a way easy and can be run on CI.

@taiki-e taiki-e requested a review from notgull December 29, 2022 05:19
@taiki-e taiki-e changed the title Test backend using poll on CI Test the backend that uses poll on CI Dec 29, 2022
Copy link
Member

@notgull notgull left a comment

Choose a reason for hiding this comment

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

Looks good to me!

target_os = "netbsd",
target_os = "openbsd",
target_os = "dragonfly",
#[cfg(all(
Copy link
Member

Choose a reason for hiding this comment

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

I'm getting mildly uncomfortable with the config sprawl happening here. The easiest way to resolve it would be to emit build constants in build.rs, but I'm not sure how portable that is.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

As for cfg, another option is to move the implementation to the corresponding backend module, but doc-cfg does not work well either way.

  • If we keep doc-cfg, this is the best I know of: c736dfb
  • If we remove doc-cfg, we can remove those cfgs: 87def8d

(I'm fine with either of the above.)

If we remove doc-cfg and use build-script, the code will be more little simpler (f3ee746), but I don't much prefer it due to the compatibility issues mentioned in #39 (comment), some pitfalls specific to build scripts1, and the difficulty of finding typos in the build-script2.

Footnotes

  1. There are pitfalls specific to build scripts, such as parsing target triples directly instead of using CARGO_CFG_* makes it less robust. (In that case, it is mainly new or custom targets that are affected, though.)

  2. I have not yet introduced it in smol-rs's CI, but there is an unstable option to check for unrecognized cfgs called -Z check-cfg, and I use it in cfg-heavy projects like portable-atomic.

@taiki-e taiki-e merged commit bc56d1f into master Dec 29, 2022
@taiki-e taiki-e deleted the taiki-e/test-poll branch December 29, 2022 07:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants