6610 Commits

Author SHA1 Message Date
eth3lbert
f9026f1884
test: migrate messages to snapbox 2024-07-26 23:26:48 +08:00
Ed Page
96a5897e91 test: Migrate another 'test' json test
Rather than blocking on assert-rs/snapbox#351, we can get away with
`--no-run` for what this test is covering.
2024-07-24 16:34:22 -05:00
bors
a7917fdc3a Auto merge of #14250 - linyihai:update-breaking-prerelease, r=weihanglo
Don't downgrade on prerelease `VersionReq` when update with --breaking.

### What does this PR try to resolve?
Do nothing with prerelease when update with `--breaking`.

Fixes https://github.com/rust-lang/cargo/issues/14178

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

Previous commit add a test, next commit to fix and update.

### Additional information
2024-07-24 19:09:05 +00:00
Ed Page
3085b548ec test: Migrate json install doc to snapbox 2024-07-24 10:42:51 -05:00
Ed Page
65577954ce test: Migrate to pretty jsonlines for bad_manifest_path tests 2024-07-24 10:42:51 -05:00
Ed Page
98c21a666d test: Migrate to pretty jsonlines for binary_name tests 2024-07-24 10:42:51 -05:00
Ed Page
810afa26cb test: Migrate to pretty jsonlines for bench tests 2024-07-24 10:42:51 -05:00
Ed Page
48ca095d19 test: Migrate json install tests to snapbox 2024-07-24 10:42:51 -05:00
Ed Page
cbb3222959 test: Migrate some json test tests to snapbox 2024-07-24 10:42:51 -05:00
Ed Page
ee2d6ccb69 test: Migrate json pkgid tests to snapbox 2024-07-24 10:42:51 -05:00
Ed Page
bb5488c9a0 tests: Update for snapbox deprecations 2024-07-24 10:42:50 -05:00
bors
ca330a26df Auto merge of #14295 - epage:revert, r=weihanglo
Revert "fix: Ensure dep/feature activates the dependency on 2024"

### What does this PR try to resolve?

Fixes #14283 by re-opening #14016 so we don't block people testing other Edition 2024 changes.

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

This reverts commit 99fae9187ac0bae12a03585083169e34dc7a197d.

I initially held off on reverting in case we quickly had a clear direction to go.  Since we're still doing some investigation, I decided to move forward with this.

### Additional information
2024-07-24 13:50:55 +00:00
Ed Page
407a32c11c Revert "fix: Ensure dep/feature activates the dependency on 2024"
Fixes #14283 by re-opening #14016 so we don't block people testing other
Edition 2024 changes.

This reverts commit 99fae9187ac0bae12a03585083169e34dc7a197d.
2024-07-24 08:00:27 -05:00
Joe Neeman
a2f0a9e7d6 Adds support for packaging workspaces.
Takes local dependencies into account when packaging a workspace. Builds
a temporary package registry to provide local dependencies, and overlays
it on the upstream registry.

This adds `--registry` and `--index` flags to `cargo package`. They act
much like the same arguments to `cargo publish`, except that of course
we are not actually publishing to the specified registry. Instead, these
arguments affect lock-file generation for intra-workspace dependencies:
when simultaneously packaging a crate and one of its dependencies, the
lock-file will be generated under the assumption that the dependency
will be published to the specified registry.

Co-Authored-By: Tor Hovland <55164+torhovland@users.noreply.github.com>
2024-07-24 16:36:30 +07:00
Joe Neeman
cbc836d4b0 Add tests showing incorrect workspace packaging.
Co-Authored-By: Tor Hovland <55164+torhovland@users.noreply.github.com>
2024-07-24 16:03:51 +07:00
Lin Yihai
9e2701aedb fix: Don't downgrade with update --breaking if VersionReq is prerelease 2024-07-23 14:38:36 +08:00
Lin Yihai
89b0119772 test: Add test about update --breaking on prerelease 2024-07-23 14:38:36 +08:00
bors
8a8b99f06d Auto merge of #14279 - tweag:improved-error-message-invalid-spec-update-breaking, r=weihanglo
Improved error message when `update --breaking` invalid spec.

Improves an error message when trying to do `cargo update --breaking clap@foo`:

```
- [ERROR] expected a version like "1.32"
+ [ERROR] invalid package ID specification: `clap@foo`
+ Caused by:
+   expected a version like "1.32"
```

Related to #12425. Fixes an item [here](https://github.com/rust-lang/cargo/issues/12425#issuecomment-2186198258), as noted [here](https://github.com/rust-lang/cargo/pull/14049#discussion_r1656929921).
2024-07-22 18:40:20 +00:00
bors
693d49c3a1 Auto merge of #14282 - linyihai:fix-test, r=epage
test: Fix some test based on rustc version

### What does this PR try to resolve?

Some test ouput specifies the latest rustc version and will failed when the rustc version get updated

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

