cmake/Tests.cmake: Fix failure in cargo test (#9603)

The FISH_RUST_TARGET_DIR is not set for Tests.cmake, the target_dir will set to
$CARGO_MANIFEST_DIR/target. But if build.target-dir or CARGO_TARGET_DIR is set,
the real target_dir doesn't at the $CARGO_MANIFEST_DIR/target. It causes failure
in cargo test. Then, set --target-dir for cargo test.

Closes #9600
This commit is contained in:
Akatsuki Rui
2023-02-22 01:44:59 +08:00
committed by GitHub
parent ad5b3a5b17
commit 5a5cf267b7

View File

@@ -179,7 +179,7 @@ endforeach(PEXPECT)
# Rust stuff.
add_test(
NAME "cargo-test"
COMMAND cargo test
COMMAND cargo test --target-dir target
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/fish-rust"
)
set_tests_properties("cargo-test" PROPERTIES SKIP_RETURN_CODE ${SKIP_RETURN_CODE})
@@ -187,7 +187,7 @@ add_test_target("cargo-test")
add_test(
NAME "cargo-test-widestring"
COMMAND cargo test
COMMAND cargo test --target-dir target
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/fish-rust/widestring-suffix/"
)
add_test_target("cargo-test-widestring")