Commit graph

4676 commits

Author SHA1 Message Date
hi-rustin f0b5bdad65 Add test for aggressive update
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2022-08-21 17:14:07 +08:00
Weihang Lo 52a418c516
test: ignore broken but excluded file during traversing 2022-08-20 00:56:43 +01:00
hi-rustin 99b3564d0d Update old tests
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2022-08-19 10:56:29 +08:00
hi-rustin a58489dfbb Add test for aggressive update
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2022-08-17 21:53:12 +08:00
hi-rustin f95deaafeb Warning when precise or aggressive without -p flag
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2022-08-17 21:53:07 +08:00
bors 9809f8ff33 Auto merge of #10944 - kcrimson-ar:master, r=epage
Improve error message for an array value in the manifest

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

The error message will be:

```
error: failed to parse manifest at `/Users/..`

Caused by:
  invalid type: string "Ky", expected an array for key `package.authors`
```
2022-08-16 22:10:06 +00:00
bors 34cba461f2 Auto merge of #10930 - ehuss:enable-windows-tests, r=weihanglo
Enable two windows tests

These two tests were disabled on Windows a long time ago. AFAICT, the reasons are no longer relevant, and it should be safe to enable these tests. See each commit for a more detailed exposition.
2022-08-11 22:30:26 +00:00
bors 1ac43cf649 Auto merge of #10968 - hi-rustin:rustin-patch-msg, r=ehuss
Improve error msg for get target runner

Actually, we'll get this config from three places. So this msg may be confusing when you set it up in `.cargo/config.toml` or pass it by `--config`.
We already printed the location of the config, so I think it's OK to change it to `configurations`.
2022-08-11 03:23:09 +00:00
hi-rustin 6bb4050552 Fix test
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2022-08-10 23:19:35 +08:00
bors 1fcbca84ee Auto merge of #10961 - Nemo157:skip-implicit-override, r=epage
Only override published resolver when the workspace is different

### What does this PR try to resolve?

Ensures when publishing a package that uses an implicit `resolver = "1"` to maintain an MSRV before the `resolver` key was stabilized the implicitness is retained rather than being turned into an explicit setting.

fixes #10954 (assuming that the workspace and its packages are configured with a consistent resolver)
2022-08-10 14:30:11 +00:00
Wim Looman 492358a19f
Only override published resolver when the workspace is different 2022-08-10 09:26:50 +02:00
Josh Triplett 934e79072a Only show advice to use cargo update --precise for non-local packages
Packages in the local workspace can't get updated this way; the user
just needs to point to a different source, or otherwise update the
package themselves.
2022-08-08 10:37:15 -07:00
Josh Triplett dcbb433340 Make the rust-version error recommend cargo update -p crate@ver --precise ...
People encountering a dependency with a newer `rust-version` requirement
may not know about `cargo update --precise`, or may consider alternate
approaches that may be harmful (such as pinning with a `=` dependency).

Provide specific guidance in the error message.

If the user is using `cargo install`, suggest `cargo install --locked` instead.
2022-08-08 10:37:15 -07:00
Ky Phan 8f1a75d584 Add unit test for invalid authors, refactor name 2022-08-08 22:05:43 +07:00
bors 7259757dc6 Auto merge of #10322 - eholk:reserved-windows-name, r=ehuss
Test if reserved filenames are allowed in Windows