### Additional information
2024-07-22 14:38:38 +00:00
Lin Yihai
68e91bec19 test: Remove additional test output 2024-07-22 16:03:41 +08:00
Lin Yihai
363ddd4f58 test: The latest rustc version should not appear in the test output 2024-07-22 15:58:25 +08:00
Tor Hovland
57622d7939 fix: Improved error message when update --breaking invalid spec. 2024-07-21 10:06:15 +02:00
Ed Page
b0e515aa61 fix(test): Move 'cargo_home' from 'install' to 'paths'
This is used outside of `cargo install` contexts and this makes it more
discoverable for those use cases.
2024-07-19 10:50:42 -05:00
Ifropc
1abaa88012
feat: add lockfile-path flag for all requested commands
- All commands that support `manifest-path` (except `locate-project`, `verify-project` and `read-manifest`)
2024-07-19 08:05:48 -07:00
Ed Page
a49921f829 fix(test)!: Clarify extension trait role with rename
When browsing the docs, I feel like this will make it easier to tell the
role of these traits within the API.
Or in other words, I can easily tell that these fill a support role and
for what, so I know when I care to look into them.

We use this naming pattern for
`cargo_test_support::paths::CargoPathExt`.
2024-07-18 20:52:22 -05:00
bors
f10c069629 Auto merge of #14266 - epage:path2url, r=weihanglo
fix(test): Move path2url to CargoPathExt::to_url

### What does this PR try to resolve?

This is a small step, like #14243, to improve the clarity of `cargo-test-support`s API.

Overall, I'm trying to make it more obvious on https://docs.rs/cargo-test-support/latest/cargo_test_support/ which items to reach for when.  I figured this is one that could be demoted to `paths` When doing so, I noticed `CargoPathExt`. I figured if we had any extension traits for `Path`, then this is a
reasonable one to add.

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

### Additional information
2024-07-18 20:57:05 +00:00
Ed Page
d17322dccb fix(test): Move path2url to CargoPathExt::to_url
I was considering moving this into `paths` and noticed `CargoPathExt`.
I figured if we had any extension traits for `Path`, then this is a
reasonable one to add.
2024-07-18 15:41:26 -05:00
Ed Page
3a615ca9c8 feat(test): Add CargoPathExt to prelude 2024-07-18 15:22:29 -05:00
bors
61424d6040 Auto merge of #14205 - gmorenz:links_overrides_in_unit, r=weihanglo
Fix passing of links-overrides with target-applies-to-host and an implicit target

### What does this PR try to resolve?

This fixes the link-overrides half of #14195, both the panic, and the fact that the field is being discarded, the latter of which caused the former as discussed in [the issue](https://github.com/rust-lang/cargo/issues/14195#issuecomment-2211481773).

It does so following the blueprint laid out in #13900 - which is also in my opinion the current best summary of the broader context.

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

For reviewing, comparing to the changes in #13900 might be useful.

### Additional information

I'm pushing a PR for the other half of #14195 simultaneously. I thought it better to keep the PRs small since they're independent, though if merged simultaneously there will be a conflict over the ordering of fields in `Unit`.
2024-07-18 17:16:35 +00:00
bors
913d4b85e3 Auto merge of #14261 - epage:error, r=weihanglo
fix(toml): Improve error on missing package and workspace

That the error was confused was brought up in #13904
2024-07-17 22:01:29 +00:00
Ed Page
0ccafcace9 fix(toml): Improve error on missing package and workspace
That the error was confused was brought up in #13904
2024-07-17 15:52:37 -05:00
Ifropc
dc1519d0d7
feat: add new lockfile-path for metadata
- Also add necessary tests for the new flag
2024-07-17 04:56:51 -07:00
d1t2
86862738d7
test: Migrate global_cache_tracker to snapbox 2024-07-16 23:07:09 +08:00
Greg Morenz
9098072ee3 Store links_overrides in Unit 2024-07-16 10:05:33 -04:00
Greg Morenz
76381aa81b Add test verifying behavior of links_overrides with target-applies-to-host and an implicit target 2024-07-16 10:05:33 -04:00
bors
7b227dee2c Auto merge of #14214 - eth3lbert:snapbox-fetch-n-la, r=weihanglo
test: migrate fetch and list_availables 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/fetch.rs`
- `tests/testsuite/list_availables.rs`
2024-07-15 20:18:29 +00:00
eth3lbert
16a2dbd2ba
refactor(test): make list_availables snapshot-aware 2024-07-14 04:09:34 +08:00
eth3lbert
b43ea97f3b
test: migrate list_availables to snapbox 2024-07-14 04:09:32 +08:00
eth3lbert
7a6bf16153
test: migrate fetch to snapbox 2024-07-14 04:07:54 +08: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
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
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
Ed Page
1a254008e4 test(git): Show unused duplicate package warning 2024-07-11 16:49:33 -05: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