-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test: migrate serveral files to snapbox #14180
Conversation
b134964
to
f171e94
Compare
@@ -34,6 +32,7 @@ fn basic_project() -> Project { | |||
.build() | |||
} | |||
|
|||
#[allow(deprecated)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
with_stderr_does_not_contain
is being used in this function.
@@ -419,6 +450,7 @@ fn alt_sparse_registry() { | |||
assert!(gold.contains(r#"href="https://docs.rs/grimm/1.0.0/grimm/struct.Gold.html""#)); | |||
} | |||
|
|||
#[allow(deprecated)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
with_stderr_does_not_contain
is being used in this function.
tests/testsuite/warn_on_failure.rs
Outdated
.run(); | ||
} | ||
|
||
#[cargo_test] | ||
fn warning_on_lib_failure() { | ||
make_lib("err()"); | ||
make_lib("hi()"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Previously, the error message varied between local and CI environments. I've changed this to avoid the issue of "similar name exists".
https://github.com/rust-lang/cargo/actions/runs/9768426106/job/26965899179#step:7:4040
7 - --> [ROOT]/home/.cargo/registry/src/-[HASH]/bar-0.0.1/src/lib.rs:1:10
8 - |
9 - 1 | fn f() { err() }
10 - | ^^^ [HELP] a tuple variant with a similar name exists: `Err`
11 - |
12 - ::: [..]/lib/rustlib/src/rust/library/core/src/result.rs:536:5
13 - |
14 - 536 | Err(#[stable(feature = "rust1", since = "1.0.0")] E),
15 - | --- similarly named tuple variant `Err` defined here
7 + --> [ROOT]/home/.cargo/registry/src/-[HASH]/bar-0.0.1/src/lib.rs:1:10
8 + |
9 + 1 | fn f() { err() }
10 + | ^^^ [HELP] a tuple variant with a similar name exists: `Err`
11 + --> /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/core/src/result.rs:511:5
12 + |
13 + = [NOTE] similarly named tuple variant `Err` defined here
Please let me know if this change is inappropriate.
tests/testsuite/warn_on_failure.rs
Outdated
.with_status(101) | ||
.with_stdout_does_not_contain("hidden stdout") | ||
.with_stderr_does_not_contain("hidden stderr") | ||
.with_stderr_does_not_contain(&format!("[WARNING] {}", WARNING1)) | ||
.with_stderr_does_not_contain(&format!("[WARNING] {}", WARNING2)) | ||
.with_stderr_contains("[UPDATING] `[..]` index") | ||
.with_stderr_contains("[DOWNLOADED] bar v0.0.1 ([..])") | ||
.with_stderr_contains("[COMPILING] bar v0.0.1") | ||
.with_stderr_contains("[COMPILING] foo v0.0.1 ([..])") | ||
.with_stdout_data("") | ||
.with_stderr_data(str![[r#" | ||
[UPDATING] `dummy-registry` index | ||
[LOCKING] 2 packages to latest compatible versions | ||
[DOWNLOADING] crates ... | ||
[DOWNLOADED] bar v0.0.1 (registry `dummy-registry`) | ||
[COMPILING] bar v0.0.1 | ||
[COMPILING] foo v0.0.1 ([ROOT]/foo) | ||
error[E0425]: cannot find function `hi` in this scope | ||
--> src/main.rs:1:13 | ||
| | ||
1 | fn main() { hi() } | ||
| ^^ not found in this scope | ||
|
||
For more information about this error, try `rustc --explain E0425`. | ||
[ERROR] could not compile `foo` (bin "foo") due to 1 previous error | ||
|
||
"#]]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing the does_not_contain
assertion by directly comparing against the full output.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think in this case it works because if something changes and, the diff for the snapshot update will be suspicious, having "hidden" stuff showing up.
tests/testsuite/warn_on_failure.rs
Outdated
.with_status(101) | ||
.with_stdout_does_not_contain("hidden stdout") | ||
.with_stderr_does_not_contain("hidden stderr") | ||
.with_stderr_does_not_contain("[COMPILING] foo v0.0.1 ([..])") | ||
.with_stderr_contains("[UPDATING] `[..]` index") | ||
.with_stderr_contains("[DOWNLOADED] bar v0.0.1 ([..])") | ||
.with_stderr_contains("[COMPILING] bar v0.0.1") | ||
.with_stderr_contains(&format!("[WARNING] [email protected]: {}", WARNING1)) | ||
.with_stderr_contains(&format!("[WARNING] [email protected]: {}", WARNING2)) | ||
.with_stdout_data("") | ||
.with_stderr_data(str![[r#" | ||
[UPDATING] `dummy-registry` index | ||
[LOCKING] 2 packages to latest compatible versions | ||
[DOWNLOADING] crates ... | ||
[DOWNLOADED] bar v0.0.1 (registry `dummy-registry`) | ||
[COMPILING] bar v0.0.1 | ||
error[E0425]: cannot find function `hi` in this scope | ||
--> [ROOT]/home/.cargo/registry/src/-[HASH]/bar-0.0.1/src/lib.rs:1:10 | ||
| | ||
1 | fn f() { hi() } | ||
| ^^ not found in this scope | ||
|
||
For more information about this error, try `rustc --explain E0425`. | ||
The following warnings were emitted during compilation: | ||
|
||
[WARNING] [email protected]: Hello! I'm a warning. :) | ||
[WARNING] [email protected]: And one more! | ||
|
||
[ERROR] could not compile `bar` (lib) due to 1 previous error | ||
|
||
"#]]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing the does_not_contain
assertion by directly comparing against the full output.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Modify to a snapshot-aware assertion that enables auto-updating.
) | ||
.with_stderr_data(str![[r#" | ||
... | ||
[RUNNING] `rustdoc [..]--crate-name foo [..]--extern-html-root-url [..]bar=https://docs.rs/bar/1.0.0/[..]` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Glob redaction is required since its not surrounded by quotes on windows.
https://github.com/rust-lang/cargo/actions/runs/9768726905/job/26966828626#step:11:4295
1 - ...
2 - [RUNNING] `rustdoc [..]--crate-name foo [..]--extern-html-root-url 'bar=https://docs.rs/bar/1.0.0/' [..]`
[omit...]
8 + [RUNNING] `rustdoc --edition=2018 --crate-type lib --crate-name foo src/lib.rs -o [ROOT]/foo/target/doc --check-cfg cfg(docsrs) --check-cfg "cfg(feature, values())" --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat -C metadata=a7e7c9482575de28 -L dependency=[ROOT]/foo/target/debug/deps --extern bar=[ROOT]/foo/target/debug/deps/libbar-[HASH].rmeta --extern-html-root-url bar=https://docs.rs/bar/1.0.0/ -Zunstable-options --crate-version 0.1.0`
@bors r+ |
☀️ Test successful - checks-actions |
Update cargo 20 commits in a515d463427b3912ec0365d106791f88c1c14e1b..154fdac39ae9629954e19e9986fd2cf2cdd8d964 2024-07-02 20:53:36 +0000 to 2024-07-07 01:28:23 +0000 - test: relax redactions for rust-lang/rust (rust-lang/cargo#14203) - use "bootstrap" instead of "rustbuild" (rust-lang/cargo#14207) - test: migrate serveral files to snapbox (rust-lang/cargo#14180) - Add rustdocflags to Unit's Debug impl (rust-lang/cargo#14201) - Allow enabling `config-include` feature in config (rust-lang/cargo#14196) - fix(test): Restore `does_not_contain` for check (rust-lang/cargo#14198) - test: migrate patch, pkgid, proc_macro and progress to snapbox (rust-lang/cargo#14181) - test: Migrate jobserver to snapbox (rust-lang/cargo#14191) - chore(deps): update msrv (3 versions) to v1.77 (rust-lang/cargo#14186) - test: migrate build_plan and build_script to snapbox (rust-lang/cargo#14193) - test: migrate cfg and check to snapbox (rust-lang/cargo#14185) - test: migrate install* and inheritable_workspace_fields to snapbox (rust-lang/cargo#14170) - Pass rustflags to artifacts built with implicit targets when using target-applies-to-host (rust-lang/cargo#13900) - test: Migrate network tests to snapbox (rust-lang/cargo#14187) - test: migrate some files to snapbox (rust-lang/cargo#14113) - test: Auto-redact `... after last build at ...`; Migrate `freshness` to Snapbox (rust-lang/cargo#14161) - chore: fix some typos (rust-lang/cargo#14182) - fix: improve message for inactive weak optional feature with edition2024 through unused dep collection (rust-lang/cargo#14026) - test:migrate `doc/directory/docscrape` to snapbox (rust-lang/cargo#14171) - test: Migrate git_auth to snapbox (rust-lang/cargo#14172)
What does this PR try to resolve?
Part of #14039.
Migrate following to snapbox:
tests/testsuite/read_manifest.rs
tests/testsuite/rustdoc_extern_html.rs
tests/testsuite/tool_paths.rs
tests/testsuite/warn_on_failure.rs