Compare commits

...

6 Commits

Author SHA1 Message Date
Lawrence Chou
550c4e31e5
Merge 3f807228d8 into 9441b91186 2024-06-28 21:45:31 +08:00
bors
9441b91186 Auto merge of #14159 - dieterplex:migrate-git-snapbox, r=weihanglo
test: Migrate git to snapbox

Part of #14039.

There is a case need to modify regex for file size redaction.
2024-06-28 13:05:10 +00:00
d1t2
32cdb261ef
test: Migrate git to snapbox 2024-06-28 17:39:24 +08:00
Lawrence Chou
3f807228d8
test(freshness): migrate to snapbox 2024-06-28 00:11:53 +08:00
Lawrence Chou
10cd3ca3e9
Auto-redact dirty reason like 1719325877.527949100s, 61549498ns after last build at 1719325877.466399602s
7dcf764cbc/src/cargo/core/compiler/fingerprint/dirty_reason.rs (L131)
2024-06-28 00:01:17 +08:00
d1t2
ed027736e7
test: Allow redact file size w/o fraction
`cargo clean` shows file size without fraction in summary when the size
is lower than 1024. And we need to avoid matching things like `%2B%23..`
found in other test cases, the trailing `\s` is added to regex.
2024-06-27 16:58:52 +08:00
3 changed files with 1307 additions and 1050 deletions

View File

@ -171,7 +171,7 @@ fn add_common_redactions(subs: &mut snapbox::Redactions) {
.unwrap();
subs.insert(
"[FILE_SIZE]",
regex!(r"(?<redacted>[0-9]+(\.[0-9]+)([a-zA-Z]i)?)B"),
regex!(r"(?<redacted>[0-9]+(\.[0-9]+)?([a-zA-Z]i)?)B\s"),
)
.unwrap();
subs.insert(
@ -200,6 +200,27 @@ fn add_common_redactions(subs: &mut snapbox::Redactions) {
regex!(r"ns/iter \(\+/- (?<redacted>[0-9]+(\.[0-9]+)?)\)"),
)
.unwrap();
// Following 3 subs redact:
// "1719325877.527949100s, 61549498ns after last build at 1719325877.466399602s"
// "1719503592.218193216s, 1h 1s after last build at 1719499991.982681034s"
// into "[DIRTY_REASON_NEW_TIME], [DIRTY_REASON_DIFF] after last build at [DIRTY_REASON_OLD_TIME]"
// The ordering of these 3 subs matters.
subs.insert(
"[DIRTY_REASON_NEW_TIME]",
regex!(r"(?<redacted>[0-9]+(\.[0-9]+)?s), (\s?[0-9]+(\.[0-9]+)?(s|ns|h))+ after last build at ([0-9]+(\.[0-9]+)?s)"),
)
.unwrap();
subs.insert(
"[DIRTY_REASON_DIFF]",
regex!(r"\[\w+\], (?<redacted>(\s?[0-9]+(\.[0-9]+)?(s|ns|h))+) after last build at ([0-9]+(\.[0-9]+)?s)"),
)
.unwrap();
subs.insert(
"[DIRTY_REASON_OLD_TIME]",
regex!(r"\[\w+\], \[\w+\] after last build at (?<redacted>[0-9]+(\.[0-9]+)?s)"),
)
.unwrap();
}
static MIN_LITERAL_REDACTIONS: &[(&str, &str)] = &[

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff