66 Commits

Author SHA1 Message Date
Eric Huss
1ce8023626 Rustfmt 2024 2025-07-05 19:50:36 -07:00
Ross Sullivan
92d9a94d02
chore: Migrated testsuite to testsuite::prelude 2025-06-25 22:37:24 +09:00
Ed Page
31a17b62ab test(rustflags): Clarify remap tests
The tests were comparing rustc vs RUSTFLAGS which was obscuring the case
it was trying to test which was that different remaps shouldn't cause
different results.
2024-12-05 15:49:40 -06:00
Ed Page
9fcb5de16e test(rustflags): Pull out metadata extraction 2024-12-05 15:22:18 -06:00
Ed Page
d1375ba70e test(rustflags): Put remap success test first 2024-12-05 15:20:55 -06:00
Ed Page
0b10d6f368 test(rustflags): Verify -Cmetadata directly, not through -Cextra-filename
This unblocks experimenting with having these diverge for #8716
2024-11-21 12:48:04 -06:00
Weihang Lo
c3a74f5c36
test(rustflags): relax compiler panic assertions 2024-09-30 14:23:47 -04:00
Ed Page
d2ec764995 fix(resolve): Dont show locking workspace members
This is for `cargo generate-lockfile` and when syncing the lockfile with
the manifest.
We still show it for `cargo update` because of `cargo update
--workspace`.

We hacked around this previously by filtering out the `num_pkgs==1` case
for single packages but this didn't help with workspaces.
2024-08-22 16:57:06 -05:00
Weihang Lo
d12c716140
fix: -Cmetadata includes whether extra rustflags is same as host
`-Ztarget-applies-to-host --config target-applies-to-host=false` make it
possible to build two units for the same output directory with different
rustflags (one with artifact/target rustflags, one with none/host rust
flags). Those flags aren't included in the `-Cmetadata` hash which is
used to disambiguate different versions of crates, resulting in a conflict.
The actual error being produced appears to be the result of two invocations
of `rustc` racing and clobbering each other.

While we don't hash RUSTFLAGS because it may contain absolute paths that
hurts reproducibility, we track whether a unit's RUSTFLAGS is from host
config, so that we can generate a different metadata hash for runtime
and compile-time units.
2024-08-22 06:02:33 +08:00
Weihang Lo
dba34d4552
test: show runtime-dep and build-dep collides
See rust-lang/cargo 14253
2024-08-20 21:28:41 -04: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
Greg Morenz
5be8044e67 Pass rustdocflags like rustflags 2024-07-04 14:32:50 -04:00
Greg Morenz
07c9f77ecd Pass rustflags to artifacts built with implicit targets when using target-applies-to-host 2024-07-04 14:30:31 -04:00
Greg Morenz
a547d19af7 Add test verifying behavior in #10744 2024-07-04 14:30:31 -04:00
eth3lbert
808b777d45
test: migrate rustflags to snapbox 2024-06-22 12:25:18 +08: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
heisen-li
8056001e8a remove or change lib.plugin related test 2024-05-16 20:18:54 +08:00
Urgau
388a17f23f Update regular tests for always-on check-cfg 2024-05-01 12:56:04 +02:00
Ed Page
e7e8d8748a fix(compiler): Clarify we're showing a profile name 2024-02-08 14:01:39 -06:00
Ed Page
675224b3a0 test(config): Shift to config.toml 2024-01-26 13:40:46 -06:00
Mohammad AlSaleh
0bbabecbf3 Fix a rustflags test using a wrong buildfile name
The test seem to have always had the wrong buildfile `build.rs.rs`.

Signed-off-by: Mohammad AlSaleh <CE.Mohammad.AlSaleh@gmail.com>
2023-11-16 20:03:01 +03:00
Eric Huss
0afd943dad Fix some test output validation. 2023-11-15 15:10:18 -08:00
Scott Schafer
866daf4f22 chore: update rustflags tests to use check 2023-02-20 12:22:29 -06:00
Scott Schafer
c239e407e7 add a reason to masquerade_as_nightly_cargo so it is searchable 2022-07-15 21:32:23 -05:00
bors
3d6970d50e Auto merge of #10395 - jonhoo:fix-10206, r=alexcrichton
Enable propagating host rustflags to build scripts

### What does this PR try to resolve?

This PR primarily fixes #10206, but in doing so it also slightly modifies the interface for the unstable `target-applies-to-host` feature (#9453), and adds the unstable `target-applies-to-host-kind` flag to mirror `target-applies-to-host` for build scripts and other host artifacts.