Recent versions of Windows have removed the limitation on filenames like `aux` or `con`. This change allows the `package::reserved_windows_name` to still pass by first trying to create a file with a reserved name to see if Windows supports it. If so, it skips the rest of the test. Otherwise, we keep the same behavior as before.
2022-08-04 00:32:49 +00:00
Eric Holk e9c7544c19 Move Windows path test function to test code 2022-08-03 15:59:59 -07:00
Eric Holk f122dbbd41 Use GetFullPathNameW to test restricted names
The previous commit tests whether the current machine supports Windows
restricted names by creating a file and checking whether that succeeds.
This commit reworks this testto use GetFullPathNameW, which can be done
without having to create and remove new files.
2022-08-03 15:59:58 -07:00
Eric Holk 0adcc183bc Test if reserved filenames are allowed in Windows
Recent versions of Windows have removed the limitation on filenames like
`aux` or `con`. This change allows the `package::reserved_windows_name`
to still pass by first trying to create a file with a reserved name to
see if Windows supports it. If so, it skips the rest of the test.
Otherwise, we keep the same behavior as before.
2022-08-03 15:59:58 -07:00
akabinds 222d90b78e test checking full stderr output, with new message, resulting from a "did you mean" 2022-08-03 11:38:41 -05:00
akabinds 8f5f2ed2a2 implement test checking if stderr, after using +toolchain, contains message stating that the directive is not handled by Cargo 2022-08-03 11:07:17 -05:00
akabinds 13776d2c59 Merge branch 'master' of https://github.com/rust-lang/cargo into better-no-such-subcommand 2022-08-03 10:53:47 -05:00
akabinds b1829b8dbd Merge branch 'master' of https://github.com/rust-lang/cargo into better-no-such-subcommand 2022-08-03 10:17:56 -05:00
Eric Huss 8bf7b8b89b Revert "Drop check for mingw32-make."
This reverts commit 8e35e2f044.
2022-08-03 06:59:35 -07:00
bors 333478d0aa Auto merge of #10929 - ehuss:ignore-reason, r=weihanglo
Add reasons to all ignored tests.

This adds a reason string to all `#[ignore]` attributes. This will be displayed when running the test (since 1.61), which can help quickly see and identify why tests are being ignored. It looks roughly like:

```
test basic ... ignored, requires nightly, CARGO_RUN_BUILD_STD_TESTS must be set
test build::simple_terminal_width ... ignored, --diagnostic-width is stabilized in 1.64
test check_cfg::features_with_cargo_check ... ignored, --check-cfg is unstable
test plugins::panic_abort_plugins ... ignored, requires rustc_private
```
2022-08-03 03:54:05 +00:00
binds adf5441b7a
Merge branch 'master' into better-no-such-subcommand 2022-08-02 20:47:20 -07:00
lucas 02e606d799 Grammar fixup unused patch message 2022-08-03 02:22:50 +01:00
akabinds 5f3ded124f stop mixing of newlines and \n in tests 2022-08-02 19:43:16 -05:00
akabinds 42df87409b fix formatting 2022-08-02 18:27:36 -05:00
akabinds b2f44de83d implemented requested changes; tests pass 2022-08-02 18:23:55 -05:00
Eric Huss c0be32b5de Re-enable version_works_without_rustc on windows.
This test was ignored in https://github.com/rust-lang/cargo/pull/3189
without much discussion of explaining why.

