Skip to content
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: relax bad_crate_type to only match error message prefix #14990

Merged
merged 1 commit into from
Dec 29, 2024

Conversation

jieyouxu
Copy link
Member

What does this PR try to resolve?

This PR relaxes the bad_crate_type test to have it only match the prefix of the unknown crate type error message emitted by rustc.

This is so that the cargo test isn't sensitive to (future) suggestions for known crate types that rustc may emit to help the user.

How should we test and review this PR?

This test should already be run as part of cargo CI. (This is definitely run as part of rust-lang/rust CI, lol.)

Additional information

rust-lang/rust side PR that's trying to add a suffix to the bad crate type error message to list all valid --crate-type values: rust-lang/rust#134720.

Without relaxing this test, the rust-lang/rust side PR fails with:

rust-lang/rust CI fail message

(Ignore the missing colon after unknown crate type)

---- bad_config::bad_crate_type stdout ----
running `/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/cargo build -v`
thread 'bad_config::bad_crate_type' panicked at src/tools/cargo/tests/testsuite/bad_config.rs:434:10:

---- expected: tests/testsuite/bad_config.rs:424:27
++++ actual:   stderr
   1    1 | [ERROR] failed to run `rustc` to learn about crate-type bad_type information
   2    2 | 
   3    3 | Caused by:
   4    4 |   process didn't exit successfully: `rustc - --crate-name ___ --print=file-names --crate-type bad_type` ([EXIT_STATUS]: 1)
   5    5 |   --- stderr
   6      -   [ERROR] unknown crate type: `bad_type`
Error:      6 +   [ERROR] unknown crate type `bad_type`, expected one of: `bin`, `cdylib`, `dylib`, `lib`, `proc-macro`, `rlib`
   7    7 | 

Discussed at https://rust-lang.zulipchat.com/#narrow/channel/246057-t-cargo/topic/Reblessing.20a.20cargo.20test.

So that the cargo test isn't sensitive to suggestions for known crate
types that a rustc PR <rust-lang/rust#134720> is
trying to add.
@rustbot
Copy link
Collaborator

rustbot commented Dec 29, 2024

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @ehuss (or someone else) some time within the next two weeks.

Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (S-waiting-on-review and S-waiting-on-author) stays updated, invoking these commands when appropriate:

  • @rustbot author: the review is finished, PR author should check the comments and take action accordingly
  • @rustbot review: the author is ready for a review, this PR will be queued again in the reviewer's queue

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Dec 29, 2024
@jieyouxu
Copy link
Member Author

r? @weihanglo (sorry forgot to r/?)

Copy link
Member

@weihanglo weihanglo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@weihanglo weihanglo enabled auto-merge December 29, 2024 20:35
@weihanglo weihanglo added this pull request to the merge queue Dec 29, 2024
Merged via the queue into rust-lang:master with commit d0342d3 Dec 29, 2024
20 checks passed
@jieyouxu jieyouxu deleted the relax-crate-type-test branch December 29, 2024 21:38
bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 31, 2024
Update cargo

5 commits in c86f4b3a1b153218e6e50861214b0b4b4e695f23..d73d2caf9e41a39daf2a8d6ce60ec80bf354d2a7
2024-12-24 17:49:48 +0000 to 2024-12-31 20:51:21 +0000
- fix(package): warn if symlinks checked out as plain text files (rust-lang/cargo#14994)
- test: track caller for `.crate` file publish verification (rust-lang/cargo#14992)
- test: relax panic output assertion (rust-lang/cargo#14989)
- test: relax `bad_crate_type` to only match error message prefix (rust-lang/cargo#14990)
- refactor(package): split `cargo_package` to modules (rust-lang/cargo#14982)

r? ghost
@rustbot rustbot added this to the 1.85.0 milestone Jan 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants