6422 Commits

Author SHA1 Message Date
Ed Page
3a615ca9c8 feat(test): Add CargoPathExt to prelude 2024-07-18 15:22:29 -05:00
Ed Page
ed56f1ec14 fix(source): Don't warn about unreferenced duplicate packages
Fixes #10752
2024-07-11 20:30:47 -05:00
Ed Page
58ee635337 fix(source): Consolidate duplicate package warnings 2024-07-11 20:30:10 -05:00
Ed Page
1a254008e4 test(git): Show unused duplicate package warning 2024-07-11 16:49:33 -05:00
Ed Page
5b9799c6f4 refactor: Migrate from extern crate to test-support prelude
We now include the prelude in so many places, this simplifies how we can
present how `cargo-test-support` works.

Yes, this included some `use` clean ups but its already painful enough
walking through every test file, I didn't want to do it twice.
2024-07-12 15:57:00 -05:00
bors
67a452bc56 Auto merge of #14245 - eth3lbert:snapbox-implicit-features, r=epage
test: migrate implicit_features to snapbox

### What does this PR try to resolve?

Part of https://github.com/rust-lang/cargo/issues/14039.

Migrate following to snapbox:

- `tests/testsuite/implicit_features.rs`
2024-07-12 19:34:11 +00:00
eth3lbert
3d2d234bb9
test: migrate implicit_features to snapbox 2024-07-13 02:30:29 +08:00
eth3lbert
04cccfa259
test: migrate build-std/main to snapbox 2024-07-12 11:56:07 +08:00
bors
0e2ef808c8 Auto merge of #14235 - eth3lbert:snapbox-check-cfg, r=epage
test: migrate check_cfg to snapbox

### What does this PR try to resolve?

Part of https://github.com/rust-lang/cargo/issues/14039.

Migrate following to snapbox:

- `tests/testsuite/check_cfg.rs`

---

This commit allow deprecation for most of the tests currently in this file. This is because the tests either use `does_not_contain` or perform multiple `contains` assertion for single tool with macro `x!`.

Here are some potential options to further eliminate the deprecation:

  1. Remove the `x!` macro and replace the it with `str![]` for both Windows and non-Windows platforms.
  2. Modify the `x!` macro to only generate the `--check-cfg` part for different platforms and manually compose it with `format!`.
2024-07-12 01:07:43 +00:00
eth3lbert
5a09fcb9f4
test: migrate check_cfg to snapbox 2024-07-11 09:38:57 +08:00
Ed Page
3dd0173850 fix(overrides): Don't warn on duplicate packages from using '..'
I was changing the "duplicate package" warning to be like:
```
[WARNING] skipping duplicate package `a2 v0.5.0 ([ROOT]/foo/b/../a)`:
  [ROOT]/foo/b/../a/a2/Cargo.toml
in favor of [ROOT]/foo/a/a2/Cargo.toml
```
and it showed that we were considering two paths to the same package to
be duplicates.

This suppresses that warning.
2024-07-10 17:06:22 -05:00
bors
17b52b0ca1 Auto merge of #14209 - dieterplex:migrate-lto-snapbox, r=weihanglo
test: Migrate lto tests to snapbox

Part of #14039.
2024-07-10 18:54:04 +00:00
d1t2
434d6d33f7
test: Migrate lto tests to snapbox 2024-07-10 12:33:23 +08:00
bors
471287ffed Auto merge of #14223 - epage:progress, r=eth3lbert
test(progress): Resolve flakiness

This is a follow up to #14181 which broke CI in #14221

```
---- progress::always_shows_progress stdout ----
running `/Users/runner/work/cargo/cargo/target/debug/cargo check`
thread 'progress::always_shows_progress' panicked at tests/testsuite/progress.rs:128:10:

---- expected: tests/testsuite/progress.rs:116:13
++++ actual:   stderr
   1    1 | [DOWNLOADING] 1 crate
   2    2 | [DOWNLOADING] 2 crates
   3    3 | [DOWNLOADING] 3 crates
   4    4 | [DOWNLOADED] 3 crates ([..]KB) in [..]s
   5      - [BUILDING] [..] 0/4: [..]
   6    5 | [BUILDING] [..] 3/4: foo
   7    6 | [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
   8    7 | ...∅

Update with SNAPSHOTS=overwrite
```
2024-07-09 22:50:44 +00:00
Ed Page
955faa1975 test(progress): Resolve flakiness
This is a follow up to #14181 which broke CI in #14221