The commit messages have more in-depth discussion.

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

The test case from #10206 now works rather than producing an error. It has also been added a regression test case. A few additional test cases have also been added to handle the expected behavior around rustflags for build scripts with and without `target-applies-to-host-kind` enabled.

### Additional information

1. This changes the interface for `target-applies-to-host` so that it does not need to be specified twice to be used. And it can still be set through configuration files using the `[unstable]` table. However, we may(?) want to pick a stable format for in-file configuration of this setting unless we intend for it to only ever be a command-line flag.
2. It may be that `target-applies-to-host-kind` is never behavior we want users to turn on, and that it should therefore simply be removed and hard-coded as being `false`.
3. It's not entirely clear how `target-applies-to-host-kind` should interact with `-Zmultitarget`. If, for example, `requested_kinds = [HostTarget, SomeOtherTarget]` and `kind.is_host()`, should `RUSTFLAGS` take effect or not? For the time being I've just hard-coded the behavior for single targets, and the answer would be "no".
2022-02-28 19:29:07 +00:00
Jon Gjengset
56db82957f Avoid #[cfg] duplicated main in tests
It makes the logic really hard to follow.
2022-02-24 15:17:33 -08:00
Jon Gjengset
54674d365b Improve precision of host build.rustflags tests 2022-02-24 14:56:46 -08:00
Jon Gjengset
f23894d93f Make rustflags logic more linear 2022-02-23 16:36:14 -08:00
Jon Gjengset
49f90f5055 Retain legacy behavior with tath != false 2022-02-21 10:20:32 -08:00
Jon Gjengset
4f41727106 Enable propagating rustflags to build scripts
This patch implements more complete logic for applying rustflags to
build scripts and other host artifacts. In the default configuration, it
only makes build scripts (and plugins and whatnot) pick up on
`rustflags` from `[host]`, which fixes #10206 but otherwise preserves
existing behavior in all its inconsistent glory. The same is the case if
`target-applies-to-host` is explicitly set to `false`.

When `target-applies-to-host` is explicitly set to `true`, rustflags
will start to be applied in the same way that `linker` and `runner` are
today -- namely they'll be applied from `[target.<host triple>]` and
from `RUSTFLAGS`/`build.rustflags` if `--target <host triple>` is given.
2022-02-18 10:50:08 -08:00
Jon Gjengset
fb47df72e1 Add regression test for #10206 2022-02-18 08:48:17 -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
6f8c7d5a87 Normalize raw string indentation. 2020-09-26 17:59:58 -07:00
Eric Huss
4ae79d2ffd Use fs helpers instead of File functions. 2020-04-17 07:56:16 -07: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
23e613d552 Merge remote-tracking branch 'origin/master' into custom-profile-pr-rfc 2019-08-09 11:50:55 +03:00
Eric Huss
ec9222a345 Fix remap-path-prefix from failing. 2019-08-06 09:00:43 -07:00
Dan Aloni
27da33c67d Merge remote-tracking branch 'origin/master' into custom-profile-pr-rfc 2019-07-28 09:24:31 +03:00
Eric Huss
d99b7fede7 Also ignore remap-path-prefix in metadata for cargo rustc. 2019-07-14 14:38:47 -07:00
Dan Aloni
87183146d9 Merge remote-tracking branch 'origin/master' into custom-profile-pr-rfc 2019-06-20 16:18:42 +03:00
Eric Huss
1e74ea8578 Update reamp_path_prefix_ignored to cargo_test. 2019-06-07 12:51:56 -07: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
Dan Aloni
5d048e0330 Merge remote-tracking branch 'origin/master' into custom-profile-pr-rfc 2019-06-07 21:48:47 +03:00
Dan Aloni
e25f6a4255 tests: fix finished line for 'cargo test' 2019-06-07 21:47:45 +03:00
Eric Huss
c8a9f88f09 Ignore remap-path-prefix in metadata hash. 2019-05-20 07:44:41 -07:00
Hidehito Yabuuchi
3ca98adbba cargo fmt tests/testsuite/rustflags.rs 2019-02-24 14:27:10 +09:00
Hidehito Yabuuchi
44aec50e4e Add tests for warning on misspelled env vars 2019-02-23 19:08:50 +09:00
Eric Huss
f58d107e7c testsuite: Require failing commands to check output. 2018-12-28 17:59:36 -08:00