Implement the output dropping for windows, too
This commit is contained in:
parent
4d4855c762
commit
1d0fe1b6bb
@ -291,6 +291,9 @@ pub struct Evaluator<'mir, 'tcx> {
|
|||||||
|
|
||||||
/// Failure rate of compare_exchange_weak, between 0.0 and 1.0
|
/// Failure rate of compare_exchange_weak, between 0.0 and 1.0
|
||||||
pub(crate) cmpxchg_weak_failure_rate: f64,
|
pub(crate) cmpxchg_weak_failure_rate: f64,
|
||||||
|
|
||||||
|
/// Corresponds to -Zmiri-drop-stdout-stderr and doesn't write the output but acts as if it succeeded.
|
||||||
|
pub(crate) drop_stdout_stderr: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'mir, 'tcx> Evaluator<'mir, 'tcx> {
|
impl<'mir, 'tcx> Evaluator<'mir, 'tcx> {
|
||||||
@ -344,6 +347,7 @@ impl<'mir, 'tcx> Evaluator<'mir, 'tcx> {
|
|||||||
tracked_alloc_ids: config.tracked_alloc_ids.clone(),
|
tracked_alloc_ids: config.tracked_alloc_ids.clone(),
|
||||||
check_alignment: config.check_alignment,
|
check_alignment: config.check_alignment,
|
||||||
cmpxchg_weak_failure_rate: config.cmpxchg_weak_failure_rate,
|
cmpxchg_weak_failure_rate: config.cmpxchg_weak_failure_rate,
|
||||||
|
drop_stdout_stderr: config.drop_stdout_stderr,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,7 +75,9 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
|
|||||||
use std::io::{self, Write};
|
use std::io::{self, Write};
|
||||||
|
|
||||||
let buf_cont = this.read_bytes_ptr(buf, Size::from_bytes(u64::from(n)))?;
|
let buf_cont = this.read_bytes_ptr(buf, Size::from_bytes(u64::from(n)))?;
|
||||||
let res = if handle == -11 {
|
let res = if this.machine.drop_stdout_stderr {
|
||||||
|
Ok(buf_cont.len())
|
||||||
|
} else if handle == -11 {
|
||||||
io::stdout().write(buf_cont)
|
io::stdout().write(buf_cont)
|
||||||
} else {
|
} else {
|
||||||
io::stderr().write(buf_cont)
|
io::stderr().write(buf_cont)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user