-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Process termination test for SGX #70416
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
Merged
Merged
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
db1fbd4
Process termination tests
mzohreva 9d8f117
Ignore wasm in process termination tests
mzohreva 2e749a5
Correction: ignore emscripten in process termination tests
mzohreva 2b3adc9
Fix bind address in process-termination-blocking-io test
mzohreva File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
19 changes: 19 additions & 0 deletions
19
src/test/ui/process-termination/process-termination-blocking-io.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// program should terminate even if a thread is blocked on I/O. | ||
// https://github.com/fortanix/rust-sgx/issues/109 | ||
|
||
// run-pass | ||
// ignore-emscripten no threads support | ||
|
||
use std::{net::TcpListener, sync::mpsc, thread}; | ||
|
||
fn main() { | ||
let (tx, rx) = mpsc::channel(); | ||
thread::spawn(move || { | ||
let listen = TcpListener::bind("0:0").unwrap(); | ||
tx.send(()).unwrap(); | ||
while let Ok(_) = listen.accept() {} | ||
}); | ||
rx.recv().unwrap(); | ||
for _ in 0..3 { thread::yield_now(); } | ||
println!("Exiting main thread"); | ||
} |
13 changes: 13 additions & 0 deletions
13
src/test/ui/process-termination/process-termination-simple.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// program should terminate when std::process::exit is called from any thread | ||
|
||
// run-pass | ||
// ignore-emscripten no threads support | ||
|
||
use std::{process, thread}; | ||
|
||
fn main() { | ||
let h = thread::spawn(|| { | ||
process::exit(0); | ||
}); | ||
let _ = h.join(); | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Should probably specify
0.0.0.0:0
hereThere 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.
Thanks, fixed