diff --git a/src/libstd/run.rs b/src/libstd/run.rs index b204cf6cfb04..7a96bf35218b 100644 --- a/src/libstd/run.rs +++ b/src/libstd/run.rs @@ -915,7 +915,7 @@ priv fn waitpid(pid: pid_t) -> int { #[cfg(test)] mod tests { use io; - use libc::{c_int}; + use libc::{c_int, uintptr_t}; use option::{Option, None, Some}; use os; use path::Path; @@ -958,7 +958,10 @@ mod tests { assert_eq!(status, 0); assert_eq!(output_str.trim().to_owned(), ~"hello"); - assert_eq!(error, ~[]); + // FIXME #7224 + if !running_on_valgrind() { + assert_eq!(error, ~[]); + } } #[test] @@ -1043,7 +1046,10 @@ mod tests { assert_eq!(status, 0); assert_eq!(output_str.trim().to_owned(), ~"hello"); - assert_eq!(error, ~[]); + // FIXME #7224 + if !running_on_valgrind() { + assert_eq!(error, ~[]); + } } #[test] @@ -1057,14 +1063,20 @@ mod tests { assert_eq!(status, 0); assert_eq!(output_str.trim().to_owned(), ~"hello"); - assert_eq!(error, ~[]); + // FIXME #7224 + if !running_on_valgrind() { + assert_eq!(error, ~[]); + } let run::ProcessOutput {status, output, error} = prog.finish_with_output(); assert_eq!(status, 0); assert_eq!(output, ~[]); - assert_eq!(error, ~[]); + // FIXME #7224 + if !running_on_valgrind() { + assert_eq!(error, ~[]); + } } #[test] @@ -1169,4 +1181,12 @@ mod tests { assert!(output.contains("RUN_TEST_NEW_ENV=123")); } + + fn running_on_valgrind() -> bool { + unsafe { rust_running_on_valgrind() != 0 } + } + + extern { + fn rust_running_on_valgrind() -> uintptr_t; + } } diff --git a/src/rt/rust_builtin.cpp b/src/rt/rust_builtin.cpp index 5e7357c9b7b2..3bd5e09e0073 100644 --- a/src/rt/rust_builtin.cpp +++ b/src/rt/rust_builtin.cpp @@ -17,6 +17,7 @@ #include "sync/timer.h" #include "sync/rust_thread.h" #include "rust_abi.h" +#include "vg/valgrind.h" #include @@ -930,6 +931,11 @@ rust_begin_unwind(uintptr_t token) { #endif } +extern "C" CDECL uintptr_t +rust_running_on_valgrind() { + return RUNNING_ON_VALGRIND; +} + // // Local Variables: // mode: C++ diff --git a/src/rt/rustrt.def.in b/src/rt/rustrt.def.in index e3e522aa7cee..ba7ada04a275 100644 --- a/src/rt/rustrt.def.in +++ b/src/rt/rustrt.def.in @@ -239,3 +239,4 @@ rust_valgrind_stack_deregister rust_take_env_lock rust_drop_env_lock rust_update_log_settings +rust_running_on_valgrind \ No newline at end of file