Make it easy to build with address sanitizer in test script
This commit is contained in:
parent
37ee7acc9e
commit
7b39420de3
1 changed files with 16 additions and 2 deletions
18
script/test
18
script/test
|
|
@ -37,12 +37,26 @@ export RUST_BACKTRACE=full
|
|||
|
||||
mode=normal
|
||||
|
||||
while getopts "dDghl:e:s:t:" option; do
|
||||
# Specify a `--target` explicitly. For some reason, this is required for
|
||||
# address sanitizer support.
|
||||
toolchain=$(rustup show active-toolchain)
|
||||
toolchain_regex='(stable|beta|nightly)-([_a-z0-9-]+).*'
|
||||
if [[ $toolchain =~ $toolchain_regex ]]; then
|
||||
release=${BASH_REMATCH[1]}
|
||||
current_target=${BASH_REMATCH[2]}
|
||||
else
|
||||
echo "Failed to parse toolchain '${toolchain}'"
|
||||
fi
|
||||
|
||||
while getopts "adDghl:e:s:t:" option; do
|
||||
case ${option} in
|
||||
h)
|
||||
usage
|
||||
exit
|
||||
;;
|
||||
a)
|
||||
export RUSTFLAGS="-Z sanitizer=address"
|
||||
;;
|
||||
l)
|
||||
export TREE_SITTER_TEST_LANGUAGE_FILTER=${OPTARG}
|
||||
;;
|
||||
|
|
@ -82,5 +96,5 @@ if [[ "${mode}" == "debug" ]]; then
|
|||
)
|
||||
lldb "${test_binary}" -- $top_level_filter
|
||||
else
|
||||
cargo test -p tree-sitter-cli --jobs 1 $top_level_filter -- --nocapture
|
||||
cargo test --target=${current_target} -p tree-sitter-cli --jobs 1 $top_level_filter -- --nocapture
|
||||
fi
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue