mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-05 08:11:15 -03:00
Use cargo build -Z build-std for ASAN
This is recommended and increases coverage.
This commit is contained in:
2
.github/workflows/main.yml
vendored
2
.github/workflows/main.yml
vendored
@@ -89,6 +89,8 @@ jobs:
|
||||
with:
|
||||
# All -Z options require running nightly
|
||||
rust-version: nightly
|
||||
# ASAN uses `cargo build -Zbuild-std` which requires the rust-src component
|
||||
components: rust-src
|
||||
- name: Install deps
|
||||
run: |
|
||||
sudo apt install gettext libncurses5-dev libpcre2-dev python3-pip tmux
|
||||
|
||||
@@ -15,9 +15,19 @@ set(fish_rust_target "fish-rust")
|
||||
|
||||
set(fish_autocxx_gen_dir "${CMAKE_BINARY_DIR}/fish-autocxx-gen/")
|
||||
|
||||
if(NOT DEFINED CARGO_FLAGS)
|
||||
# Corrosion doesn't like an empty string as FLAGS. This is basically a no-op alternative.
|
||||
# See https://github.com/corrosion-rs/corrosion/issues/356
|
||||
set(CARGO_FLAGS "--config" "foo=0")
|
||||
endif()
|
||||
if(DEFINED ASAN)
|
||||
list(APPEND CARGO_FLAGS "-Z" "build-std")
|
||||
endif()
|
||||
|
||||
corrosion_import_crate(
|
||||
MANIFEST_PATH "${CMAKE_SOURCE_DIR}/fish-rust/Cargo.toml"
|
||||
FEATURES "fish-ffi-tests"
|
||||
FLAGS "${CARGO_FLAGS}"
|
||||
)
|
||||
|
||||
# We need the build dir because cxx puts our headers in there.
|
||||
|
||||
@@ -193,7 +193,7 @@ endif()
|
||||
if(NOT DEFINED ASAN)
|
||||
add_test(
|
||||
NAME "cargo-test"
|
||||
COMMAND cargo test --target-dir target ${cargo_target_opt}
|
||||
COMMAND cargo test ${CARGO_FLAGS} --target-dir target ${cargo_target_opt}
|
||||
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/fish-rust"
|
||||
)
|
||||
set_tests_properties("cargo-test" PROPERTIES SKIP_RETURN_CODE ${SKIP_RETURN_CODE})
|
||||
@@ -202,7 +202,7 @@ endif()
|
||||
|
||||
add_test(
|
||||
NAME "cargo-test-widestring"
|
||||
COMMAND cargo test --target-dir target ${cargo_target_opt}
|
||||
COMMAND cargo test ${CARGO_FLAGS} --target-dir target ${cargo_target_opt}
|
||||
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/fish-rust/widestring-suffix/"
|
||||
)
|
||||
add_test_target("cargo-test-widestring")
|
||||
|
||||
Reference in New Issue
Block a user