Commit 96a2a7a
Use the gix binary's embedded target_triple rather than spawning rustc
`tests/licenses_parity.rs` used `Command::new("rustc").arg("-vV")`
parsed for its `host:` line to pick the `--filter-platform` value for
the cargo-metadata probe. That was wrong in two ways:
* It hardcoded the command `rustc` literally — whichever compiler
happens to be first on `PATH` — not the compiler this cargo
invocation actually resolved. A rustup override, `cargo +nightly`,
or a custom `RUSTC` setting at the cargo level would silently
diverge the test from the compiler that built the binary under
test.
* The fix that worked for `build.rs` (`std::env::var("RUSTC")`)
doesn't apply here: cargo sets `RUSTC` for build scripts but not
for integration tests. Empirically `std::env::var_os("RUSTC")`
returns `None` inside a running test binary.
Switch to reading `target_triple` from the binary's own
`gix licenses --format json` output. `build.rs` populates that field
from the `TARGET` env var cargo sets for the build script, so it is
the authoritative record of what target the binary under test was
built for. No subprocess to `rustc` is needed at all; the `gix`
binary is already being spawned for the crate-set probe further
down in the same test.
Co-Authored-By: Claude <noreply@anthropic.com>1 parent 2aff1e1 commit 96a2a7a
1 file changed
Lines changed: 35 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
35 | 61 | | |
36 | 62 | | |
37 | 63 | | |
| |||
281 | 307 | | |
282 | 308 | | |
283 | 309 | | |
284 | | - | |
| 310 | + | |
285 | 311 | | |
286 | 312 | | |
287 | 313 | | |
| |||
0 commit comments