Skip to content

std: Remove msvc/valgrind headers #27339

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
Jul 29, 2015
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
2 changes: 0 additions & 2 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,4 @@
*.rs rust
src/etc/pkg/rust-logo.ico binary
src/etc/pkg/rust-logo.png binary
src/rt/msvc/* -whitespace
src/rt/valgrind/* -whitespace
*.woff binary
13 changes: 2 additions & 11 deletions src/libstd/process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,6 @@ mod tests {
use io::prelude::*;

use io::ErrorKind;
use rt::running_on_valgrind;
use str;
use super::{Command, Output, Stdio};

Expand Down Expand Up @@ -737,10 +736,7 @@ mod tests {

assert!(status.success());
assert_eq!(output_str.trim().to_string(), "hello");
// FIXME #7224
if !running_on_valgrind() {
assert_eq!(stderr, Vec::new());
}
assert_eq!(stderr, Vec::new());
}

#[cfg(not(target_os="android"))]
Expand Down Expand Up @@ -779,10 +775,7 @@ mod tests {

assert!(status.success());
assert_eq!(output_str.trim().to_string(), "hello");
// FIXME #7224
if !running_on_valgrind() {
assert_eq!(stderr, Vec::new());
}
assert_eq!(stderr, Vec::new());
}

#[cfg(all(unix, not(target_os="android")))]
Expand All @@ -807,7 +800,6 @@ mod tests {
#[test]
fn test_inherit_env() {
use std::env;
if running_on_valgrind() { return; }

let result = env_cmd().output().unwrap();
let output = String::from_utf8(result.stdout).unwrap();
Expand All @@ -824,7 +816,6 @@ mod tests {
#[test]
fn test_inherit_env() {
use std::env;
if running_on_valgrind() { return; }

let mut result = env_cmd().output().unwrap();
let output = String::from_utf8(result.stdout).unwrap();
Expand Down
2 changes: 1 addition & 1 deletion src/libstd/rt/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use sys;
use usize;

// Reexport some of our utilities which are expected by other crates.
pub use self::util::{min_stack, running_on_valgrind};
pub use self::util::min_stack;
pub use self::unwind::{begin_unwind, begin_unwind_fmt};

// Reexport some functionality from liballoc.
Expand Down
32 changes: 0 additions & 32 deletions src/libstd/rt/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,38 +16,6 @@ use intrinsics;
use sync::atomic::{self, Ordering};
use sys::stdio::Stderr;

/// Dynamically inquire about whether we're running under V.
/// You should usually not use this unless your test definitely
/// can't run correctly un-altered. Valgrind is there to help
/// you notice weirdness in normal, un-doctored code paths!
pub fn running_on_valgrind() -> bool {
return on_valgrind();
#[cfg(windows)]
fn on_valgrind() -> bool { false }

#[cfg(unix)]
fn on_valgrind() -> bool {
use libc::uintptr_t;
extern {
fn rust_running_on_valgrind() -> uintptr_t;
}
unsafe { rust_running_on_valgrind() != 0 }
}
}

/// Valgrind has a fixed-sized array (size around 2000) of segment descriptors
/// wired into it; this is a hard limit and requires rebuilding valgrind if you
/// want to go beyond it. Normally this is not a problem, but in some tests, we
/// produce a lot of threads casually. Making lots of threads alone might not
/// be a problem _either_, except on OSX, the segments produced for new threads
/// _take a while_ to get reclaimed by the OS. Combined with the fact that libuv
/// schedulers fork off a separate thread for polling fsevents on OSX, we get a
/// perfect storm of creating "too many mappings" for valgrind to handle when
/// running certain stress tests in the runtime.
pub fn limit_thread_creation_due_to_osx_and_valgrind() -> bool {
(cfg!(target_os="macos")) && running_on_valgrind()
}

pub fn min_stack() -> usize {
static MIN: atomic::AtomicUsize = atomic::AtomicUsize::new(0);
match MIN.load(Ordering::SeqCst) {
Expand Down
9 changes: 1 addition & 8 deletions src/libtest/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
#![feature(fnbox)]
#![feature(iter_cmp)]
#![feature(libc)]
#![feature(rt)]
#![feature(rustc_private)]
#![feature(set_stdio)]
#![feature(staged_api)]
Expand Down Expand Up @@ -879,13 +878,7 @@ fn get_concurrency() -> usize {
_ => panic!("RUST_TEST_THREADS is `{}`, should be a positive integer.", s)
}
}
Err(..) => {
if std::rt::util::limit_thread_creation_due_to_osx_and_valgrind() {
1
} else {
num_cpus()
}
}
Err(..) => num_cpus(),
};

#[cfg(windows)]
Expand Down
Loading