Skip to content

Commit 4f11565

Browse files
committed
Report duration of executed test commands
1 parent 5ec6bcd commit 4f11565

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

tests/mock/clitools.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ use std::io;
1010
use std::path::{Path, PathBuf};
1111
use std::process::Command;
1212
use std::sync::Arc;
13+
use std::time::Instant;
1314

1415
use lazy_static::lazy_static;
1516
use url::Url;
@@ -602,19 +603,23 @@ where
602603
A: AsRef<OsStr>,
603604
{
604605
let inprocess = allow_inprocess(name, args.clone());
606+
let start = Instant::now();
605607
let out = if inprocess {
606608
run_inprocess(config, name, args, env)
607609
} else {
608610
run_subprocess(config, name, args, env)
609611
};
612+
let duration = Instant::now() - start;
610613
let output = SanitizedOutput {
611614
ok: matches!(out.status, Some(0)),
612615
stdout: String::from_utf8(out.stdout).unwrap(),
613616
stderr: String::from_utf8(out.stderr).unwrap(),
614617
};
615618

619+
616620
println!("inprocess: {inprocess}");
617621
println!("status: {:?}", out.status);
622+
println!("duration: {:.3}s", duration.as_secs_f32());
618623
println!("stdout:\n====\n{}\n====\n", output.stdout);
619624
println!("stderr:\n====\n{}\n====\n", output.stderr);
620625

0 commit comments

Comments
 (0)