145 Commits

Author SHA1 Message Date
Ross Sullivan
30b6707135
chore: Moved remaining cargo_exe logic to testsuite 2025-06-25 23:18:08 +09:00
Ross Sullivan
92d9a94d02
chore: Migrated testsuite to testsuite::prelude 2025-06-25 22:37:24 +09:00
Ed Page
c13453ffda fix(toml): Report '<target>.edition' deprecation to users
In hindsight, the use of this is rare enough that we can go ahead and
warn without user controllable lints.
2025-03-15 03:04:18 -05:00
jyn
00d4e3d1ad Remove unused -C link-arg=-fuse-ld=lld
That's a gcc flag. lld is a linker, not a C compiler, and doesn't accept
a `use-ld` flag. `-C linker` (which is already present in the test) is
enough.

This fixes the following warning found in rust-lang/rust#119286:
```
---- expected: tests\testsuite\freshness.rs:2822:27
++++ actual:   stderr
   1    1 | [FRESH] foo v0.1.0 ([ROOT]/foo)
        2 + [WARNING] linker stderr: rust-lld: ignoring unknown argument '-fuse-ld=lld'␍
        3 +   |
        4 +   = [NOTE] `#[warn(linker_messages)]` on by default
        5 +
        6 + [WARNING] `foo` (lib) generated 1 warning
   2    7 | [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
```
2025-01-24 11:44:49 -05:00
ranger-ross
3d7b154d15
Moved manifest metadata tracking from fingerprint to dep info
This change moves the manifest metadata track to dep-info files
with the goal of reduce unneeded rebuilds when metadata is changed as
well fixing issues where builds are not retrigged due to metadata
changes when they should (ie. #14154)
2024-12-24 16:52:51 +09:00
Ed Page
306d515c08 fix(fingerprint): Don't throwaway the cache on RUSTFLAGS changes
Fixes #8716
2024-12-05 16:11:11 -06:00
Ed Page
b2aa08bbc6 test(fingerprint): Verify rustc extra flags like RUSTFLAGS
I almost overlooked these
2024-12-05 16:10:47 -06:00
Weihang Lo
ddc63f2575
test: simplify rebuild tests to address nondeterminism
```
---- freshness::rebuild_tests_if_lib_changes stdout ----
running `/home/runner/work/cargo/cargo/target/debug/cargo build`
running `/home/runner/work/cargo/cargo/target/debug/cargo test`
running `/home/runner/work/cargo/cargo/target/debug/cargo build -v`
running `/home/runner/work/cargo/cargo/target/debug/cargo test -v`
error: test failed, to rerun pass `-p cargo --test testsuite`
thread 'freshness::rebuild_tests_if_lib_changes' panicked at tests/testsuite/freshness.rs:633:10:

---- expected: tests/testsuite/freshness.rs:623:27
++++ actual:   stderr
   1    1 | [DIRTY] foo v0.0.1 ([ROOT]/foo): the dependency foo was rebuilt ([TIME_DIFF_AFTER_LAST_BUILD])
   2    2 | [COMPILING] foo v0.0.1 ([ROOT]/foo)
   3    3 | [RUNNING] `rustc --crate-name foo [..]
   4      - [RUNNING] `rustc --crate-name foo [..]
   5    4 | error[E0425]: cannot find function `foo` in crate `foo`
        5 +  --> tests/foo.rs:4:34
   6    6 | ...
   7    7 | [ERROR] could not compile `foo` (test "foo") due to 1 previous error
   8    8 | ...∅
```
2024-11-23 11:05:15 -05:00
Ed Page
55350fc670 test: Switch from 'exec_with_output' to 'run'
This is a follow up to #14846 which changed `run` to return the
`RawOutput`.

Reasons I didn't "update" some code to the new `run` return value
- We were actually using `ProcessBuilder::exec_with_output` and I didn't
  want to disentangle what it would take to switch to `Execs`
- We did processing on the `Result` and I didn't want to check how that
  could be updated
2024-11-21 13:48:27 -06:00
Ed Page
6ba83152e5 test(freshness): Update remaining unordered tests to snapbox
`compare.rs` gives priority based on expected-line length.
`snapbox` gives priority according to the expected line order.
2024-11-04 16:03:39 -06:00
Weihang Lo
e4e970d309
test(freshness): relax compiler panic assertions 2024-09-30 13:25:33 -04:00
Weihang Lo
498ae399bf
test: relax panic output assertion
rust-lang/rust#122565 adds a new line to thread panic output.
To make the current test suites works on stable, beta, and nightly,
this relaxes the assertion around that by globbing everything.
2024-09-26 16:00:54 -04:00
Ed Page
a6cf1be655 test: Switch from allow to expect deprecated
This caught a couple of lingering items.
2024-09-23 20:44:06 -05: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
Ed Page
3a615ca9c8 feat(test): Add CargoPathExt to prelude 2024-07-18 15:22:29 -05: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
Lawrence Chou
b8a62da07e
test(freshness): migrate to snapbox 2024-07-04 00:11:13 +08:00
Lawrence Chou
6ae78e8d86
Fix regression since #14076 is now resolved 2024-06-16 09:13:50 +08:00
Lawrence Chou
b254699e29
Revert "Reproduce #14076"
This reverts commit 18f4c3f3d1f90d88c3ea667f51b093d4e1b8deec.
2024-06-16 09:13:36 +08:00
Lawrence Chou
fde1321381
Remove Execs::run_expect_error to avoid #14076 2024-06-16 09:13:24 +08:00
Lawrence Chou
afe9d17258
Reproduce #14076
The `with_stderr_contains()` (as well as the new `with_stderr_data()` too, see #14060) has no effect when using with `run_expect_error()`.
2024-06-16 09:13:09 +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
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
14646e6af6 test: Make edition explicit on packages 2024-02-22 11:37:03 -06:00
Ed Page
831847e5f0 fix(rustc): Always pass --edition to rustc
On [Internals](https://internals.rust-lang.org/t/idea-rustc-cargo-should-warn-on-unspecified-edition/20309),
the idea came up for warning on unset Edition.
I am working on the cargo warning but if rustc ever wants to do so,
they'd be blocked on cargo ensuring `--edition` is always set.
Hence this change.
2024-02-28 15:35:41 -06: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
hi-rustin
ed9dc44f47 Update other tests to use cargo:: syntax
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2023-12-23 13:17:55 +08:00
Chris Denton
4ef503fc2d
Don't rely on mtime to test changes 2023-12-08 20:32:28 +00:00
Eric Huss
0afd943dad Fix some test output validation. 2023-11-15 15:10:18 -08:00
Ed Page
e4e10f2393 chore: Fix typos
This is a repeat of #11561
2023-09-19 15:28:48 -05:00
Joakim Holm
839069f03f only skip mtime check on $CARGO_HOME/{git,registry}
Closes #12090

Commit

Fix formatting

Fix tests

Fix formatting

Fix formatting

Fix formatting
2023-07-19 12:38:56 +02:00
Weihang Lo
98a73394f1
fix: verify source before recompile
This fixes a regression introduced by #11407,
which Cargo should always verify a source before it recompiles.
2023-02-03 14:17:34 +00:00
Weihang Lo
419a56f617
test: verify source before recompile 2023-02-03 14:17:18 +00:00
Rémy Rakic
6848006cbe update tests for build deps debuginfo optimization 2023-01-31 20:12:52 +00:00
Dinu Blanovschi
0beb5fe93d Simple explanations for why cargo rebuilds crates 2022-12-28 16:27:50 +01:00
Scott Schafer
ab18bd40d5 refactor(testsuite): Replace [project] with [package] 2022-09-26 09:51:16 -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
Scott Schafer
cab6d30c1d fix typos found by the typos-cli crate 2022-05-10 16:47:28 -05: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
bjorn3
8c24820a3d Update test 2021-07-05 18:28:21 +02:00
Eric Huss
28c3bef71a Include the linker in the fingerprint. 2021-07-01 20:33:48 -07:00
Eric Huss
2551535ea9 Track "CARGO" in environment fingerprint. 2021-04-15 13:54:46 -07:00
Gus Wynn
04c8372217 fix test suite 2021-02-21 14:37:42 -08:00
Eric Huss
6f8c7d5a87 Normalize raw string indentation. 2020-09-26 17:59:58 -07:00
Eric Huss
f2f12ba6a2 Bump to 0.49.0 2020-08-28 10:17:49 -07:00
Alex Crichton
64a468261a Fix freshness checks for build scripts on renamed dirs
This commit fixes an issue in Cargo where when an entire project
directory is renamed (preserving the target directory) then path
dependencies with build scripts would have their build scripts rereun
when building again. The problem with this was that when a build script
doesn't print `rerun-if-changed` Cargo's conservative fingerprint listed
an absolute path in it, which was intended to be a relative path.

The fix here is to use a relative path in the fingerprint to ensure that
it's not the reason a rebuild happens when directories are renamed.
2020-07-17 10:07:06 -07:00