40 Commits

Author SHA1 Message Date
Ross Sullivan
92d9a94d02
chore: Migrated testsuite to testsuite::prelude 2025-06-25 22:37:24 +09:00
Josh Triplett
0419be8eae Disable cdb test, which seems to be broken 2025-06-20 02:21:46 -07:00
Josh Triplett
4cfa4b0c60 Disable lldb test, which seems to be broken due to issues with lldb 2025-06-20 01:43:22 -07:00
Weihang Lo
281629bd2b
fix(trim-paths): remap all paths to build.build-dir
Remap all paths pointing to `build.build-dir`,
i.e., `[BUILD_DIR]/debug/deps/foo-[HASH].dwo` would be remapped to
`/cargo/build-dir/debug/deps/foo-[HASH].dwo`
(note the `/cargo/build-dir` prefix).

This covers scenarios like:

* Build script generated code. For example, a build script may call `file!`
  macros, and the associated crate uses [`include!`] to include the expanded
  [`file!`] macro in-place via the `OUT_DIR` environment.
* On Linux, `DW_AT_GNU_dwo_name` that contains paths to split debuginfo
  files (dwp and dwo).
2025-06-02 14:26:36 -04:00
Weihang Lo
463e9ed3cd
test(trim-paths): not remapped in build script gen'd code
This was discovered in
<https://github.com/rust-lang/rust/issues/111540#issuecomment-2544049895>.

Co-authored-by: Urgau <urgau@numericable.fr>
2025-06-02 14:26:35 -04:00
Weihang Lo
56a1118e52
test(trim-paths): match the actual sanitized paths
The old wildcard matched too much and didn't really
show whether the paths were sanitized.
2025-06-02 14:26:35 -04:00
Weihang Lo
d8ac8dd2e5
test(trim-paths): re-enable more symbols trimming check
rust-lang/rust#117652 has been fixed.
2025-06-02 14:26:35 -04:00
Weihang Lo
4e507121a0
test(trim-paths): verify trim-paths=object works on windows-msvc 2025-06-02 08:10:24 -04:00
Weihang Lo
11e40ae867
test(trim-paths): verify Windows cdb works after trimmed
GitHub Actions has Windows SDK pre-installed,
so cdb should be available at that path always.

Additionally, this adds a new CI job for windows-msvc nightly toolchain
2025-06-02 08:10:24 -04:00
Weihang Lo
4240e722d4
test: requires attribute accepts string literals for cmds
The new syntax is key-value pair like `requires = "rustfmt"`,
comparing to the previous `requires_<cmd>`.
2024-11-29 22:23:08 -05:00
Ed Page
af3cfd5abe fix(test): Un-deprecate contains assertions 2024-11-07 15:55:35 -06: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
Weihang Lo
b8a3dbebd5
feat(trim-paths): rustdoc supports trim-paths for diagnostics
This enables rustdoc invocation from `cargo doc` to trim paths
in diagnostics. Doc tests are out-of-scope, as they are handled
in a different mechanism, which needs more cares.
2024-08-12 13:48:07 -04:00
Weihang Lo
33a800caca
test: show trim-paths=diagnostics doesnt works for rustdoc
It should be working with the next commit.
2024-08-12 13:34:53 -04:00
Eric Huss
9ccd7c4f36 Fix warnings building tests on Windows 2024-07-28 13:00:26 -07: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
eth3lbert
1ba4291021
test: migrate profile_trim_paths to snapbox 2024-06-24 03:59:03 +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
995746b937 refactor: Port from matches_contains to assert_e2e 2024-05-29 14:08:10 -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
Eric Huss
27f84f6b68 Fix unused imports on Windows. 2024-02-20 16:28:37 -08:00
Ed Page
e7e8d8748a fix(compiler): Clarify we're showing a profile name 2024-02-08 14:01:39 -06:00
Weihang Lo
cd1f08899e
test: disable lldb test as it requires privileges to run on macOS 2024-02-07 09:45:25 -05:00
Weihang Lo
6e9cf8513d
fix(trim-paths): remap common prefix only
New remap rules for git/registry dependencies:

