|
1 |
| -use nix::fcntl::OFlag; |
2 |
| -use nix::pty::*; |
3 |
| -use nix::unistd::close; |
4 |
| -use std::os::unix::io::AsRawFd; |
| 1 | +#[cfg(not(target_os = "redox"))] |
| 2 | +mod t { |
| 3 | + use nix::fcntl::OFlag; |
| 4 | + use nix::pty::*; |
| 5 | + use nix::unistd::close; |
| 6 | + use std::os::unix::io::AsRawFd; |
5 | 7 |
|
6 |
| -/// Regression test for Issue #659 |
7 |
| -/// `PtyMaster` should panic rather than double close the file descriptor |
8 |
| -/// This must run in its own test process because it deliberately creates a race |
9 |
| -/// condition. |
10 |
| -#[test] |
11 |
| -#[should_panic(expected = "Closing an invalid file descriptor!")] |
12 |
| -// In Travis on i686-unknown-linux-musl, this test gets SIGABRT. I don't know |
13 |
| -// why. It doesn't happen on any other target, and it doesn't happen on my PC. |
14 |
| -#[cfg_attr(all(target_env = "musl", target_arch = "x86"), ignore)] |
15 |
| -fn test_double_close() { |
16 |
| - let m = posix_openpt(OFlag::O_RDWR).unwrap(); |
17 |
| - close(m.as_raw_fd()).unwrap(); |
18 |
| - drop(m); // should panic here |
| 8 | + /// Regression test for Issue #659 |
| 9 | + /// |
| 10 | + /// `PtyMaster` should panic rather than double close the file descriptor |
| 11 | + /// This must run in its own test process because it deliberately creates a |
| 12 | + /// race condition. |
| 13 | + #[test] |
| 14 | + #[should_panic(expected = "Closing an invalid file descriptor!")] |
| 15 | + // In Travis on i686-unknown-linux-musl, this test gets SIGABRT. I don't |
| 16 | + // know why. It doesn't happen on any other target, and it doesn't happen |
| 17 | + // on my PC. |
| 18 | + #[cfg_attr(all(target_env = "musl", target_arch = "x86"), ignore)] |
| 19 | + fn test_double_close() { |
| 20 | + let m = posix_openpt(OFlag::O_RDWR).unwrap(); |
| 21 | + close(m.as_raw_fd()).unwrap(); |
| 22 | + drop(m); // should panic here |
| 23 | + } |
19 | 24 | }
|
0 commit comments