Closed jamessan closed 2 years ago
Hm, libloading
has a MSRV preceding 1.57 by a lot. If we wanted to support running tests with --target-dir
, wouldn't it be more straightforward for the test to create the target/
directory if it doesn't yet exist? target/
is .gitignore
d and it is unclear to me it would be a huge deal if $PWD/target
was created by a test even if --target-dir
flag was set.
I only mentioned 1.57 as the reason for honoring $CARGO_TARGET_TEMPDIR
. It will still work with versions prior to that. However, $CARGO_TARGET_DIR
has existed for much longer (since Cargo 0.28.0).
wouldn't it be more straightforward for the test to create the
target/
directory if it doesn't yet exist?
That won't work if the reason --target-dir
is being used is because the source tree is read-only.
I only mentioned 1.57 as the reason for honoring
$CARGO_TARGET_TEMPDIR
. It will still work with versions prior to that. However,$CARGO_TARGET_DIR
has existed for much longer (since Cargo 0.28.0).wouldn't it be more straightforward for the test to create the
target/
directory if it doesn't yet exist?That won't work if the reason
--target-dir
is being used is because the source tree is read-only.
Does this satisfy your concerns, @nagisa?
Thanks, merged in https://github.com/nagisa/rust_libloading/commit/8009f51a9fc95c06d34cf12cb3897791ecd9dc92
Sorry for the delay ^^
Running the tests with “cargo test --target-dir” fails because "target/" doesn't exist.
Rust 1.57.0 added
$CARGO_TARGET_TMPDIR
as a scratch directory for integration tests to use, which Cargo itself won't touch.Therefore, use
$CARGO_TARGET_TMPDIR
if it's available,$CARGO_TARGET_DIR
otherwise, and fallback to "target" as a last resort.