Skip to content

Commit 7fcd580

Browse files
committed
fix(test): Redact elapsed time in the minutes time frame
This came up in #14231 ``` ---- expected: tests/testsuite/lto.rs:611:27 ++++ actual: stderr 1 1 | [FRESH] registry-shared v0.0.1 2 2 | [FRESH] registry v0.0.1 3 3 | [COMPILING] bar v0.0.0 ([ROOT]/foo/bar) 4 4 | [RUNNING] `rustc --crate-name bar [..]-C lto [..]--test [..]` 5 5 | [RUNNING] `rustc --crate-name b [..]-C lto [..]--test [..]` 6 - [FINISHED] `release` profile [optimized] target(s) in [ELAPSED]s 7 6 | [RUNNING] `[ROOT]/foo/target/release/deps/bar-[HASH][EXE]` 8 7 | [RUNNING] `[ROOT]/foo/target/release/deps/b-[HASH][EXE]` 9 8 | [DOCTEST] bar 10 9 | [RUNNING] `rustdoc --edition=2015 --crate-type cdylib --crate-type rlib --crate-name bar --test [..]-C lto [..] 10 + [FINISHED] `release` profile [optimized] target(s) in 1m 00s Update with SNAPSHOTS=overwrite ```
1 parent 5ed6392 commit 7fcd580

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

crates/cargo-test-support/src/compare.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -161,19 +161,19 @@ fn add_regex_redactions(subs: &mut snapbox::Redactions) {
161161
// For e2e tests
162162
subs.insert(
163163
"[ELAPSED]",
164-
regex!(r"\[FINISHED\].*in (?<redacted>[0-9]+(\.[0-9]+))s"),
164+
regex!(r"\[FINISHED\].*in (?<redacted>[0-9]+(\.[0-9]+)?(m [0-9]+)?)s"),
165165
)
166166
.unwrap();
167167
// for UI tests
168168
subs.insert(
169169
"[ELAPSED]",
170-
regex!(r"Finished.*in (?<redacted>[0-9]+(\.[0-9]+))s"),
170+
regex!(r"Finished.*in (?<redacted>[0-9]+(\.[0-9]+)?(m [0-9]+)?)s"),
171171
)
172172
.unwrap();
173173
// output from libtest
174174
subs.insert(
175175
"[ELAPSED]",
176-
regex!(r"; finished in (?<redacted>[0-9]+(\.[0-9]+))s"),
176+
regex!(r"; finished in (?<redacted>[0-9]+(\.[0-9]+)?(m [0-9]+)?)s"),
177177
)
178178
.unwrap();
179179
subs.insert(
@@ -976,7 +976,7 @@ B", false,
976976
);
977977
assert_data_eq!(
978978
subs.redact("[FINISHED] `release` profile [optimized] target(s) in 1m 05s"),
979-
str!["[FINISHED] `release` profile [optimized] target(s) in 1m 05s"].raw()
979+
str!["[FINISHED] `release` profile [optimized] target(s) in [ELAPSED]s"].raw()
980980
);
981981
}
982982
}

0 commit comments

Comments
 (0)