```
---- progress::always_shows_progress stdout ----
running `/Users/runner/work/cargo/cargo/target/debug/cargo check`
thread 'progress::always_shows_progress' panicked at tests/testsuite/progress.rs:128:10:

---- expected: tests/testsuite/progress.rs:116:13
++++ actual:   stderr
   1    1 | [DOWNLOADING] 1 crate                                                                              
   2    2 | [DOWNLOADING] 2 crates                                                                             
   3    3 | [DOWNLOADING] 3 crates                                                                             
   4    4 | [DOWNLOADED] 3 crates ([..]KB) in [..]s
   5      - [BUILDING] [..] 0/4: [..]
   6    5 | [BUILDING] [..] 3/4: foo                                             
   7    6 | [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
   8    7 | ...∅

Update with SNAPSHOTS=overwrite
```
2024-07-09 15:38:44 -05:00
Ed Page
99fae9187a fix: Ensure dep/feature activates the dependency on 2024
This doesn't revert the last commit of #14018 so that it works properly
on Editions 2021 and 2024.

Fixes #14016
2024-07-09 13:51:43 -05:00
Ed Page
85cc9940af test: Show bad error for dep_name/feature_name on 2024 2024-07-09 13:43:33 -05:00
bors
519c121938 Auto merge of #14217 - eth3lbert:fix-snapbox-intodata, r=weihanglo
fix(test): Reduce over-prescription to the caller

This is a follow-up fix that addresses the suggestion made in https://github.com/rust-lang/cargo/pull/14200#discussion_r1667239028 for the remaining files.
2024-07-09 15:03:04 +00:00
eth3lbert
447ac75d3e
fix(test): Reduce over-prescription to the caller
This is a follow-up fix that addresses the suggestion made in
https://github.com/rust-lang/cargo/pull/14200#discussion_r1667239028
for the remaining files.
2024-07-09 15:25:36 +08:00
Weihang Lo
7e78271c5f
fix: rename to rustdoc::broken_intra_doc_links 2024-07-08 23:47:22 -04:00
bors
637a2cd328 Auto merge of #14210 - eth3lbert:snapbox-mmn, r=epage
test: migrate member_errors, multitarget and new to snapbox

### What does this PR try to resolve?

Part of https://github.com/rust-lang/cargo/issues/14039.

Migrate following to snapbox:

- `tests/testsuite/member_errors.rs`
- `tests/testsuite/multitarget.rs`
- `tests/testsuite/new.rs`
2024-07-09 00:56:03 +00:00
eth3lbert
c888d6513d
test: migrate new to snapbox 2024-07-09 08:03:09 +08:00
eth3lbert
a124f436bf
test: migrate multitarget to snapbox 2024-07-09 08:03:09 +08:00
bors
d1a62dfa83 Auto merge of #14200 - eth3lbert:snapbox-g, r=epage
test: migrate generate_lockfile and glob_targets to snapbox

### What does this PR try to resolve?

Part of https://github.com/rust-lang/cargo/issues/14039.

Migrate following to snapbox:

- `tests/testsuite/generate_lockfile.rs`
- `tests/testsuite/glob_targets.rs`
2024-07-08 23:39:45 +00:00
bors
1b2828a9f9 Auto merge of #14213 - epage:cmd, r=ehuss
test: Ensure --list test works with cargo-bloat

This is a follow up to #14113
2024-07-08 23:12:04 +00:00
bors
4e19f315c9 Auto merge of #14226 - eth3lbert:snapbox-test, r=epage
test: migrate test to snapbox

### What does this PR try to resolve?

Part of https://github.com/rust-lang/cargo/issues/14039.

Migrate following to snapbox:

