945 Commits

Author SHA1 Message Date
Ed Page
2dd062fc9d refactor(test): Move normalize functions after use 2024-11-07 15:18:42 -06:00
Ed Page
a03adcf6e2 fix(test): Make redactions consistent with snapbox
I'm unsure how we should be replacing these use cases, so I'm exploring
keeping them but making them use snapbox under the hood.
Part of the intent of snapbox is that it provides you the building
blocks to make what you need.
2024-11-06 20:03:53 -06:00
bors
be87c96b23 Auto merge of #14785 - epage:test-unordered, r=ehuss
test(gc): Update remaining unordered tests to snapbox

### What does this PR try to resolve?

This gets rid of the last unordered tests and removes the functions from `cargo-test-support` as part of #14039

Some tests are being less specific than they were before but in talking to ehuss, it sounded like that was ok.

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

### Additional information
2024-11-06 18:06:06 +00:00
Ed Page
bfa097e5d5 fix(test)!: Remove unused with_stdout_unordered,with_stderr_unordered 2024-11-05 10:39:30 -06:00
Alexander Saites
7d6889b5d9 replace special-case duplicate handling with error 2024-11-04 18:24:36 -07:00
bors
3dedb85a25 Auto merge of #14747 - saites:rustfix-transactional, r=weihanglo
Add transactional semantics to `rustfix`

### What does this PR try to resolve?

