-
Notifications
You must be signed in to change notification settings - Fork 679
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 feature flags #681
Remove feature flags #681
Conversation
Coincidentally, I first learned of those feature flags today, too. I agree with getting rid of them. Could you also change test_signalfd.rs into a normal test file? And there are also some feature gates in test_unistd.rs and sys/test_uio.rs to remove. |
I'm working on fixing the tests but I get a "main function not found" when I "fix" things. You have this problem before? |
4cb46ad
to
4c8c94f
Compare
Nvm, figured it out. Weird we have mount and signalfd tests using a custom test harness instead of the main one. This is some old code.. |
And this needs a CHANGELOG before it can be merged, but I'm working on getting CI passing first. |
Android failures are because of missing libc items (see rust-lang/libc#671), but I'll probably just disable signalfd on android so this can be part of the current release. |
There are |
0d39c9d
to
fcc22f2
Compare
@asomers Want to take a look-see over this for me, as I think the new |
test/sys/test_signalfd.rs
Outdated
@@ -0,0 +1,52 @@ | |||
#[cfg(target_os = "linux")] |
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.
Isn't this line redundant with test/sys/mod.rs:5 ?
test/sys/test_signalfd.rs
Outdated
mask.thread_block().unwrap(); | ||
|
||
// Start a child process | ||
match unistd::fork() { |
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 don't think you should fork here. For one thing, cargo's test harness has deadlocks when a multithreaded test program forks. That's why I had to add std::process:exit(0) all over the place. For another thing, it's not necessary. You can just create the eventfd and send the signal all from the same thread, just like the old test did.
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 remember why I was doing this, because if I didn't I saw errors like "process didn't exit successfully (signal: 10)" even just running my test by itself. This is ECHILD
, which states there are no child processes. Would you have another suggestion rather than fork
ing?
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.
ECHILD
is an errno, not a signal. Signal 10, on Linux, is SIGUSR1
. It sounds like you weren't correctly blocking the signal. I can take a look at it, if you want.
test/sys/test_signalfd.rs
Outdated
|
||
// Set up a signalfd to listen for SIGUSR1 on this thread | ||
let mut mask = SigSet::empty(); | ||
mask.add(SIGUSR1); |
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.
SIGUSR1
is a global resource, so this test will conflict with any other test that does anything with it. I dealt with that in PR #638 by creating a mutex to protect SIGUSR2
. You should probably do the same for SIGUSR1
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 was going to use SIGUSR2
, but I actually think this implementation isn't quite right. According to [this](https://stackoverflow.com/questions/11679568/signal-handling-with-multiple-threads-in-linux#11679770] signal disposition is shared across all threads in a process. So I think we should actually have a SIGNAL_MTX
and not one specific to each signal.
Thanks for the review, @asomers, everything should be addressed now! Note that I b roadened the Also, I wanted to note that this includes a commit to fix unused imports introduced by you @asomers in 2cd4420. You might be running an older version of Rust that doesn't output warnings about unused variables in tests by default, which is why this was easy to miss. Might be worth updating Rust depending on your specific dev needs! |
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.
Apart from that one kill/raise typo, it all looks good to me. Fix that and r+ asomers
BTW, I submitted a PR to libc last night to support preadv/pwritev on more platforms. That can be a nix 0.10.0 addition.
test/sys/test_signalfd.rs
Outdated
// Send a SIGUSR1 signal to the current process. Note that this uses `raise` instead of `kill` | ||
// because `kill` with `getpid` isn't correct during multi-threaded execution like during a | ||
// cargo test session. Instead use `raise` which does the correct thing by default. | ||
raise(signal::SIGUSR1).ok().expect("Error: Kill Failed"); |
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.
s/Kill/raise
Note that this is now only available for Linux as support is missing in libc for Android (see rust-lang/libc#671). As part of this work the SIGUSR2 signal mutex was altered to be a general signal mutex. This is because all signal handling is shared across all threads in the Rust test harness, so if you alter one signal, depending on whether it's additive or may overwrite the mask for other signals, it could break the other ones. Instead of putting this on the user, just broaden the scope of the mutex so that any altering of signal handling needs to use it.
It was broken when enabled, and currently the libc definition is only available for windows. This will be re-added when a new libc is released that supports it across all available platforms
Cool, thanks for reviewing it! As for supporting preadv/pwritev on more platforms, can you open an issue for it? It'd be great to have more mentored/good-first-bug issues. bors r+ asomers |
681: Remove feature flags r=Susurrus These are vestiges of the initial push to get this working on Rust 1.0. These feature flags are undocumented and so hard to discover (only learned about them today!), prevent functions being included that should be and this also affects documentation on docs.rs, and none of the features are tested in CI and the `execvpe` has been broken for forever. The solution is to conditionally compile everything supported for a given platform and do away completely with the feature flags. The `execvpe` function is completely removed as it's not available for *nix platforms in libc and is already broken, so no loss removing it. We'll add it back once it's back in libc (rust-lang/libc#670). Closes #98. Closes #206. Closes #306. Closes #308.
Build failed |
We hit the |
I'm thinking it's time to deprecate powerpc to Tier 2 as you suggested, and I propose we do that for the 0.9 release so we aren't promising too much to our customers. |
I'm seeing those epoll failures on #686 as well....Hmmm. |
I'm re-running master by itself to see what's going on: https://travis-ci.org/nix-rust/nix/builds/254708956 |
bors r+ asomers |
681: Remove feature flags r=Susurrus These are vestiges of the initial push to get this working on Rust 1.0. These feature flags are undocumented and so hard to discover (only learned about them today!), prevent functions being included that should be and this also affects documentation on docs.rs, and none of the features are tested in CI and the `execvpe` has been broken for forever. The solution is to conditionally compile everything supported for a given platform and do away completely with the feature flags. The `execvpe` function is completely removed as it's not available for *nix platforms in libc and is already broken, so no loss removing it. We'll add it back once it's back in libc (rust-lang/libc#670). Closes #98. Closes #206. Closes #306. Closes #308.
Build succeeded |
These are vestiges of the initial push to get this working on Rust 1.0. These feature flags are undocumented and so hard to discover (only learned about them today!), prevent functions being included that should be and this also affects documentation on docs.rs, and none of the features are tested in CI and the
execvpe
has been broken for forever.The solution is to conditionally compile everything supported for a given platform and do away completely with the feature flags. The
execvpe
function is completely removed as it's not available for *nix platforms in libc and is already broken, so no loss removing it. We'll add it back once it's back in libc (rust-lang/libc#670).Closes #98.
Closes #206.
Closes #306.
Closes #308.