- `tests/testsuite/test.rs`
2024-07-10 13:54:08 +00:00
tianyeyouyou
87084c176b remove duplicate words 2024-07-10 20:51:45 +08:00
eth3lbert
b3b814e713
test: migrate test to snapbox 2024-07-10 10:09:18 +08:00
Ed Page
42eb88395f test: Ensure --list test works with cargo-bloat
This is a follow up to #14113
2024-07-08 16:46:16 -05:00
Eric Huss
95e8b1cdca Fix compatible_with_older_cargo test. 2024-07-08 14:36:12 -07:00
eth3lbert
0766437804
test: migrate member_errors to snapbox 2024-07-08 14:20:54 +08:00
bors
e98f702d83 Auto merge of #14162 - eth3lbert:snapbox-m, r=weihanglo
test: migrate metabuild, metadata and net_config to snapbox

### What does this PR try to resolve?

Part of https://github.com/rust-lang/cargo/issues/14039.

Migrate following to snapbox:

- `tests/testsuite/metabuild.rs`
- `tests/testsuite/metadata.rs`
- `tests/testsuite/net_config.rs`
2024-07-07 13:50:03 +00:00
Weihang Lo
e491c06436
test: relax redaction for running ssh
`ssh` binary is not available on some platforms.

https://github.com/rust-lang-ci/rust/actions/runs/9814397548/job/27101968836#step:25:10940

```
---- git_auth::net_err_suggests_fetch_with_cli stdout ----
running `/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/cargo check -v`
running `/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/cargo check -v`
thread 'git_auth::net_err_suggests_fetch_with_cli' panicked at tests/testsuite/git_auth.rs:439:10:

---- expected: tests/testsuite/git_auth.rs:415:27
++++ actual:   stderr
   1    1 | [UPDATING] git repository `ssh://needs-proxy.invalid/git`
   2    2 | [RUNNING] `git fetch --verbose --force --update-head-ok [..]ssh://needs-proxy.invalid/git[..] [..]+HEAD:refs/remotes/origin/HEAD[..]`
   3      - ssh: Could not resolve hostname needs-proxy.invalid: [..] not known
   4      - fatal: Could not read from remote repository.
   5      -
   6      - Please make sure you have the correct access rights
   7      - and the repository exists.
        3 + [ERROR] cannot run ssh: No such file or directory
        4 + fatal: unable to fork
   8    5 | [ERROR] failed to get `foo` as a dependency of package `foo v0.0.0 ([ROOT]/foo)`
   9    6 |
  10    7 | Caused by:
  11    8 |   failed to load source for dependency `foo`
  12    9 |
          ⋮
  15   12 |
  16   13 | Caused by:
  17   14 |   failed to fetch into: [ROOT]/home/.cargo/git/db/git-[HASH]
  18   15 |
  19   16 | Caused by:
  20      -   process didn't exit successfully: `git fetch --verbose --force --update-head-ok [..]ssh://needs-proxy.invalid/git[..] [..]+HEAD:refs/remotes/origin/HEAD[..]` ([EXIT_STATUS]: 128)
       17 +   process didn't exit successfully: `git fetch --verbose --force --update-head-ok 'ssh://needs-proxy.invalid/git' '+HEAD:refs/remotes/origin/HEAD'` ([EXIT_STATUS]: 128)
```
2024-07-06 20:52:33 -04:00
Weihang Lo
2b27914659
test: relax redaction for sysroot
sysroot is different when bootstrapping rustc

```
---- expected: tests/testsuite/cfg.rs:444:27
++++ actual:   stderr
   1    1 | [ERROR] output of --print=split-debuginfo missing when learning about target-specific information from rustc
   2    2 | command was: `[ROOT]/compiler/target/debug/compiler[..]--crate-type [..]`
   3    3 |
   4    4 | --- stdout
   5    5 | ___[EXE]
   6    6 | lib___.rlib
   7    7 | [..]___.[..]
   8    8 | [..]___.[..]
   9    9 | [..]___.[..]
  10   10 | [..]___.[..]
  11      - [..]rust[..]
       11 + /checkout/obj/build/[HOST_TARGET]/stage2
  12   12 |
