std: Work around some failing 'run' tests when valgrinding. #7224
Under valgrind on 64->32 cross compiles the dynamic linker is emitting some error messages on stderr, which interferes with the tests that are checking stderr.
This commit is contained in:
@@ -915,7 +915,7 @@ priv fn waitpid(pid: pid_t) -> int {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use io;
|
use io;
|
||||||
use libc::{c_int};
|
use libc::{c_int, uintptr_t};
|
||||||
use option::{Option, None, Some};
|
use option::{Option, None, Some};
|
||||||
use os;
|
use os;
|
||||||
use path::Path;
|
use path::Path;
|
||||||
@@ -958,7 +958,10 @@ mod tests {
|
|||||||
|
|
||||||
assert_eq!(status, 0);
|
assert_eq!(status, 0);
|
||||||
assert_eq!(output_str.trim().to_owned(), ~"hello");
|
assert_eq!(output_str.trim().to_owned(), ~"hello");
|
||||||
assert_eq!(error, ~[]);
|
// FIXME #7224
|
||||||
|
if !running_on_valgrind() {
|
||||||
|
assert_eq!(error, ~[]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@@ -1043,7 +1046,10 @@ mod tests {
|
|||||||
|
|
||||||
assert_eq!(status, 0);
|
assert_eq!(status, 0);
|
||||||
assert_eq!(output_str.trim().to_owned(), ~"hello");
|
assert_eq!(output_str.trim().to_owned(), ~"hello");
|
||||||
assert_eq!(error, ~[]);
|
// FIXME #7224
|
||||||
|
if !running_on_valgrind() {
|
||||||
|
assert_eq!(error, ~[]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@@ -1057,14 +1063,20 @@ mod tests {
|
|||||||
|
|
||||||
assert_eq!(status, 0);
|
assert_eq!(status, 0);
|
||||||
assert_eq!(output_str.trim().to_owned(), ~"hello");
|
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}
|
let run::ProcessOutput {status, output, error}
|
||||||
= prog.finish_with_output();
|
= prog.finish_with_output();
|
||||||
|
|
||||||
assert_eq!(status, 0);
|
assert_eq!(status, 0);
|
||||||
assert_eq!(output, ~[]);
|
assert_eq!(output, ~[]);
|
||||||
assert_eq!(error, ~[]);
|
// FIXME #7224
|
||||||
|
if !running_on_valgrind() {
|
||||||
|
assert_eq!(error, ~[]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@@ -1169,4 +1181,12 @@ mod tests {
|
|||||||
|
|
||||||
assert!(output.contains("RUN_TEST_NEW_ENV=123"));
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
#include "sync/timer.h"
|
#include "sync/timer.h"
|
||||||
#include "sync/rust_thread.h"
|
#include "sync/rust_thread.h"
|
||||||
#include "rust_abi.h"
|
#include "rust_abi.h"
|
||||||
|
#include "vg/valgrind.h"
|
||||||
|
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
@@ -930,6 +931,11 @@ rust_begin_unwind(uintptr_t token) {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C" CDECL uintptr_t
|
||||||
|
rust_running_on_valgrind() {
|
||||||
|
return RUNNING_ON_VALGRIND;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Local Variables:
|
// Local Variables:
|
||||||
// mode: C++
|
// mode: C++
|
||||||
|
|||||||
@@ -239,3 +239,4 @@ rust_valgrind_stack_deregister
|
|||||||
rust_take_env_lock
|
rust_take_env_lock
|
||||||
rust_drop_env_lock
|
rust_drop_env_lock
|
||||||
rust_update_log_settings
|
rust_update_log_settings
|
||||||
|
rust_running_on_valgrind
|
||||||
Reference in New Issue
Block a user