* Git dependencies: remove ~/.cargo/git/checkouts prefix.
* Registry dependencies: remove ~/.cargo/registry/src prefix.

This make the remap rules fixed to a finite number,
minimizing the burden for users to configure debuggers.
2023-12-26 13:24:59 -05:00
Weihang Lo
fcd4221c5a
test(trim-paths): don't follow links to separate debuginfo files
For refeference:
https://sourceware.org/binutils/docs/binutils/readelf.html
2023-12-08 16:34:00 -05:00
Weihang Lo
bb86adfff7
fix(trim-paths): explicit remap to current dir .
In https://github.com/rust-lang/rust/blob/87e1447aa/compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs#L856
when the remap result of `work_dir` is an empty string,
LLVM won't generate some symbols for root debuginfo node.
For example, `N_SO` and `N_OSO` on macOS,
or `DW_AT_comp_dir` on Linux when debuginfo is splitted.
Precisely, it is observed that when the `DIFile` of compile unit was
provied with an empty compilation `Directory` string,
LLVM would not emit those symbols for the root DI node.

This behavior is not desired,
resulting in corrupted debuginfo and degrading debugging experience.

This is might not be a bug of `--remap-path-prefix` in rustc,
since `-fdebug-prefix-map` in clang 16 could have the same result
(`DW_AT_comp_dir` is gone when `work_dir` is remapped to an empty string).
However, in gcc 12 `fdebug-prefix-map` will return an absolute work_dir
when an empty string occurs.

To not bother whether this needs to be fixed in rustc or not,
let's fix it by always appending an explicit `.`
when `--remap-path-prefix` remaps to relative workspace root
a.k.a. where rustc is invoking.

For more on gcc/clang remap options, see
https://reproducible-builds.org/docs/build-path/
2023-12-08 15:52:06 -05:00
Weihang Lo
7cb7b47fe7
test(trim-paths): add test for each split-debuginfo options
Also demonstarte that on Linux with split-debuginfo on the remap is broken
2023-12-08 15:51:55 -05:00
Weihang Lo
985d49b916
test(trim-paths): use --config CLI to change options 2023-12-08 13:57:45 -05:00
Weihang Lo
a4c607cde4
test(trim-paths): assert OSO and SO cannot be trimmed
See
* rust-lang/rust issue 117652
* rust-lang/rust issue 116948
2023-12-05 17:58:32 -05:00
Weihang Lo
5c32fe0432
test(trim-paths): exercise with real world debugger 2023-12-01 08:48:24 -05:00
Weihang Lo
8709835a01
fix: reorder --remap-path-prefix flags for -Zbuild-std
Order of `--remap-path-prefix` flags is important for `-Zbuild-std`.
We want to show `/rustc/<hash>/library/std` instead of `std-0.0.0`.
2023-11-28 15:29:03 -05:00
Weihang Lo
7535971d8b
fix(trim-paths): merge trim-paths from different profiles
In 4d29af1 we forgot to add trim-paths to `fn merge()`.
This commit follows how `-Zprofile-rustflags` works ---
overriding instead of merging array.
2023-11-01 23:24:15 -04:00
Weihang Lo
618701921d
test(trim-paths): profile merge doesn't work
This demonstrate the buggy behavior that
profile merge on `trim-paths` doesn't work as expected.
2023-11-01 23:19:49 -04:00
Weihang Lo
dd0aea350c
feat(trim-paths): set env CARGO_TRIM_PATHS for build scripts 2023-10-31 12:00:48 -04:00
Weihang Lo
63cef2c4fc
feat(trim-paths): rustc invocation integration 2023-10-30 16:38:56 -04:00
Weihang Lo
557fc4fd3e
test(trim-paths): verify current behavior with -Ztrim-paths 2023-10-30 16:38:55 -04:00
Weihang Lo
08c5e35f60
test(trim-paths): parsing in mainfest and config 2023-10-30 16:38:55 -04:00