```

https://github.com/rust-lang-ci/rust/actions/runs/9814397548/job/27101968836#step:25:10913
2024-07-06 09:40:29 -04:00
eth3lbert
874c05be73
test: migrate glob_targets to snapbox 2024-07-06 11:28:13 +08:00
eth3lbert
abe43b7777
test: migrate generate_lockfile to snapbox 2024-07-06 11:28:13 +08:00
eth3lbert
a495ed8265
fix(test): make edition explicit in generate_lockfile
This eliminates the warning message "[WARNING] no edition set: ..." introduced in #13505.
2024-07-06 11:22:39 +08:00
bors
6d685637f1 Auto merge of #14180 - eth3lbert:snapbox-rrtw, r=epage
test: migrate serveral files to snapbox

### What does this PR try to resolve?

Part of https://github.com/rust-lang/cargo/issues/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`
2024-07-06 03:07:27 +00:00
bors
c7be9e4ddd Auto merge of #14196 - lschuermann:dev/config-include-enable-in-config, r=weihanglo
Allow enabling `config-include` feature in config

### What does this PR try to resolve?

Prior to this change, it is not possible to enable the unstable `config-include` flag from within a config file itself. This is due to the fact that, while cargo does reload configuration files if this flag is set, it does not parse the top-level configuration file's unstable flags before checking whether this flag is present.

This commit forces cargo to load unstable features before this check, and if the flag is present, re-loads configuration files with `config-include` enabled.

Addresses https://github.com/rust-lang/cargo/issues/7723#issuecomment-2206667822.

### How should we test and review this PR?

This PR adds a testcase for this behavior to cargo's testsuite. In general, it can be replicated with a config similar to that in the testcase, or as illustrated in https://github.com/rust-lang/cargo/issues/7723#issuecomment-2206667822.

### Additional information

~I'm not sure whether this is the right(TM) fix, or whether the second `self.load_unstable_flags_from_config()?;` at the bottom of `configure()` would still be required. I have a feeling it might not be, as `reload_rooted_at` also calls out to `load_unstable_flags_from_config`, to collect flags from any newly included configs. If that is not called, no other file was loaded, and thus there should not be a need to re-load unstable flags.~

Resolved: https://github.com/rust-lang/cargo/pull/14196#discussion_r1667205897
2024-07-06 01:03:00 +00:00
Leon Schuermann
0e35bea6c3 Allow enabling config-include feature in config
Prior to this change, it is not possible to enable the unstable
`config-include` flag from within a config file itself. This is due to
the fact that, while cargo does reload configuration files if this
flag is set, it does not parse the top-level configuration file's
unstable flags before checking whether this flag is present.

This commit forces cargo to load unstable features before this check,
and if the flag is present, re-loads configuration files with
`config-include` enabled.
2024-07-05 20:38:17 -04:00
Leon Schuermann
45e5cb4964 test(add): show config-include correctly merges unstable configs
Co-authored-by: Weihang Lo <me@weihanglo.tw>
2024-07-05 20:38:10 -04:00
Leon Schuermann
8bfc31f975 test(add): show config-include cannot be enabled in top-level config 2024-07-05 20:37:55 -04:00
eth3lbert
2c0014c30f
test: migrate net_config to snapbox 2024-07-06 07:25:04 +08:00
eth3lbert
692f0ffb09
test: migrate metadata to snapbox 2024-07-06 07:02:58 +08:00
eth3lbert
ad08049fdb
test: migrate metabuild to snapbox 2024-07-06 06:50:08 +08:00
eth3lbert
b11e741445
test: migrate warn_on_failure to snapbox 2024-07-06 06:45:54 +08:00
eth3lbert
68185614e2
fix(test): Restore does_not_contain for check
This is partial revert of #14185
(27062476a86e864479ef6bde1828c624b643de4b)

Although the changes made in that commit are valid, for the same reason
mentioned in the comment https://github.com/rust-lang/cargo/pull/14181#discussion_r1667089718,
"People are unlikely to see these comments when updating snapshots".
Therefore, it would be better to revert these parts.
2024-07-06 06:28:41 +08:00
eth3lbert
2d01f408ec
test: migrate tool_paths to snapbox 2024-07-06 05:25:47 +08:00
eth3lbert
8bdb52fb82
test: migrate rustdoc_extern_html to snapbox 2024-07-06 05:25:47 +08:00
eth3lbert
941b2bf1db
test: migrate read_manifest to snapbox 2024-07-06 05:25:47 +08:00