feat: enhance cargo test script to support profile and release flag

This commit is contained in:
2026-03-10 22:33:24 -05:00
parent 8126f06bf8
commit 170025c448
3 changed files with 44 additions and 4 deletions
+8 -2
View File
@@ -1,14 +1,16 @@
#!/bin/sh
set -eu
if [ "$#" -ne 3 ]; then
echo "usage: $0 <cargo> <src_root> <build_root>" >&2
if [ "$#" -ne 5 ]; then
echo "usage: $0 <cargo> <src_root> <build_root> <profile> <release_flag>" >&2
exit 2
fi
cargo_bin="$1"
src_root="$2"
build_root="$3"
profile="$4"
release_flag="$5"
cargo_home="$build_root/cargo-home"
cargo_target_dir="$build_root/cargo-target"
@@ -18,4 +20,8 @@ mkdir -p "$cargo_home" "$cargo_target_dir"
export CARGO_HOME="$cargo_home"
export CARGO_TARGET_DIR="$cargo_target_dir"
if [ "$release_flag" = "1" ]; then
exec "$cargo_bin" test --locked --manifest-path "$src_root/Cargo.toml" --profile "$profile"
fi
exec "$cargo_bin" test --locked --manifest-path "$src_root/Cargo.toml"