AFAICT, this test works fine on Windows on both MSVC and GNU.
Empty paths do the expected behavior (preventing cargo from running
rustc). There are some special rules on Windows about discovering the
process to run (such as searching the app's launch directory), but
I do not think that is relevant here. Confirmed by trying to run
`cargo check` in this test fails to find `rustc`.
2022-08-02 12:54:16 -07:00
Eric Huss 01747aa145 Re-enable killing_cargo_releases_the_lock on windows.
AFAICT, we do not test on these older platforms anymore.
Regardless, the test seems to work fine on 32-bit windows-gnu
on Windows 10.

See https://github.com/rust-lang/cargo/pull/3102#issuecomment-260815269
where it was originally disabled.
2022-08-02 12:30:42 -07:00
Eric Huss 7eb007ddbf Add reasons to all ignored tests. 2022-08-02 12:24:00 -07:00
akabinds ba3de81017 Merge branch 'better-no-such-subcommand' of https://github.com/akabinds/cargo into better-no-such-subcommand 2022-08-02 13:01:36 -05:00
akabinds b55e8d47a9 implemented requested changes; fixed one failing test (need to fix other) 2022-08-02 13:01:32 -05:00
bors 0fb9e85e45 Auto merge of #10918 - ehuss:fix-formats_source, r=Eh2406
Fix formats_source test requiring rustfmt.

The requirements added in #9892 that `rustfmt` must be present doesn't work in the `rust-lang/rust` environment. There are two issues:

* Cargo is run without using rustup. If you also have rustup installed, the test will fail because the `rustfmt` binary found in `PATH` will fail to choose a toolchain because HOME points to the sandbox home which does not have a rustup configuration.
* rust-lang/rust CI uninstalls rustup, and does not have rustfmt in PATH at all.  It is not practical to make rustfmt available there.

The solution here is to just revert the behavior back to where it was where it checks if it can run `rustfmt` in the sandbox. This should work for anyone who has a normal rustup installation (including Cargo's CI). If running the testsuite without rustup, then the test will be skipped.

This also includes a small enhancement to provide better error information when rustfmt fails.
2022-08-02 14:41:51 +00:00
Eric Huss e8d92919cf Disable scrape_examples_complex_reverse_dependencies 2022-08-02 06:57:34 -07:00
Eric Huss 15f9c2dc06 Fix formats_source test requiring rustfmt. 2022-08-01 21:07:19 -07:00
bors 223e84a981 Auto merge of #10844 - yerke:yerke/negative_jobs, r=ehuss
Support for negative --jobs parameter, counting backwards from max CPUs

Fixes #9217.

Continuation of https://github.com/rust-lang/cargo/pull/9221.
2022-08-01 03:41:10 +00:00
Yerkebulan Tulibergenov 767368fd02 Merge branch 'master' into yerke/negative_jobs 2022-07-31 18:21:33 -07:00
Eric Huss 8e35e2f044 Drop check for mingw32-make.
From what I can tell, it is no longer necessary on GitHub Actions.
This removes it to help simplify things.
2022-07-31 16:06:25 -07:00
Eric Huss bcf982cf24 Add missing requires_git requirements. 2022-07-31 15:19:17 -07:00
Eric Huss 9d43ffc02a Remove CARGO_TEST_DISABLE_GIT_CLI
This appears to no longer be necessary since we have migrated to
GitHub Actions.
2022-07-30 19:36:58 -07:00
Eric Huss 1c3640e05c Add requirements to cargo_test. 2022-07-30 19:36:58 -07:00
Wim Looman d953c3b2d7
Override to resolver=1 in published package 2022-07-29 16:03:05 +02:00
Ed Page 5789c12e45 fix(add): Update the lock file
This is done in the command, rather than in the op,
- To consistently construct the `Workspace`
- It is more composable as an API

A downside is we update the git dependencies a second time.

We are not rolling back on error.
- For some errors, the user might want to debug what went wrong
- Rollback adds its own complications and risks, including since its
  non-atomic

Fixes #10901
2022-07-26 14:59:07 -05:00
Ed Page 323c7bc306 test(add): Make test data valid
Resolving the manifests will fail due to inconsistencies.  This
addresses those.
2022-07-25 11:06:12 -05:00
Ed Page b5c4a765ef fix(add): Respect --locked
This is prep for #10901 to avoid the most common failure case for the
lock file.  We are assuming if the users action caused a change in the
manifes, then it will cause a change in the lock file.  This isn't
entirely true but close enough and I think these semantics can make
sense.
2022-07-25 09:52:00 -05:00
Eric Huss 8a487abedd Make the empty rustc-wrapper test more explicit. 2022-07-24 13:10:35 -07:00
Scott Schafer 2c810afda9 Stabilize workspace inheritance 2022-07-23 09:36:49 -05:00
Eric Huss cde8f6f692
Merge branch 'master' into stabilize-crate-type 2022-07-17 13:14:44 -07:00