This PR adds transactional semantics to `rustfix::Data`, enabling `rustfix::CodeFix` to apply `Suggestion`s as atomic units and rollback partially-applied changes when they conflict with existing ones. The basic approach and goals are discussed [in a comment on issue 14699](https://github.com/rust-lang/cargo/issues/14699#issuecomment-2427501232). In that comment, I proposed a solution which extended the existing `State` enumeration, but described an alternative that simplifies the overall tracking of incoming changes; this PR implements the latter.

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

I've added an additional test and updated the existing ones. The tests in `parse_and_replace` already cover this case, particularly thanks to https://github.com/rust-lang/cargo/pull/14765 added by `@weihanglo.` It's still a good idea to experiment with `cargo clippy --fix` on repos that match the cases described in these open issues.

### Additional information

Fixes #14699
Fixes rust-lang/rust-clippy/issues/13549
2024-11-02 21:45:48 +00:00
Alexander Saites
f73b1d8c74 add transactional semantics to rustfix 2024-11-02 13:01:21 -07:00
TheSlapstickDictator
9b4f03a876 chore: update handlebars to v6, fix build error
DirectorySourceOptions is marked as #[non_exhaustive], and only
exposes the Default trait, so we need to instantiate a mutable
instance using default(), and then change tpl_extension to the
value we want.
2024-11-01 14:55:20 -07:00
bors
40d6078baf Auto merge of #14765 - weihanglo:rustfix, r=epage
test(rustfix): switch to a simpler case for dedup-suggestions
2024-11-01 15:37:00 +00:00
bors
2fcc3755a3 Auto merge of #14750 - epage:normalize, r=weihanglo
fix(util): Respect all `..`s in `normalize_path`

### What does this PR try to resolve?

The fact that `normalize_path` was only designed for absolute paths bit us when working out #14497 and so I decided to make sure it worked.  The other alternative I considered was having it assert that the path was absolute.

Since I did try out the assert and Cargo tests hit it, this likely fixes something but I haven't dug through to be able to say what.

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

### Additional information
2024-11-01 02:27:41 +00:00
Weihang Lo
8aec0a40f5
test(rustfix): switch to a simpler case for dedup-suggestions
This case also emits an insert-only suggestions (span start == end),
and doesn't rely on any lint behavior.

See also

* https://github.com/rust-lang/cargo/pull/13728
* https://github.com/rust-lang/cargo/issues/13027
2024-10-31 22:05:24 -04:00
Ed Page
8a8254eb1f refactor(test): Remove dead 'expect_stdout_contains_n' check
This was missed when removing the assert
2024-10-31 15:59:16 -05:00
Weihang Lo
634450e4b6
fix: track version in fingerprint dep-info files
Encodes the version information into Cargo's fingerprint dep-info files,
so that when the format encoding changes in the future,
Cargo understands a dep-info file was outdated and doesn't bother parsing it.

Since there was no version info encoded in the old format (call it v0),
to be compatible with older cargoes,
this PR works around it with a horrible hack.
It is explained in the doc comment of `EncodedDepInfo`.
2024-10-30 18:43:30 -04:00
Ed Page
7a6eaf9667 fix(util): Respect all ..s in normalize_path 2024-10-30 14:41:47 -05:00
Ed Page
c53bdc4745 refactor(util): Clarify intent of normalize_path 2024-10-30 14:40:51 -05:00
Ed Page
1f8b294b87 test(util): Show relative path behavior for normalize_path 2024-10-30 14:04:32 -05:00
bors
28274d0a51 Auto merge of #14724 - epage:resolver, r=weihanglo
test(install): Verify 2024 edition / resolver=3 doesn't affect resolution

### What does this PR try to resolve?

I was worried there might be bugs related to this.  With this out of the way, I think we'll be ready to stabilize `resolver = "3"`.

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

### Additional information
2024-10-25 13:41:40 +00:00
bors
cf9152007e Auto merge of #14683 - dacianpascu06:355adcad7, r=epage
Added unstable-schema generation for Cargo.toml

### What does this PR try to resolve?

Added unstable-schema feature that generates JsonSchema for Cargo.toml

See #12883
finished first step of [plan](https://github.com/rust-lang/cargo/issues/12883#issuecomment-2407648385)

### Information
In cargo-util-schemas,  run cargo test --feature unstable-schema  . If there have been any changes to manifest.schema.json, rerun with env variable SNAPSHOTS=overwrite  and it will update them.

### How should we test and review this PR?
In cargo-util-schemas run cargo test --features unstable-schema and it will generate manifest.schema.json
2024-10-24 21:26:44 +00:00
dacian
21ce69ef37 feat: unstable-json-schema generation for Cargo.toml 2024-10-25 00:05:11 +03:00
Ed Page
646e29abb5 feat(test): Allow setting edition on published packages 2024-10-23 15:14:08 -05:00
Ed Page
255f622299 feat(test): Allow setting resolver on published packages 2024-10-23 14:53:46 -05:00
bors
42f41439b2 Auto merge of #14707 - x-hgg-x:sat-fixes, r=Eh2406
test: add fixes in the sat resolver

### What does this PR try to resolve?

This is a follow-up of https://github.com/rust-lang/cargo/pull/14614.

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

Commit 1 removes duplicate variables in the sat resolver.
Commit 2 removes useless clones in the sat resolver.

r? Eh2406
2024-10-22 18:17:36 +00:00
Weihang Lo
c9102e54bb
refactor(rustfix): only compute snippets when needed 2024-10-20 20:42:22 -04:00
Weihang Lo
f483dc0b95
refactor(rustfix): simplify debug print for Span 2024-10-20 20:42:22 -04:00
Weihang Lo
6ac20fd1be
refactor(rustfix): remove unnecessary indentations 2024-10-20 20:42:22 -04:00
Weihang Lo
446e3f05ba
chore(rustfix): bump to 0.8.8 2024-10-20 20:42:22 -04:00
x-hgg-x
c85d8329d0 test: Avoid needlessly cloning in the sat resolver 2024-10-19 21:57:45 +02:00
x-hgg-x
af9b2d75a5 test: Avoid creating duplicate variables in the sat resolver 2024-10-19 21:57:30 +02:00
renovate[bot]
341d619f66
chore(deps): update msrv 2024-10-19 01:35:59 -04:00
Ed Page
5b84fc99c5 feat(test): Snapshot .crate validation 2024-10-17 06:26:47 +08:00
Ed Page
5c25f7a9b8 refactor(test): Simplify handling of tar file prefixes 2024-10-17 06:26:47 +08:00
Ed Page
6d048153b3 refactor(test): Pull out new POST parsing 2024-10-17 06:26:47 +08:00
Ed Page
e52b041a4d chore(test): Bump to 0.6 2024-10-17 06:26:47 +08:00
bors
a4600184b8 Auto merge of #14668 - dacianpascu06:bump, r=epage
chore(deps): update rust crate pulldown-cmark to 0.12.0

### What does this PR try to resolve?

Closes #14667

### How should we test and review this PR?
Cargo build-man stopped giving errors after updating pulldown-cmark
### Additional information
2024-10-10 20:27:06 +00:00
dacian
54bbe02489 chore(deps): update rust crate pulldown-cmark to 0.12.0 2024-10-10 22:38:01 +03:00
x-hgg-x
3d4d48b0ff fix: use rustc-hash in the resolver 2024-10-10 20:06:31 +02:00
x-hgg-x
2579ec3d08 test: add a test showing a slow case in the resolver 2024-10-10 20:06:30 +02:00
bors
15fbd2f607 Auto merge of #14137 - Xaeroxe:checksum-freshness, r=weihanglo
initial version of checksum based freshness

Implementation for https://github.com/rust-lang/cargo/issues/14136 and resolves https://github.com/rust-lang/cargo/issues/6529

This PR implements the use of checksums in cargo fingerprints as an alternative to using mtimes. This is most useful on systems with poor mtime implementations.

This has a dependency on https://github.com/rust-lang/rust/pull/126930. It's expected this will increase the time it takes to declare a build to be fresh. Still this loss in performance may be preferable to the issues the ecosystem has had with the use of mtimes for determining freshness.
2024-10-08 21:08:11 +00:00
Jacob Kiesel
cf893c1695
test(freshness_checksum): verify cargo depinfo is properly encoded 2024-10-08 16:30:54 -04:00
x-hgg-x
dedf251c27 test: add tests from pubgrub 2024-10-08 08:06:15 +02:00
x-hgg-x
870f6d31d7 test: refactor sat resolver clauses computation
Add new intermediate boolean variables for each dependency and each dependency feature declared in a package.
This is used to simplify computation of the sat clauses.

Add support for multiple dependencies with the same name, if their kind or target is different.

A non-weak dependency feature for an optional dependency now activates a feature of the same name in the sat resolver.
2024-10-08 08:04:43 +02:00
x-hgg-x
04e4270758 test: add more resolver helper methods 2024-10-08 08:04:43 +02:00
x-hgg-x
cc4c3e784a test: separate resolver tests into multiple files 2024-10-08 08:04:43 +02:00
Ed Page
c3f19a8ec1 refactor(test): Migrate validate_upload to snapbox for json comparisons 2024-10-03 21:15:10 -05:00
Ed Page
01a47f3c4d fix(test): Remove unused, deprecated with_json 2024-10-03 21:15:10 -05:00
Ed Page
5c87c14f9a docs: Declare support level for each crate in our Charter / docs
This is to bring us into conformance with the [Rust crate ownership
policy](https://forge.rust-lang.org/policies/crate-ownership.html).

Items of note
- `cargo-credential-1password` is declared as Experimental as it is
  intended for the community but I was unsure if we wanted to commit to
  full support for it.  In my mind, the ideal thing to do would be to
  expatriate this to 1password.
- `home` is declared as Internal despite its wide use within the
  ecosystem.
- `cargo-credential` is declared as Intentional as its an API intended
  for the wider ecosystem and I didn't see a reason to declare it
  experimental.
- `cargo-platform`, `cargo-util-schemas`, and `crates-io` are declared
  as Intentional as they are both used internally and intended for
  others to use for logic that integrates with cargo/registries.
  I wondered about these being Experimental or Internal instead.
2024-09-26 12:43:09 -05:00
Ed Page
d199f2e97c chore: Bump versions 2024-09-26 12:43:09 -05:00
xzfc
0c74d2449d chore(deps): update tar to 0.4.42
The new version of tar enables the creation of sparse tar archives by
default.  The ability to read such sparse entries was added in tar
0.4.6, which has been in use starting from Cargo 0.13 and Rust 1.12.
Additionally, `docker cp` doesn't support sparse tar entries in the GNU
format.  For compatibility with older versions of Rust and Cargo, as
well as with `docker cp`, this commit disables sparse archive creation
in the corresponding cases where the `tar::Builder` is used.  See
#14594.
2024-10-02 03:27:27 +00:00
bors
2d368ed844 Auto merge of #14583 - x-hgg-x:features-sat-resolver, r=Eh2406
test: add support for features in the sat resolver

### What does this PR try to resolve?

This PR implements the first step of https://github.com/rust-lang/cargo/pull/11938#issuecomment-1868426431.

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

The first commit does some refactorings, and the second commit updates the SAT resolver.

List of boolean variables in the SAT resolver:
* One variable representing the activation of each registry package.
* One variable representing the activation of each feature of a given registry package.
* In the `sat_resolve()` method, we create an additional representing the activation of the root package.

List of clauses in the SAT resolver:
* If a package feature is activated, then the package should be activated.
* No two packages with the same links set.
* No two semver compatible versions of the same package.
* For each package:
    - For each feature:
        - If the package feature is activated and it depends of another feature of the same package, then it is also activated.
        - If the package feature is activated and it depends of a dependency, then at least one of the compatible dependency package should be activated.
        - If the package feature is activated and it depends of a feature of a dependency, then the feature of a compatible dependency package should be activated only if the compatible dependency package is activated. If this is not a weak dependency feature, then at least one of the compatible dependency package should be activated.
    - For each dependency, if the package is activated and if the dependency is non-optional or has been activated, then at least one of the compatible dependency package and its required features should be activated.
* The root package has the same dependency clauses but has no features.

List of assumptions in the SAT resolver:
* The root package is activated.
* Old root packages from previous calls to `sat_resolve()` are deactivated. This is necessary since the proptest call `sat_resolve()` several times with a different root package using the same SAT resolver, and clauses relative to the root package are not removable.
2024-09-27 21:29:29 +00:00
x-hgg-x
6f1315be84 test: add support for features in the sat resolver 2024-09-27 22:09:32 +02:00