forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#62183 - alexcrichton:fix-tests, r=nikomatsakis
std: Move a process test out of libstd This commit moves a test out of libstd which is causing deadlocks on musl on CI. Looks like the recent update in musl versions brings in some internal updates to musl which makes `setgid` and `setuid` invalid to call after a `fork` in a multithreaded program. The issue seen here is that the child thread was attempting to grab a lock held by a nonexistent thread, meaning that the child process simply deadlocked causing the whole test to deadlock. This commit moves the test to its own file with no threads which should work.
- Loading branch information
Showing
2 changed files
with
26 additions
and
27 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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,26 @@ | ||
#![feature(rustc_private)] | ||
|
||
fn main() { | ||
#[cfg(unix)] | ||
run() | ||
} | ||
|
||
#[cfg(unix)] | ||
fn run() { | ||
extern crate libc; | ||
use std::process::Command; | ||
use std::os::unix::prelude::*; | ||
|
||
let mut p = Command::new("/bin/sh") | ||
.arg("-c").arg("true") | ||
.uid(unsafe { libc::getuid() }) | ||
.gid(unsafe { libc::getgid() }) | ||
.spawn().unwrap(); | ||
assert!(p.wait().unwrap().success()); | ||
|
||
// if we're already root, this isn't a valid test. Most of the bots run | ||
// as non-root though (android is an exception). | ||
if unsafe { libc::getuid() != 0 } { | ||
assert!(Command::new("/bin/ls").uid(0).gid(0).spawn().is_err()); | ||
} | ||
} |