84 Commits

Author SHA1 Message Date
Ed Page
3a615ca9c8 feat(test): Add CargoPathExt to prelude 2024-07-18 15:22:29 -05:00
Scott Schafer
d0804f833c
test: Resolve bench deprecations 2024-06-12 13:31:55 -06:00
Ed Page
dc5ac62cab fix(test): Deprecate non-snapbox assertions
While this is noisy and hides other deprecations, I figured deprecations would
make it easier for people to discover what tasks remain and allow us to
divide and conquer this work rather than doing a heroic PR.
In theory, this will be short lived and we'll go back to seeing
deprecations in our tests.
2024-06-10 10:20:52 -05:00
Greg Morenz
4ea824b51e Update benchmark formatting for new nightly 2024-05-11 08:19:03 -04:00
Ed Page
f1caef11c4 test: Move off of deprecated manifest fields 2024-04-18 14:11:31 -05:00
Ed Page
1876326b6b feat(resolve): Tell the user the style of resovle done
This is to help with #9930

Example changes:
```diff
-[LOCKING] 4 packages
+[LOCKING] 4 packages to latest version
-[LOCKING] 2 packages
+[LOCKING] 2 packages to latest Rust 1.60.0 compatible versions
-[LOCKING] 2 packages
+[LOCKING] 2 packages to earliest versions
```

Benefits
- The package count is of "added" packages and this makes that more
  logically clear
- This gives users transparency into what is happening, especially with
  - what rust-version is use
  - the transition to this feature in the new edition
  - whether the planned config was applied or not (as I don't want it to
    require an MSRV bump)
- Will make it easier in tests to show what changed
- Provides more motiviation to show this message in `cargo update` and
  `cargo install` (that will be explored in a follow up PR)

This does come at the cost of more verbose output but hopefully not too
verbose.  This is why I left off other factors, like avoid-dev-deps.
2024-04-13 20:39:59 -05:00
Ed Page
4ab2797f36 feat(lock): Print lockfile changes on all commands 2024-03-12 13:39:56 -05:00
Ed Page
1b6ff9a62a test: Make edition explicit on packages
This is a follow up to 14646e6af6b22a135eefe771029425ac29f259f1

I don't run these tests locally, so I missed them.
2024-02-29 15:48:41 -06:00
Ed Page
e7e8d8748a fix(compiler): Clarify we're showing a profile name 2024-02-08 14:01:39 -06:00
Weihang Lo
f9fd4ff4ee
fix(json-msg): use pkgid spec in in JSON messages
In 12914 we stabilized pkgid spec as unique package identifier for
`cargo metadata`. However, we forgot to make the same change to
JSON message format[^1]. This PR does so.

Note that the `package_id` field in JSON message is not clearly stated
as "opaque", so it might be considered as a breaking change to some extent.

[^1]: https://doc.rust-lang.org/nightly/cargo/reference/external-tools.html#compiler-messages
2024-01-17 11:31:19 -05:00
Weihang Lo
77da514529
test: move --keep-going suggestion match tests to UI tests
We don't want to overly match to suggestion help from clap.
2023-08-22 19:21:09 +01:00
Weihang Lo
4d0958587b
refactor(arg): use UnknownArgumentValueParser to suggest arg for unknown args 2023-08-22 17:24:40 +01:00
bors
7b61184ad1 Auto merge of #12498 - Kobzol:run-verbose-print-env, r=arlosi
Print environment variables for `cargo run` in extra verbose mode
2023-08-17 05:32:16 +00:00
Jakub Beránek
4eac5a1fd1
Add test for environment variables in verbose mode for cargo bench 2023-08-16 13:47:39 +02:00
Weihang Lo
689defd4ba
test: relax assertions of panic message (again) 2023-08-14 19:32:39 +01:00
Weihang Lo
5ae529b24e
feat: remove --keep-going from cargo test/bench
It confuses people that both `--no-fail-fast` and `--keep-going` exist
on `cargo test` and `cargo bench` but with slightly different behavior.
The intended use cases for `--keep-going` involve build commands like
`build`/`check`/`clippy` but never `test`/`bench`.

Hence, this commit removes `--keep-going` from `test`/`bench` and
provides guidance of `--no-fail-fast` instead.

If people really want to build as many tests as possible, they can also
do it in two steps:

    cargo build --tests --keep-going
    cargo test --test --no-fail-fast
2023-08-11 14:29:02 +01:00
Weihang Lo
b9e70ec0a2
test: relax assertions of panic handler message format 2023-07-29 17:12:46 +01:00
Scott Schafer
ab18bd40d5 refactor(testsuite): Replace [project] with [package] 2022-09-26 09:51:16 -06:00
Eric Huss
23735d4c09 Rework test error handling 2022-08-27 19:23:30 -07:00
Eric Huss
1c3640e05c Add requirements to cargo_test. 2022-07-30 19:36:58 -07:00
Danil Hendra Suryawan
e04d7772e4 No printing executable names when running benches with json message format 2022-05-24 20:44:54 +07:00
Yerkebulan Tulibergenov
0b74ea2f76 display bench exec info differently 2022-02-02 08:17:09 -08:00
Yerkebulan Tulibergenov
ed579b66e2 add short path name for executables 2022-01-31 10:37:02 -08:00
Yerkebulan Tulibergenov
a6c1459f37 fix tests 2022-01-30 23:59:54 -08:00
Vaibhav
bef4d79ff2 Print executable name on cargo test --no-run.
Closes #9957

