Skip to content

Fix a segfault in the rustuv tests #12354

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 1 commit into from
Feb 18, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/librustuv/idle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,18 @@ mod test {

#[test] #[should_fail]
fn smoke_fail() {
// By default, the test harness is capturing our stderr output through a
// channel. This means that when we start failing and "print" our error
// message, we could be switched to running on another test. The
// IdleWatcher assumes that we're already running on the same task, so
// it can cause serious problems and internal race conditions.
//
// To fix this bug, we just set our stderr to a null writer which will
// never reschedule us, so we're guaranteed to stay on the same
// task/event loop.
use std::io;
drop(io::stdio::set_stderr(~io::util::NullWriter));

let (mut idle, _chan) = mk(1);
idle.resume();
fail!();
Expand Down
1 change: 0 additions & 1 deletion src/librustuv/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,6 @@ fn local_loop() -> &'static mut uvio::UvIoFactory {
#[cfg(test)]
mod test {
use std::cast::transmute;
use std::ptr;
use std::unstable::run_in_bare_thread;

use super::{slice_to_uv_buf, Loop};
Expand Down