Skip to content

Commit 5e93754

Browse files
committed
Auto merge of #14124 - eth3lbert:redact-entity-not-found, r=epage
test: Add auto-redaction for not found error ### What does this PR try to resolve? This PR introduces auto-redaction for error messages related to "entity not found" across various platforms, as discussed in #14111 (comment).
2 parents e35cd55 + 91569f8 commit 5e93754

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,18 @@ static MIN_LITERAL_REDACTIONS: &[(&str, &str)] = &[
201201
("[EXE]", std::env::consts::EXE_SUFFIX),
202202
("[BROKEN_PIPE]", "Broken pipe (os error 32)"),
203203
("[BROKEN_PIPE]", "The pipe is being closed. (os error 232)"),
204+
// Unix message for an entity was not found
205+
("[NOT_FOUND]", "No such file or directory (os error 2)"),
206+
// Windows message for an entity was not found
207+
(
208+
"[NOT_FOUND]",
209+
"The system cannot find the file specified. (os error 2)",
210+
),
211+
(
212+
"[NOT_FOUND]",
213+
"The system cannot find the path specified. (os error 3)",
214+
),
215+
("[NOT_FOUND]", "program not found"),
204216
// Unix message for exit status
205217
("[EXIT_STATUS]", "exit status"),
206218
// Windows message for exit status

tests/testsuite/config_include.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
//! Tests for `include` config field.
22
33
use super::config::{assert_error, write_config_at, write_config_toml, GlobalContextBuilder};
4+
use cargo_test_support::project;
45
use cargo_test_support::str;
5-
use cargo_test_support::{no_such_file_err_msg, project};
66

77
#[cargo_test]
88
fn gated() {
@@ -162,8 +162,7 @@ Caused by:
162162
failed to read configuration file `[..]/.cargo/missing.toml`
163163
164164
Caused by:
165-
{}",
166-
no_such_file_err_msg()
165+
[NOT_FOUND]",
167166
),
168167
);
169168
}
@@ -270,8 +269,7 @@ Caused by:
270269
failed to read configuration file `[..]/foobar.toml`
271270
272271
Caused by:
273-
{}",
274-
no_such_file_err_msg()
272+
[NOT_FOUND]"
275273
),
276274
);
277275
}

0 commit comments

Comments
 (0)