Signed-off-by: Vaibhav <vrongmeal@gmail.com>
2021-10-05 23:47:38 +05:30
Eric Huss
6dff99781d Remove with_either_contains.
It isn't needed anymore, and I would prefer to not keep around unused code.
It can always be added back if ever needed again.
2021-06-16 09:44:29 -07:00
Simonas Kazlauskas
548300b20f Add the path to the manifest in json output
This allows consumers of the json messages to avoid guessing where
exactly the package root is. Having access to the package root is
difficult by virtue of requiring logic to guess its location by e.g.
walking filesystem from the source file.

This guessing logic becomes further complicated in presence of
workspaces and nigh impossible to implement correctly in instances where
artifacts end up produced from paths above the package root (e.g.
`../foo.rs`).

Since Cargo has access to this data in the first place, there doesn't
seem to be much reason to force consumers to invent their own, possibly
flawed, logic.
2021-03-04 20:09:51 +02:00
Gus Wynn
04c8372217 fix test suite 2021-02-21 14:37:42 -08:00
ayazhafiz
e831dd12a8 Publish target's "doc" setting when emitting metadata
Prior to this commit `cargo metadata` would not emit the value of a
target's "doc" setting, used by `cargo doc` to determine whether
documentation should be generated. However, this information is useful
for machine programs interested in such targets, and the information is
already made available on the internal representation of a target, so
this commit just exposes that during target serialization for emit.

cf https://github.com/deadlinks/cargo-deadlinks/issues/99
2020-11-17 19:54:17 -06:00
Weihang Lo
8f0664f02a
test: normalize raw string indentation. 2020-10-10 07:44:57 +08:00
Weihang Lo
a06ec889f4
test(bench): glob support for package selection 2020-10-05 01:24:42 +08:00
Eric Huss
6f8c7d5a87 Normalize raw string indentation. 2020-09-26 17:59:58 -07:00
Oliver Scherer
95b22d2874 Emit the test field in cargo metadata 2020-07-30 09:50:46 +02:00
Alex Tokarev
19a9579031 Warn on missing required-features
Co-authored-by: Eric Huss <eric@huss.org>
2020-07-26 13:01:18 +03:00
Eric Huss
eac3b66bd4 Rework how Cargo computes the rustc file outputs. 2020-05-05 14:32:52 -07:00
Eric Huss
c889bbfba8 Add "build-finished" JSON message. 2020-04-04 18:56:50 -07:00
Jiajie Chen
9f07c83417 Don't create hardlink for library test, integrations tests and benches, fixing #7960 2020-03-05 13:03:49 +08:00
Eric Huss
83571aee56 Minor testsuite organization. 2019-11-24 18:42:45 -08:00
Dan Aloni
375a46f18b Merge remote-tracking branch 'origin/master' into custom-profile-pr-rfc 2019-09-18 08:56:13 +03:00
Alex Crichton
9115b2c326 Extract support directory to its own crate
Extract out all our test support code to its own standalone crate so it
can be shared between multiple test suites if necessary.
2019-09-16 11:47:09 -07:00
Dan Aloni
f0896975be Merge remote-tracking branch 'origin/master' into custom-profile-pr-rfc 2019-09-08 21:43:41 +03:00
k-nasa
7176df01d6 Change --all to --workspace 2019-09-03 17:14:34 -07:00
Dan Aloni
23e613d552 Merge remote-tracking branch 'origin/master' into custom-profile-pr-rfc 2019-08-09 11:50:55 +03:00
Vadim Petrochenkov
01aae39ee7 tests: Enable features to fix unstabilized #[bench] 2019-07-31 22:46:29 +03:00
Dan Aloni
87183146d9 Merge remote-tracking branch 'origin/master' into custom-profile-pr-rfc 2019-06-20 16:18:42 +03:00
Dan Aloni
03b054392d tests: fix nightly-only test with regard to the Finished line 2019-06-09 20:32:09 +03:00
Jethro Beekman
0e0d968825 Update #[test] attribute on all tests in the testsuite
sed -i 's/^#\[test\]/#[cargo_test]/' $(rg -l '^#\[test\]')

Manual fixes:
* proc_macro::proc_macro_doctest
2019-06-07 12:41:26 -07:00
vlad20012
e1d433d30f Add doctest field into metadata
Some tools can support rust doctests (e.g. highlighting
or launching). So it should be possible to find out if
doctests are enabled for a target or not. This commit
adds `doctest` field to `cargo metadata` output.
2019-05-17 18:39:23 +03:00
Alex Crichton
fecb724643 Format with cargo fmt 2018-12-08 03:19:47 -08:00
Dale Wijnand
04ddd4d0fc
Upgrade to Rust 2018 2018-12-06 20:18:35 +01:00