mirror of
https://github.com/facebook/sapling.git
synced 2024-10-10 08:47:12 +03:00
make tests more deterministic
Summary: One of the tests for mononoke admin (which I introduced recently) appears to be flaky. Sometimes, output from stdout (the error that terminates the program) and stderr (logs emitted while the program runs) is flipped. I suspect this is caused by buffering, so this patch flushes all output before writing the error (if there was one). An alternative approach here might be to write the final error to stderr instead of stdosut (so everything goes to stderr). That feels cleaner, but it does change the interface a little bit, so I didn't take that approach just yet. That said, if nobody objects, I'm happy to pick that approach instead. Reviewed By: farnz Differential Revision: D15146392 fbshipit-source-id: 67481afd4802cb48d24d19052988be4a83433efd
This commit is contained in:
parent
8f514219a1
commit
477670a03c
@ -1477,6 +1477,11 @@ fn main() -> Result<()> {
|
||||
let debug = matches.is_present("debug");
|
||||
|
||||
tokio::run(future.map_err(move |err| {
|
||||
// Flush so output is ordered as expected in tests. Ignore errors since there is nothing we
|
||||
// can do about them.
|
||||
let _ = std::io::stdout().flush();
|
||||
let _ = std::io::stderr().flush();
|
||||
|
||||
println!("{:?}", err);
|
||||
if debug {
|
||||
println!("\n============ DEBUG ERROR ============");
|
||||
|
Loading…
Reference in New Issue
Block a user