Add support to use rustc --print=cfg as fallback to resolve target information#3331
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3331 +/- ##
==========================================
- Coverage 85.58% 85.58% -0.01%
==========================================
Files 160 160
Lines 47893 47927 +34
==========================================
+ Hits 40990 41019 +29
- Misses 6903 6908 +5 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Thanks for doing this! Have a look at the rustc-shim binary, you should be able to fake a rustc invocation using that: https://github.com/nextest-rs/nextest/blob/a2c4c13e16946c0c5ad06a9fedeabf10f83e4fe3/integration-tests/test-helpers/rustc-shim.rs |
|
thanks @sunshowers |
Needed, because `to_string` is used in `aquire_graph_data` in the call to cargo metadata. This requires to pass the target triple.
55c920b to
8a4bb8d
Compare
|
switched to I don't see how this is set for the integration-test, because inside Should I hardcode the path using |
|
Hmm, nextest is responsible for setting it. I'll have a look. |
my added test is still under |
|
Ah yeah it has to live under integration-tests. I would have a look at |
Adding a new debug command to check target arg output
|
added not sure about the MSRV fails, because edition=2024 was already set. |
|
The nextest-metadata MSRV thing will be addressed by #3342. This generally looks great, thanks! I'll take care of the rest (want to make a few tweaks to the output format before landing). |
|
perfect. thank you. and thanks for the pointers |
| triple_str, | ||
| "--output-format", | ||
| "json-pretty", | ||
| ]) |
There was a problem hiding this comment.
I added JSON output to debug build-platforms in #3343 and used it here.
| debug_assertions | ||
| panic="abort" | ||
| target_abi="eabihf" | ||
| target_arch="arm" | ||
| target_endian="little" | ||
| target_env="" | ||
| target_has_atomic="16" | ||
| target_has_atomic="32" | ||
| target_has_atomic="8" | ||
| target_has_atomic="ptr" | ||
| target_os="none" | ||
| target_pointer_width="32" | ||
| target_vendor="unknown" |
There was a problem hiding this comment.
Moved this to a file to avoid duplicating it across the shim and the test.
| source: integration-tests/tests/integration/main.rs | ||
| expression: "&stdout" | ||
| --- | ||
| { |
|
The macOS failures are definitely unrelated to the PR and I think are an infrastructure issue with GitHub. |
closes #3319
Uses
rustc --print=cfg --target=<given target>in nextest internally to resolve the platform in case target is not built-in or custom JSON target.If this fails, heuristic check is done as before.
bumps
target-specto v3.6.0 to get support forrustc --print=cfg.(Cargo.lock was already at v3.6.0, but Cargo.toml wasn't)
To test this feature with de upstream rustc, I created a shell script and set it for RUSTC only for this one test case.
The shell script forwards all rustc calls except when
--print=cfgis the first argument.In this case it returns a fixed cfg that is then compared in the test case.
Wouldn't know how else to test this, because
rustc --print=cfgrequires to pass the target as well, but upstream rustc only knows targets that would get resolved by the built-in case, so would never reach the--print=cfgfallback.