Closed jcajka closed 1 year ago
I'm on rust 1.71.0 on Ubuntu and I'm not able to reproduce this. Neither is CI.
cargo test
should be setting the CWD to crates/anstyle-parse/
for running tests which then makes ./src/state/table.rs
accessible`.
Interesting, I have been trying this in various clean Fedora container envs across all arches with same results regardless of if executed via workspace or directly in the anstyle-parse. All other tests passes, I will reach out to he Fedora Rust folks, if they have any ideas.
Reported to Fedora folks via https://bugzilla.redhat.com/show_bug.cgi?id=2229663
I can reproduce this in a clean container, and the "not found" is coming from codegenrs::rustfmt
when it tries to spawn that command. After dnf install rustfmt
, it works for me.
Improved the error message so it should be more discoverable (haven't updated the Cargo.lock
to reflect that yet)
@cuviper @epage Thank you for quick replies and help. It works for me now. For the record rustfmt in Fedora should most probably by version dependent on the rust, with mismatched versions(1.71.0 for rustfmt and 1.70 for rust) it fails in this way.
Running unittests src/lib.rs (target/debug/deps/anstyle_parse-955adce0aca35b06)
running 3 tests
test state::definitions::tests::pack_state_action ... ok
test state::definitions::tests::unpack_state_action ... ok
rustfmt: error while loading shared libraries: librustc_driver-01757800555a7cc0.so: cannot open shared object file: No such file or directory
test state::codegen::table ... FAILED
failures:
---- state::codegen::table stdout ----
thread 'state::codegen::table' panicked at '
---- expected: ./src/state/table.rs
++++ actual: In-memory
... long diff omitted...
Update with SNAPSHOTS=overwrite', crates/anstyle-parse/src/state/codegen.rs:12:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
failures:
state::codegen::table
test result: FAILED. 2 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.06s
One naive question do you know if there is some way to specify external dependencies, like file/cmd exists on the PATH, .so/.a file, pkgconfig library, etc. in the Cargo file? It seems to me that it could help in cases like this. Does it make sense?
In a Cargo.toml
? Not at this time. The closest is the rustup toolchain file which I'd rather not use in my projects.
I assume this is a problem for other projects like rust-analyzer which, from what I remember, run rustfmt --check
in CI on the whole project.
test state::codegen::table fails when cargo tests is run. This happens on main, v1.0.1 and v1.0.0 not tested on older releases.
This is on Fedora with rust-1.71.0, gcc-13.1.1 and binutils-2.39